mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 16:36:21 +02:00
Feature/prompt terms (#128)
* Add prompt terms * Remove dupe template code
This commit is contained in:
parent
2942c4dcf0
commit
7c0c471e55
1 changed files with 34 additions and 42 deletions
|
|
@ -8,6 +8,36 @@ local default_prompts = import "prompts/default-prompts.jsonnet";
|
|||
|
||||
prompts:: default_prompts,
|
||||
|
||||
local prompt_template_args = [ "--prompt" ] + [
|
||||
p.key + "=" + p.value.prompt,
|
||||
for p in std.objectKeysValuesAll($.prompts.templates)
|
||||
],
|
||||
|
||||
local prompt_response_type_args = [ "--prompt-response-type" ] + [
|
||||
p.key + "=" + p.value["response-type"],
|
||||
for p in std.objectKeysValuesAll($.prompts.templates)
|
||||
if std.objectHas(p.value, "response-type")
|
||||
],
|
||||
|
||||
local prompt_schema_args = [ "--prompt-schema" ] + [
|
||||
(
|
||||
p.key + "=" +
|
||||
std.manifestJsonMinified(p.value["schema"])
|
||||
)
|
||||
for p in std.objectKeysValuesAll($.prompts.templates)
|
||||
if std.objectHas(p.value, "schema")
|
||||
],
|
||||
|
||||
local prompt_term_args = [ "--prompt-term" ] + [
|
||||
p.key + "=" + t.key + ":" + t.value
|
||||
for p in std.objectKeysValuesAll($.prompts.templates)
|
||||
if std.objectHas(p.value, "terms")
|
||||
for t in std.objectKeysValuesAll(p.value.terms)
|
||||
],
|
||||
|
||||
local prompt_args = prompt_template_args + prompt_response_type_args +
|
||||
prompt_schema_args + prompt_term_args,
|
||||
|
||||
"prompt" +: {
|
||||
|
||||
create:: function(engine)
|
||||
|
|
@ -28,27 +58,8 @@ local default_prompts = import "prompts/default-prompts.jsonnet";
|
|||
"--system-prompt",
|
||||
$["prompts"]["system-template"],
|
||||
|
||||
"--prompt",
|
||||
|
||||
] + [
|
||||
p.key + "=" + p.value.prompt,
|
||||
for p in std.objectKeysValuesAll($.prompts.templates)
|
||||
] + [
|
||||
"--prompt-response-type"
|
||||
] + [
|
||||
p.key + "=" + p.value["response-type"],
|
||||
for p in std.objectKeysValuesAll($.prompts.templates)
|
||||
if std.objectHas(p.value, "response-type")
|
||||
] + [
|
||||
"--prompt-schema"
|
||||
] + [
|
||||
(
|
||||
p.key + "=" +
|
||||
std.manifestJsonMinified(p.value["schema"])
|
||||
)
|
||||
for p in std.objectKeysValuesAll($.prompts.templates)
|
||||
if std.objectHas(p.value, "schema")
|
||||
])
|
||||
] + prompt_args
|
||||
)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
|
|
@ -90,27 +101,8 @@ local default_prompts = import "prompts/default-prompts.jsonnet";
|
|||
"--system-prompt",
|
||||
$["prompts"]["system-template"],
|
||||
|
||||
"--prompt",
|
||||
|
||||
] + [
|
||||
p.key + "=" + p.value.prompt,
|
||||
for p in std.objectKeysValuesAll($.prompts.templates)
|
||||
] + [
|
||||
"--prompt-response-type"
|
||||
] + [
|
||||
p.key + "=" + p.value["response-type"],
|
||||
for p in std.objectKeysValuesAll($.prompts.templates)
|
||||
if std.objectHas(p.value, "response-type")
|
||||
] + [
|
||||
"--prompt-schema"
|
||||
] + [
|
||||
(
|
||||
p.key + "=" +
|
||||
std.manifestJsonMinified(p.value["schema"])
|
||||
)
|
||||
for p in std.objectKeysValuesAll($.prompts.templates)
|
||||
if std.objectHas(p.value, "schema")
|
||||
])
|
||||
] + prompt_args
|
||||
)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue