mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-16 16:51:02 +02:00
Remove dupe template code
This commit is contained in:
parent
bc527237d2
commit
6b39bdcb40
1 changed files with 34 additions and 49 deletions
|
|
@ -8,6 +8,36 @@ local default_prompts = import "prompts/default-prompts.jsonnet";
|
||||||
|
|
||||||
prompts:: default_prompts,
|
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" +: {
|
"prompt" +: {
|
||||||
|
|
||||||
create:: function(engine)
|
create:: function(engine)
|
||||||
|
|
@ -28,34 +58,8 @@ local default_prompts = import "prompts/default-prompts.jsonnet";
|
||||||
"--system-prompt",
|
"--system-prompt",
|
||||||
$["prompts"]["system-template"],
|
$["prompts"]["system-template"],
|
||||||
|
|
||||||
"--prompt",
|
] + prompt_args
|
||||||
|
)
|
||||||
] + [
|
|
||||||
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-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)
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
.with_limits("0.5", "128M")
|
||||||
.with_reservations("0.1", "128M");
|
.with_reservations("0.1", "128M");
|
||||||
|
|
||||||
|
|
@ -97,27 +101,8 @@ local default_prompts = import "prompts/default-prompts.jsonnet";
|
||||||
"--system-prompt",
|
"--system-prompt",
|
||||||
$["prompts"]["system-template"],
|
$["prompts"]["system-template"],
|
||||||
|
|
||||||
"--prompt",
|
] + prompt_args
|
||||||
|
)
|
||||||
] + [
|
|
||||||
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")
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
.with_limits("0.5", "128M")
|
||||||
.with_reservations("0.1", "128M");
|
.with_reservations("0.1", "128M");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue