Add topic prompt to templates

This commit is contained in:
Cyber MacGeddon 2024-09-15 23:26:46 +01:00
parent 728ff7542a
commit fb9414add6
7 changed files with 39 additions and 0 deletions

View file

@ -58,6 +58,31 @@ local url = import "values/url.jsonnet";
},
"kg-extract-topics" +: {
create:: function(engine)
local container =
engine.container("kg-extract-topics")
.with_image(images.trustgraph)
.with_command([
"kg-extract-topics",
"-p",
url.pulsar,
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"kg-extract-topics", [ container ]
);
engine.resources([
containerSet,
])
},
"graph-rag" +: {
create:: function(engine)

View file

@ -25,6 +25,8 @@ local default_prompts = import "prompts/default-prompts.jsonnet";
$["prompt-definition-template"],
"--relationship-template",
$["prompt-relationship-template"],
"--topic-template",
$["prompt-topic-template"],
"--knowledge-query-template",
$["prompt-knowledge-query-template"],
"--document-query-template",
@ -68,6 +70,8 @@ local default_prompts = import "prompts/default-prompts.jsonnet";
$["prompt-definition-template"],
"--relationship-template",
$["prompt-relationship-template"],
"--topic-template",
$["prompt-topic-template"],
"--knowledge-query-template",
$["prompt-knowledge-query-template"],
"--document-query-template",

View file

@ -7,6 +7,8 @@
// "prompt-relationship-template":: "PROMPT GOES HERE",
// "prompt-topic-template":: "PROMPT GOES HERE",
// "prompt-knowledge-query-template":: "PROMPT GOES HERE",
// "prompt-document-query-template":: "PROMPT GOES HERE",

View file

@ -8,6 +8,8 @@
"prompt-relationship-template":: "<instructions>\nStudy the following text and derive entity relationships. For each\nrelationship, derive the subject, predicate and object of the relationship.\nOutput relationships in JSON format as an arary of objects with fields:\n- subject: the subject of the relationship\n- predicate: the predicate\n- object: the object of the relationship\n- object-entity: false if the object is a simple data type: name, value or date. true if it is an entity.\n</instructions>\n\n<text>\n{text}\n</text>\n\n<requirements>\nYou will respond only with raw JSON format data. Do not provide\nexplanations. Do not use special characters in the abstract text. The\nabstract must be written as plain text. Do not add markdown formatting\nor headers or prefixes.\n</requirements>",
"prompt-topic-template":: "You are a helpful assistant that performs information extraction tasks for a provided text.\nRead the provided text. You will identify topics and their definitions in JSON.\n\nReading Instructions:\n- Ignore document formatting in the provided text.\n- Study the provided text carefully.\n\nHere is the text:\n{text}\n\nResponse Instructions: \n- Do not respond with special characters.\n- Return only topics that are concepts and unique to the provided text.\n- Respond only with well-formed JSON.\n- The JSON response shall be an array of objects with keys \"topic\" and \"definition\". \n- The JSON response shall use the following structure:\n\n```json\n[{{\"topic\": string, \"definition\": string}}]\n```\n\n- Do not write any additional text or explanations.",
"prompt-knowledge-query-template":: "Study the following set of knowledge statements. The statements are written in Cypher format that has been extracted from a knowledge graph. Use only the provided set of knowledge statements in your response. Do not speculate if the answer is not found in the provided set of knowledge statements.\n\nHere's the knowledge statements:\n{graph}\n\nUse only the provided knowledge statements to respond to the following:\n{query}\n",
"prompt-document-query-template":: "Study the following context. Use only the information provided in the context in your response. Do not speculate if the answer is not found in the provided set of knowledge statements.\n\nHere is the context:\n{documents}\n\nUse only the provided knowledge statements to respond to the following:\n{query}\n",

View file

@ -6,6 +6,8 @@
// "prompt-relationship-template":: "PROMPT GOES HERE",
// "prompt-topic-template":: "PROMPT GOES HERE",
// "prompt-knowledge-query-template":: "PROMPT GOES HERE",
// "prompt-document-query-template":: "PROMPT GOES HERE",

View file

@ -7,6 +7,8 @@
// "prompt-relationship-template":: "PROMPT GOES HERE",
// "prompt-topic-template":: "PROMPT GOES HERE",
// "prompt-knowledge-query-template":: "PROMPT GOES HERE",
// "prompt-document-query-template":: "PROMPT GOES HERE",

View file

@ -11,6 +11,8 @@ local url = import "values/url.jsonnet";
// "prompt-relationship-template":: "PROMPT GOES HERE",
// "prompt-topic-template":: "PROMPT GOES HERE",
// "prompt-knowledge-query-template":: "PROMPT GOES HERE",
// "prompt-document-query-template":: "PROMPT GOES HERE",