mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-05-18 03:45:12 +02:00
Dual model templates (#263)
* Dual-mode templates * Fixed generate-all so that works * Fix ability to specify Claude model
This commit is contained in:
parent
1bb1112569
commit
cec9e29222
24 changed files with 725 additions and 360 deletions
61
templates/components/azure-openai-rag.jsonnet
Normal file
61
templates/components/azure-openai-rag.jsonnet
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
local base = import "base/base.jsonnet";
|
||||
local images = import "values/images.jsonnet";
|
||||
local url = import "values/url.jsonnet";
|
||||
local prompts = import "prompts/mixtral.jsonnet";
|
||||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["ollama-rag-" + key]:: value,
|
||||
},
|
||||
|
||||
"azure-openai-rag-model":: "GPT-3.5-Turbo",
|
||||
"azure-openai-rag-max-output-tokens":: 4192,
|
||||
"azure-openai-rag-temperature":: 0.0,
|
||||
|
||||
"text-completion-rag" +: {
|
||||
|
||||
create:: function(engine)
|
||||
|
||||
local envSecrets = engine.envSecrets("azure-openai-credentials")
|
||||
.with_env_var("AZURE_TOKEN", "azure-token");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-azure",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-x",
|
||||
std.toString($["azure-openai-rag-max-output-tokens"]),
|
||||
"-t",
|
||||
"%0.3f" % $["azure-openai-rag-temperature"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_env_var_secrets(envSecrets)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSetRag,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
},
|
||||
|
||||
} + prompts
|
||||
|
||||
|
|
@ -5,6 +5,11 @@ local prompts = import "prompts/mixtral.jsonnet";
|
|||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["azure-openai-" + key]:: value,
|
||||
},
|
||||
|
||||
"azure-openai-model":: "GPT-3.5-Turbo",
|
||||
"azure-openai-max-output-tokens":: 4192,
|
||||
"azure-openai-temperature":: 0.0,
|
||||
|
|
@ -34,48 +39,18 @@ local prompts = import "prompts/mixtral.jsonnet";
|
|||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-azure",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-x",
|
||||
std.toString($["azure-openai-max-output-tokens"]),
|
||||
"-t",
|
||||
"%0.3f" % $["azure-openai-temperature"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_env_var_secrets(envSecrets)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSet = engine.containers(
|
||||
"text-completion", [ container ]
|
||||
);
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local service =
|
||||
engine.internalService(containerSet)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSet,
|
||||
containerSetRag,
|
||||
service,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
},
|
||||
|
|
|
|||
60
templates/components/azure-rag.jsonnet
Normal file
60
templates/components/azure-rag.jsonnet
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
local images = import "values/images.jsonnet";
|
||||
local url = import "values/url.jsonnet";
|
||||
local prompts = import "prompts/mixtral.jsonnet";
|
||||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["azure-rag-" + key]:: value,
|
||||
},
|
||||
|
||||
"azure-rag-max-output-tokens":: 4096,
|
||||
"azure-rag-temperature":: 0.0,
|
||||
|
||||
"text-completion-rag" +: {
|
||||
|
||||
create:: function(engine)
|
||||
|
||||
local envSecrets = engine.envSecrets("azure-credentials")
|
||||
.with_env_var("AZURE_TOKEN", "azure-token")
|
||||
.with_env_var("AZURE_ENDPOINT", "azure-endpoint");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-azure",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-x",
|
||||
std.toString($["azure-rag-max-output-tokens"]),
|
||||
"-t",
|
||||
"%0.3f" % $["azure-rag-temperature"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_env_var_secrets(envSecrets)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSetRag,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
}
|
||||
|
||||
} + prompts
|
||||
|
||||
|
|
@ -1,10 +1,14 @@
|
|||
local base = import "base/base.jsonnet";
|
||||
local images = import "values/images.jsonnet";
|
||||
local url = import "values/url.jsonnet";
|
||||
local prompts = import "prompts/mixtral.jsonnet";
|
||||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["azure-" + key]:: value,
|
||||
},
|
||||
|
||||
"azure-max-output-tokens":: 4096,
|
||||
"azure-temperature":: 0.0,
|
||||
|
||||
|
|
@ -32,48 +36,18 @@ local prompts = import "prompts/mixtral.jsonnet";
|
|||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-azure",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-x",
|
||||
std.toString($["azure-max-output-tokens"]),
|
||||
"-t",
|
||||
"%0.3f" % $["azure-temperature"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_env_var_secrets(envSecrets)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSet = engine.containers(
|
||||
"text-completion", [ container ]
|
||||
);
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local service =
|
||||
engine.internalService(containerSet)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSet,
|
||||
containerSetRag,
|
||||
service,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
}
|
||||
|
|
|
|||
66
templates/components/bedrock-rag.jsonnet
Normal file
66
templates/components/bedrock-rag.jsonnet
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
local base = import "base/base.jsonnet";
|
||||
local images = import "values/images.jsonnet";
|
||||
local url = import "values/url.jsonnet";
|
||||
local prompts = import "prompts/mixtral.jsonnet";
|
||||
local chunker = import "chunker-recursive.jsonnet";
|
||||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["bedrock-rag-" + key]:: value,
|
||||
},
|
||||
|
||||
"bedrock-rag-max-output-tokens":: 4096,
|
||||
"bedrock-rag-temperature":: 0.0,
|
||||
"bedrock-rag-model":: "mistral.mixtral-8x7b-instruct-v0:1",
|
||||
|
||||
"text-completion-rag" +: {
|
||||
|
||||
create:: function(engine)
|
||||
|
||||
local envSecrets = engine.envSecrets("bedrock-credentials")
|
||||
.with_env_var("AWS_ID_KEY", "aws-id-key")
|
||||
.with_env_var("AWS_SECRET", "aws-secret")
|
||||
.with_env_var("AWS_REGION", "aws-region");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-bedrock",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-x",
|
||||
std.toString($["bedrock-rag-max-output-tokens"]),
|
||||
"-t",
|
||||
"%0.3f" % $["bedrock-rag-temperature"],
|
||||
"-m",
|
||||
$["bedrock-rag-model"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_env_var_secrets(envSecrets)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSetRag,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
},
|
||||
|
||||
} + prompts + chunker
|
||||
|
||||
|
|
@ -6,6 +6,11 @@ local chunker = import "chunker-recursive.jsonnet";
|
|||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["bedrock-" + key]:: value,
|
||||
},
|
||||
|
||||
"bedrock-max-output-tokens":: 4096,
|
||||
"bedrock-temperature":: 0.0,
|
||||
"bedrock-model":: "mistral.mixtral-8x7b-instruct-v0:1",
|
||||
|
|
@ -37,50 +42,18 @@ local chunker = import "chunker-recursive.jsonnet";
|
|||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-bedrock",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-x",
|
||||
std.toString($["bedrock-max-output-tokens"]),
|
||||
"-t",
|
||||
"%0.3f" % $["bedrock-temperature"],
|
||||
"-m",
|
||||
$["bedrock-model"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_env_var_secrets(envSecrets)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSet = engine.containers(
|
||||
"text-completion", [ container ]
|
||||
);
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local service =
|
||||
engine.internalService(containerSet)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSet,
|
||||
containerSetRag,
|
||||
service,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
},
|
||||
|
|
|
|||
63
templates/components/claude-rag.jsonnet
Normal file
63
templates/components/claude-rag.jsonnet
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
local base = import "base/base.jsonnet";
|
||||
local images = import "values/images.jsonnet";
|
||||
local url = import "values/url.jsonnet";
|
||||
local prompts = import "prompts/mixtral.jsonnet";
|
||||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["claude-rag-" + key]:: value,
|
||||
},
|
||||
|
||||
"claude-rag-model":: "claude-3-sonnet-20240229",
|
||||
"claude-rag-max-output-tokens":: 4096,
|
||||
"claude-rag-temperature":: 0.0,
|
||||
|
||||
"text-completion-rag" +: {
|
||||
|
||||
create:: function(engine)
|
||||
|
||||
local envSecrets = engine.envSecrets("claude-credentials")
|
||||
.with_env_var("CLAUDE_KEY", "claude-key");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-claude",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-x",
|
||||
std.toString($["claude-rag-max-output-tokens"]),
|
||||
"-m",
|
||||
$["claude-rag-model"],
|
||||
"-t",
|
||||
"%0.3f" % $["claude-rag-temperature"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_env_var_secrets(envSecrets)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSetRag,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
},
|
||||
|
||||
} + prompts
|
||||
|
||||
|
|
@ -5,6 +5,12 @@ local prompts = import "prompts/mixtral.jsonnet";
|
|||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["claude-" + key]:: value,
|
||||
},
|
||||
|
||||
"claude-model":: "claude-3-sonnet-20240229",
|
||||
"claude-max-output-tokens":: 4096,
|
||||
"claude-temperature":: 0.0,
|
||||
|
||||
|
|
@ -24,6 +30,8 @@ local prompts = import "prompts/mixtral.jsonnet";
|
|||
url.pulsar,
|
||||
"-x",
|
||||
std.toString($["claude-max-output-tokens"]),
|
||||
"-m",
|
||||
$["claude-model"],
|
||||
"-t",
|
||||
"%0.3f" % $["claude-temperature"],
|
||||
])
|
||||
|
|
@ -31,48 +39,18 @@ local prompts = import "prompts/mixtral.jsonnet";
|
|||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-claude",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-x",
|
||||
std.toString($["claude-max-output-tokens"]),
|
||||
"-t",
|
||||
"%0.3f" % $["claude-temperature"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_env_var_secrets(envSecrets)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSet = engine.containers(
|
||||
"text-completion", [ container ]
|
||||
);
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local service =
|
||||
engine.internalService(containerSet)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSet,
|
||||
containerSetRag,
|
||||
service,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
},
|
||||
|
|
|
|||
56
templates/components/cohere-rag.jsonnet
Normal file
56
templates/components/cohere-rag.jsonnet
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
local base = import "base/base.jsonnet";
|
||||
local images = import "values/images.jsonnet";
|
||||
local url = import "values/url.jsonnet";
|
||||
local prompts = import "prompts/mixtral.jsonnet";
|
||||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["cohere-rag-" + key]:: value,
|
||||
},
|
||||
|
||||
"cohere-rag-temperature":: 0.0,
|
||||
|
||||
"text-completion-rag" +: {
|
||||
|
||||
create:: function(engine)
|
||||
|
||||
local envSecrets = engine.envSecrets("cohere-credentials")
|
||||
.with_env_var("COHERE_KEY", "cohere-key");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-cohere",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-t",
|
||||
"%0.3f" % $["cohere-rag-temperature"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSetRag,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
},
|
||||
|
||||
} + prompts
|
||||
|
||||
|
|
@ -5,9 +5,10 @@ local prompts = import "prompts/mixtral.jsonnet";
|
|||
|
||||
{
|
||||
|
||||
// Override chunking
|
||||
"chunk-size":: 150,
|
||||
"chunk-overlap":: 10,
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["cohere-" + key]:: value,
|
||||
},
|
||||
|
||||
"cohere-temperature":: 0.0,
|
||||
|
||||
|
|
@ -31,45 +32,18 @@ local prompts = import "prompts/mixtral.jsonnet";
|
|||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-cohere",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-t",
|
||||
"%0.3f" % $["cohere-temperature"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSet = engine.containers(
|
||||
"text-completion", [ container ]
|
||||
);
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local service =
|
||||
engine.internalService(containerSet)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSet,
|
||||
containerSetRag,
|
||||
service,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
},
|
||||
|
|
|
|||
65
templates/components/googleaistudio-rag.jsonnet
Normal file
65
templates/components/googleaistudio-rag.jsonnet
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
local base = import "base/base.jsonnet";
|
||||
local images = import "values/images.jsonnet";
|
||||
local url = import "values/url.jsonnet";
|
||||
local prompts = import "prompts/mixtral.jsonnet";
|
||||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["googleaistudio-rag-" + key]:: value,
|
||||
},
|
||||
|
||||
"googleaistudio-rag-max-output-tokens":: 4096,
|
||||
"googleaistudio-rag-temperature":: 0.0,
|
||||
"googleaistudio-rag-model":: "gemini-1.5-flash-002",
|
||||
|
||||
"text-completion-rag" +: {
|
||||
|
||||
create:: function(engine)
|
||||
|
||||
local envSecrets = engine.envSecrets("googleaistudio-key")
|
||||
.with_env_var("GOOGLE_AI_STUDIO_KEY", "googleaistudio-key");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-googleaistudio",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-x",
|
||||
std.toString(
|
||||
$["googleaistudio-rag-max-output-tokens"]
|
||||
),
|
||||
"-t",
|
||||
"%0.3f" % $["googleaistudio-rag-temperature"],
|
||||
"-m",
|
||||
$["googleaistudio-rag-model"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_env_var_secrets(envSecrets)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSetRag,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
},
|
||||
|
||||
} + prompts
|
||||
|
||||
|
|
@ -34,50 +34,18 @@ local prompts = import "prompts/mixtral.jsonnet";
|
|||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-googleaistudio",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-x",
|
||||
std.toString($["googleaistudio-max-output-tokens"]),
|
||||
"-t",
|
||||
"%0.3f" % $["googleaistudio-temperature"],
|
||||
"-m",
|
||||
$["googleaistudio-model"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_env_var_secrets(envSecrets)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSet = engine.containers(
|
||||
"text-completion", [ container ]
|
||||
);
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local service =
|
||||
engine.internalService(containerSet)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSet,
|
||||
containerSetRag,
|
||||
service,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
},
|
||||
|
|
|
|||
57
templates/components/llamafile-rag.jsonnet
Normal file
57
templates/components/llamafile-rag.jsonnet
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
local base = import "base/base.jsonnet";
|
||||
local images = import "values/images.jsonnet";
|
||||
local url = import "values/url.jsonnet";
|
||||
local prompts = import "prompts/slm.jsonnet";
|
||||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["llamafile-rag-" + key]:: value,
|
||||
},
|
||||
|
||||
"llamafile-rag-model":: "LLaMA_CPP",
|
||||
|
||||
"text-completion-rag" +: {
|
||||
|
||||
create:: function(engine)
|
||||
|
||||
local envSecrets = engine.envSecrets("llamafile-credentials")
|
||||
.with_env_var("LLAMAFILE_URL", "llamafile-url");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-llamafile",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-m",
|
||||
$["llamafile-rag-model"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_env_var_secrets(envSecrets)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8080, 8080, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSetRag,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
},
|
||||
|
||||
} + prompts
|
||||
|
||||
|
|
@ -5,6 +5,11 @@ local prompts = import "prompts/slm.jsonnet";
|
|||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["llamafile-" + key]:: value,
|
||||
},
|
||||
|
||||
"llamafile-model":: "LLaMA_CPP",
|
||||
|
||||
"text-completion" +: {
|
||||
|
|
@ -28,46 +33,18 @@ local prompts = import "prompts/slm.jsonnet";
|
|||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-llamafile",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-m",
|
||||
$["llamafile-model"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_env_var_secrets(envSecrets)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSet = engine.containers(
|
||||
"text-completion", [ container ]
|
||||
);
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local service =
|
||||
engine.internalService(containerSet)
|
||||
.with_port(8080, 8080, "metrics");
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8080, 8080, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSet,
|
||||
containerSetRag,
|
||||
service,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
},
|
||||
|
|
|
|||
57
templates/components/ollama-rag.jsonnet
Normal file
57
templates/components/ollama-rag.jsonnet
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
local base = import "base/base.jsonnet";
|
||||
local images = import "values/images.jsonnet";
|
||||
local url = import "values/url.jsonnet";
|
||||
local prompts = import "prompts/mixtral.jsonnet";
|
||||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["ollama-rag-" + key]:: value,
|
||||
},
|
||||
|
||||
"ollama-rag-model":: "gemma2:9b",
|
||||
|
||||
"text-completion-rag" +: {
|
||||
|
||||
create:: function(engine)
|
||||
|
||||
local envSecrets = engine.envSecrets("ollama-credentials")
|
||||
.with_env_var("OLLAMA_HOST", "ollama-host");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-ollama",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-m",
|
||||
$["ollama-rag-model"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_env_var_secrets(envSecrets)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8080, 8080, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSetRag,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
},
|
||||
|
||||
} + prompts
|
||||
|
||||
|
|
@ -5,6 +5,11 @@ local prompts = import "prompts/mixtral.jsonnet";
|
|||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["ollama-" + key]:: value,
|
||||
},
|
||||
|
||||
"ollama-model":: "gemma2:9b",
|
||||
|
||||
"text-completion" +: {
|
||||
|
|
@ -28,46 +33,18 @@ local prompts = import "prompts/mixtral.jsonnet";
|
|||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-ollama",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-m",
|
||||
$["ollama-model"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_env_var_secrets(envSecrets)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSet = engine.containers(
|
||||
"text-completion", [ container ]
|
||||
);
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local service =
|
||||
engine.internalService(containerSet)
|
||||
.with_port(8080, 8080, "metrics");
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8080, 8080, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSet,
|
||||
containerSetRag,
|
||||
service,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
},
|
||||
|
|
|
|||
63
templates/components/openai-rag.jsonnet
Normal file
63
templates/components/openai-rag.jsonnet
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
local base = import "base/base.jsonnet";
|
||||
local images = import "values/images.jsonnet";
|
||||
local url = import "values/url.jsonnet";
|
||||
local prompts = import "prompts/mixtral.jsonnet";
|
||||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["openai-rag-" + key]:: value,
|
||||
},
|
||||
|
||||
"openai-rag-max-output-tokens":: 4096,
|
||||
"openai-rag-temperature":: 0.0,
|
||||
"openai-rag-model":: "GPT-3.5-Turbo",
|
||||
|
||||
"text-completion-rag" +: {
|
||||
|
||||
create:: function(engine)
|
||||
|
||||
local envSecrets = engine.envSecrets("openai-credentials")
|
||||
.with_env_var("OPENAI_TOKEN", "openai-token");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-openai",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-x",
|
||||
std.toString($["openai-rag-max-output-tokens"]),
|
||||
"-t",
|
||||
"%0.3f" % $["openai-rag-temperature"],
|
||||
"-m",
|
||||
$["openai-rag-model"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_env_var_secrets(envSecrets)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8080, 8080, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSetRag,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
},
|
||||
|
||||
} + prompts
|
||||
|
||||
|
|
@ -5,6 +5,11 @@ local prompts = import "prompts/mixtral.jsonnet";
|
|||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["openai-" + key]:: value,
|
||||
},
|
||||
|
||||
"openai-max-output-tokens":: 4096,
|
||||
"openai-temperature":: 0.0,
|
||||
"openai-model":: "GPT-3.5-Turbo",
|
||||
|
|
@ -34,50 +39,18 @@ local prompts = import "prompts/mixtral.jsonnet";
|
|||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerRag =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-openai",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-x",
|
||||
std.toString($["openai-max-output-tokens"]),
|
||||
"-t",
|
||||
"%0.3f" % $["openai-temperature"],
|
||||
"-m",
|
||||
$["openai-model"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_env_var_secrets(envSecrets)
|
||||
.with_limits("0.5", "128M")
|
||||
.with_reservations("0.1", "128M");
|
||||
|
||||
local containerSet = engine.containers(
|
||||
"text-completion", [ container ]
|
||||
);
|
||||
|
||||
local containerSetRag = engine.containers(
|
||||
"text-completion-rag", [ containerRag ]
|
||||
);
|
||||
|
||||
local service =
|
||||
engine.internalService(containerSet)
|
||||
.with_port(8080, 8080, "metrics");
|
||||
|
||||
local serviceRag =
|
||||
engine.internalService(containerSetRag)
|
||||
.with_port(8080, 8080, "metrics");
|
||||
|
||||
engine.resources([
|
||||
envSecrets,
|
||||
containerSet,
|
||||
containerSetRag,
|
||||
service,
|
||||
serviceRag,
|
||||
])
|
||||
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
local base = import "base/base.jsonnet";
|
||||
local images = import "values/images.jsonnet";
|
||||
local url = import "values/url.jsonnet";
|
||||
local prompts = import "prompts/mixtral.jsonnet";
|
||||
local default_prompts = import "prompts/default-prompts.jsonnet";
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
local base = import "base/base.jsonnet";
|
||||
local images = import "values/images.jsonnet";
|
||||
local url = import "values/url.jsonnet";
|
||||
local prompt = import "prompt-template.jsonnet";
|
||||
|
||||
{
|
||||
|
||||
|
|
@ -181,5 +180,5 @@ local prompt = import "prompt-template.jsonnet";
|
|||
|
||||
},
|
||||
|
||||
} + prompt
|
||||
}
|
||||
|
||||
|
|
|
|||
74
templates/components/vertexai-rag.jsonnet
Normal file
74
templates/components/vertexai-rag.jsonnet
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
local base = import "base/base.jsonnet";
|
||||
local images = import "values/images.jsonnet";
|
||||
local url = import "values/url.jsonnet";
|
||||
local prompts = import "prompts/mixtral.jsonnet";
|
||||
|
||||
{
|
||||
|
||||
with:: function(key, value)
|
||||
self + {
|
||||
["vertexai-rag-" + key]:: value,
|
||||
},
|
||||
|
||||
"vertexai-rag-model":: "gemini-1.0-pro-001",
|
||||
"vertexai-rag-private-key":: "/vertexai/private.json",
|
||||
"vertexai-rag-region":: "us-central1",
|
||||
"vertexai-rag-max-output-tokens":: 4096,
|
||||
"vertexai-rag-temperature":: 0.0,
|
||||
|
||||
"text-completion-rag" +: {
|
||||
|
||||
create:: function(engine)
|
||||
|
||||
local cfgVol = engine.secretVolume(
|
||||
"vertexai-creds",
|
||||
"./vertexai",
|
||||
{
|
||||
"private.json": importstr "vertexai/private.json",
|
||||
}
|
||||
);
|
||||
|
||||
local container =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-vertexai",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-k",
|
||||
$["vertexai-rag-private-key"],
|
||||
"-r",
|
||||
$["vertexai-rag-region"],
|
||||
"-x",
|
||||
std.toString($["vertexai-rag-max-output-tokens"]),
|
||||
"-t",
|
||||
"%0.3f" % $["vertexai-rag-temperature"],
|
||||
"-m",
|
||||
$["vertexai-rag-model"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_limits("0.5", "256M")
|
||||
.with_reservations("0.1", "256M")
|
||||
.with_volume_mount(cfgVol, "/vertexai");
|
||||
|
||||
local containerSet = engine.containers(
|
||||
"text-completion-rag", [ container ]
|
||||
);
|
||||
|
||||
local service =
|
||||
engine.internalService(containerSet)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
engine.resources([
|
||||
cfgVol,
|
||||
containerSet,
|
||||
service,
|
||||
])
|
||||
|
||||
}
|
||||
|
||||
} + prompts
|
||||
|
||||
|
|
@ -61,59 +61,5 @@ local prompts = import "prompts/mixtral.jsonnet";
|
|||
|
||||
},
|
||||
|
||||
"text-completion-rag" +: {
|
||||
|
||||
create:: function(engine)
|
||||
|
||||
local cfgVol = engine.secretVolume(
|
||||
"vertexai-creds",
|
||||
"./vertexai",
|
||||
{
|
||||
"private.json": importstr "vertexai/private.json",
|
||||
}
|
||||
);
|
||||
|
||||
local container =
|
||||
engine.container("text-completion-rag")
|
||||
.with_image(images.trustgraph)
|
||||
.with_command([
|
||||
"text-completion-vertexai",
|
||||
"-p",
|
||||
url.pulsar,
|
||||
"-k",
|
||||
$["vertexai-private-key"],
|
||||
"-r",
|
||||
$["vertexai-region"],
|
||||
"-x",
|
||||
std.toString($["vertexai-max-output-tokens"]),
|
||||
"-t",
|
||||
"%0.3f" % $["vertexai-temperature"],
|
||||
"-m",
|
||||
$["vertexai-model"],
|
||||
"-i",
|
||||
"non-persistent://tg/request/text-completion-rag",
|
||||
"-o",
|
||||
"non-persistent://tg/response/text-completion-rag",
|
||||
])
|
||||
.with_limits("0.5", "256M")
|
||||
.with_reservations("0.1", "256M")
|
||||
.with_volume_mount(cfgVol, "/vertexai");
|
||||
|
||||
local containerSet = engine.containers(
|
||||
"text-completion-rag", [ container ]
|
||||
);
|
||||
|
||||
local service =
|
||||
engine.internalService(containerSet)
|
||||
.with_port(8000, 8000, "metrics");
|
||||
|
||||
engine.resources([
|
||||
cfgVol,
|
||||
containerSet,
|
||||
service,
|
||||
])
|
||||
|
||||
}
|
||||
|
||||
} + prompts
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue