mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-19 18:21:03 +02:00
Partial implementation of dual-mode templates
This commit is contained in:
parent
08d24bf5aa
commit
91f2c77abf
21 changed files with 633 additions and 304 deletions
|
|
@ -1,47 +1,70 @@
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Essentials
|
||||||
|
"trustgraph-base": import "components/trustgraph.jsonnet",
|
||||||
|
"pulsar": import "components/pulsar.jsonnet",
|
||||||
|
|
||||||
|
// LLMs
|
||||||
"azure": import "components/azure.jsonnet",
|
"azure": import "components/azure.jsonnet",
|
||||||
"azure-openai": import "components/azure-openai.jsonnet",
|
"azure-openai": import "components/azure-openai.jsonnet",
|
||||||
"bedrock": import "components/bedrock.jsonnet",
|
"bedrock": import "components/bedrock.jsonnet",
|
||||||
"claude": import "components/claude.jsonnet",
|
"claude": import "components/claude.jsonnet",
|
||||||
"cohere": import "components/cohere.jsonnet",
|
"cohere": import "components/cohere.jsonnet",
|
||||||
"document-rag": import "components/document-rag.jsonnet",
|
|
||||||
"embeddings-hf": import "components/embeddings-hf.jsonnet",
|
|
||||||
"embeddings-ollama": import "components/embeddings-ollama.jsonnet",
|
|
||||||
"googleaistudio": import "components/googleaistudio.jsonnet",
|
"googleaistudio": import "components/googleaistudio.jsonnet",
|
||||||
"grafana": import "components/grafana.jsonnet",
|
"ollama": import "components/ollama.jsonnet",
|
||||||
|
"openai": import "components/openai.jsonnet",
|
||||||
|
"vertexai": import "components/vertexai.jsonnet",
|
||||||
|
|
||||||
|
// LLMs for RAG
|
||||||
|
"azure-rag": import "components/azure-rag.jsonnet",
|
||||||
|
"azure-openai-rag": import "components/azure-openai-rag.jsonnet",
|
||||||
|
"bedrock-rag": import "components/bedrock-rag.jsonnet",
|
||||||
|
"claude-rag": import "components/claude-rag.jsonnet",
|
||||||
|
"cohere-rag": import "components/cohere-rag.jsonnet",
|
||||||
|
"googleaistudio-rag": import "components/googleaistudio-rag.jsonnet",
|
||||||
|
"ollama-rag": import "components/ollama-rag.jsonnet",
|
||||||
|
"openai-rag": import "components/openai-rag.jsonnet",
|
||||||
|
"vertexai-rag": import "components/vertexai-rag.jsonnet",
|
||||||
|
|
||||||
|
// Embeddings
|
||||||
|
"embeddings-ollama": import "components/embeddings-ollama.jsonnet",
|
||||||
|
"embeddings-hf": import "components/embeddings-hf.jsonnet",
|
||||||
|
|
||||||
|
// Processing pipelines
|
||||||
"graph-rag": import "components/graph-rag.jsonnet",
|
"graph-rag": import "components/graph-rag.jsonnet",
|
||||||
|
"document-rag": import "components/document-rag.jsonnet",
|
||||||
|
|
||||||
|
// Vector stores
|
||||||
|
"vector-store-milvus": import "components/milvus.jsonnet",
|
||||||
|
"vector-store-qdrant": import "components/qdrant.jsonnet",
|
||||||
|
"vector-store-pinecone": import "components/pinecone.jsonnet",
|
||||||
|
|
||||||
|
// Triples stores
|
||||||
"triple-store-cassandra": import "components/cassandra.jsonnet",
|
"triple-store-cassandra": import "components/cassandra.jsonnet",
|
||||||
"triple-store-neo4j": import "components/neo4j.jsonnet",
|
"triple-store-neo4j": import "components/neo4j.jsonnet",
|
||||||
"triple-store-falkordb": import "components/falkordb.jsonnet",
|
"triple-store-falkordb": import "components/falkordb.jsonnet",
|
||||||
"triple-store-memgraph": import "components/memgraph.jsonnet",
|
"triple-store-memgraph": import "components/memgraph.jsonnet",
|
||||||
|
|
||||||
|
// Observability support
|
||||||
|
"grafana": import "components/grafana.jsonnet",
|
||||||
|
|
||||||
|
// Pulsar manager is a UI for Pulsar. Uses a LOT of memory
|
||||||
|
"pulsar-manager": import "components/pulsar-manager.jsonnet",
|
||||||
|
|
||||||
"llamafile": import "components/llamafile.jsonnet",
|
"llamafile": import "components/llamafile.jsonnet",
|
||||||
"ollama": import "components/ollama.jsonnet",
|
|
||||||
"openai": import "components/openai.jsonnet",
|
|
||||||
"override-recursive-chunker": import "components/chunker-recursive.jsonnet",
|
"override-recursive-chunker": import "components/chunker-recursive.jsonnet",
|
||||||
|
|
||||||
|
// The prompt manager
|
||||||
"prompt-template": import "components/prompt-template.jsonnet",
|
"prompt-template": import "components/prompt-template.jsonnet",
|
||||||
"prompt-overrides": import "components/prompt-overrides.jsonnet",
|
"prompt-overrides": import "components/prompt-overrides.jsonnet",
|
||||||
|
|
||||||
"pulsar": import "components/pulsar.jsonnet",
|
// ReAct agent
|
||||||
"pulsar-manager": import "components/pulsar-manager.jsonnet",
|
|
||||||
"trustgraph-base": import "components/trustgraph.jsonnet",
|
|
||||||
"vector-store-milvus": import "components/milvus.jsonnet",
|
|
||||||
"vector-store-qdrant": import "components/qdrant.jsonnet",
|
|
||||||
"vector-store-pinecone": import "components/pinecone.jsonnet",
|
|
||||||
"vertexai": import "components/vertexai.jsonnet",
|
|
||||||
"workbench-ui": import "components/workbench-ui.jsonnet",
|
|
||||||
"null": {},
|
|
||||||
|
|
||||||
"agent-manager-react": import "components/agent-manager-react.jsonnet",
|
"agent-manager-react": import "components/agent-manager-react.jsonnet",
|
||||||
|
|
||||||
// FIXME: Dupes
|
// Optional UI
|
||||||
"cassandra": import "components/cassandra.jsonnet",
|
"workbench-ui": import "components/workbench-ui.jsonnet",
|
||||||
"neo4j": import "components/neo4j.jsonnet",
|
|
||||||
"memgraph": import "components/memgraph.jsonnet",
|
// Does nothing. But, can be a hack to overwrite parameters
|
||||||
"qdrant": import "components/qdrant.jsonnet",
|
"null": {},
|
||||||
"pinecone": import "components/pinecone.jsonnet",
|
|
||||||
"milvus": import "components/milvus.jsonnet",
|
|
||||||
"falkordb": import "components/falkordb.jsonnet",
|
|
||||||
"trustgraph": import "components/trustgraph.jsonnet",
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
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" +: {
|
||||||
|
|
||||||
|
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-model":: "GPT-3.5-Turbo",
|
||||||
"azure-openai-max-output-tokens":: 4192,
|
"azure-openai-max-output-tokens":: 4192,
|
||||||
"azure-openai-temperature":: 0.0,
|
"azure-openai-temperature":: 0.0,
|
||||||
|
|
@ -34,48 +39,18 @@ local prompts = import "prompts/mixtral.jsonnet";
|
||||||
.with_limits("0.5", "128M")
|
.with_limits("0.5", "128M")
|
||||||
.with_reservations("0.1", "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(
|
local containerSet = engine.containers(
|
||||||
"text-completion", [ container ]
|
"text-completion", [ container ]
|
||||||
);
|
);
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
local service =
|
||||||
engine.internalService(containerSet)
|
engine.internalService(containerSet)
|
||||||
.with_port(8000, 8000, "metrics");
|
.with_port(8000, 8000, "metrics");
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
engine.resources([
|
||||||
envSecrets,
|
envSecrets,
|
||||||
containerSet,
|
containerSet,
|
||||||
containerSetRag,
|
|
||||||
service,
|
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 images = import "values/images.jsonnet";
|
||||||
local url = import "values/url.jsonnet";
|
local url = import "values/url.jsonnet";
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
local prompts = import "prompts/mixtral.jsonnet";
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
with:: function(key, value)
|
||||||
|
self + {
|
||||||
|
["azure-" + key]:: value,
|
||||||
|
},
|
||||||
|
|
||||||
"azure-max-output-tokens":: 4096,
|
"azure-max-output-tokens":: 4096,
|
||||||
"azure-temperature":: 0.0,
|
"azure-temperature":: 0.0,
|
||||||
|
|
||||||
|
|
@ -32,48 +36,18 @@ local prompts = import "prompts/mixtral.jsonnet";
|
||||||
.with_limits("0.5", "128M")
|
.with_limits("0.5", "128M")
|
||||||
.with_reservations("0.1", "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(
|
local containerSet = engine.containers(
|
||||||
"text-completion", [ container ]
|
"text-completion", [ container ]
|
||||||
);
|
);
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
local service =
|
||||||
engine.internalService(containerSet)
|
engine.internalService(containerSet)
|
||||||
.with_port(8000, 8000, "metrics");
|
.with_port(8000, 8000, "metrics");
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
engine.resources([
|
||||||
envSecrets,
|
envSecrets,
|
||||||
containerSet,
|
containerSet,
|
||||||
containerSetRag,
|
|
||||||
service,
|
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-max-output-tokens":: 4096,
|
||||||
"bedrock-temperature":: 0.0,
|
"bedrock-temperature":: 0.0,
|
||||||
"bedrock-model":: "mistral.mixtral-8x7b-instruct-v0:1",
|
"bedrock-model":: "mistral.mixtral-8x7b-instruct-v0:1",
|
||||||
|
|
@ -37,50 +42,18 @@ local chunker = import "chunker-recursive.jsonnet";
|
||||||
.with_limits("0.5", "128M")
|
.with_limits("0.5", "128M")
|
||||||
.with_reservations("0.1", "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(
|
local containerSet = engine.containers(
|
||||||
"text-completion", [ container ]
|
"text-completion", [ container ]
|
||||||
);
|
);
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
local service =
|
||||||
engine.internalService(containerSet)
|
engine.internalService(containerSet)
|
||||||
.with_port(8000, 8000, "metrics");
|
.with_port(8000, 8000, "metrics");
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
engine.resources([
|
||||||
envSecrets,
|
envSecrets,
|
||||||
containerSet,
|
containerSet,
|
||||||
containerSetRag,
|
|
||||||
service,
|
service,
|
||||||
serviceRag,
|
|
||||||
])
|
])
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
||||||
60
templates/components/claude-rag.jsonnet
Normal file
60
templates/components/claude-rag.jsonnet
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
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-max-output-tokens":: 4096,
|
||||||
|
"claude-rag-temperature":: 0.0,
|
||||||
|
|
||||||
|
"text-completion" +: {
|
||||||
|
|
||||||
|
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"]),
|
||||||
|
"-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,11 @@ local prompts = import "prompts/mixtral.jsonnet";
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
with:: function(key, value)
|
||||||
|
self + {
|
||||||
|
["claude-" + key]:: value,
|
||||||
|
},
|
||||||
|
|
||||||
"claude-max-output-tokens":: 4096,
|
"claude-max-output-tokens":: 4096,
|
||||||
"claude-temperature":: 0.0,
|
"claude-temperature":: 0.0,
|
||||||
|
|
||||||
|
|
@ -31,48 +36,18 @@ local prompts = import "prompts/mixtral.jsonnet";
|
||||||
.with_limits("0.5", "128M")
|
.with_limits("0.5", "128M")
|
||||||
.with_reservations("0.1", "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(
|
local containerSet = engine.containers(
|
||||||
"text-completion", [ container ]
|
"text-completion", [ container ]
|
||||||
);
|
);
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
local service =
|
||||||
engine.internalService(containerSet)
|
engine.internalService(containerSet)
|
||||||
.with_port(8000, 8000, "metrics");
|
.with_port(8000, 8000, "metrics");
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
engine.resources([
|
||||||
envSecrets,
|
envSecrets,
|
||||||
containerSet,
|
containerSet,
|
||||||
containerSetRag,
|
|
||||||
service,
|
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" +: {
|
||||||
|
|
||||||
|
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
|
with:: function(key, value)
|
||||||
"chunk-size":: 150,
|
self + {
|
||||||
"chunk-overlap":: 10,
|
["cohere-" + key]:: value,
|
||||||
|
},
|
||||||
|
|
||||||
"cohere-temperature":: 0.0,
|
"cohere-temperature":: 0.0,
|
||||||
|
|
||||||
|
|
@ -31,45 +32,18 @@ local prompts = import "prompts/mixtral.jsonnet";
|
||||||
.with_limits("0.5", "128M")
|
.with_limits("0.5", "128M")
|
||||||
.with_reservations("0.1", "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(
|
local containerSet = engine.containers(
|
||||||
"text-completion", [ container ]
|
"text-completion", [ container ]
|
||||||
);
|
);
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
local service =
|
||||||
engine.internalService(containerSet)
|
engine.internalService(containerSet)
|
||||||
.with_port(8000, 8000, "metrics");
|
.with_port(8000, 8000, "metrics");
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
engine.resources([
|
||||||
envSecrets,
|
envSecrets,
|
||||||
containerSet,
|
containerSet,
|
||||||
containerSetRag,
|
|
||||||
service,
|
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" +: {
|
||||||
|
|
||||||
|
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_limits("0.5", "128M")
|
||||||
.with_reservations("0.1", "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(
|
local containerSet = engine.containers(
|
||||||
"text-completion", [ container ]
|
"text-completion", [ container ]
|
||||||
);
|
);
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
local service =
|
||||||
engine.internalService(containerSet)
|
engine.internalService(containerSet)
|
||||||
.with_port(8000, 8000, "metrics");
|
.with_port(8000, 8000, "metrics");
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
engine.resources([
|
||||||
envSecrets,
|
envSecrets,
|
||||||
containerSet,
|
containerSet,
|
||||||
containerSetRag,
|
|
||||||
service,
|
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",
|
"llamafile-model":: "LLaMA_CPP",
|
||||||
|
|
||||||
"text-completion" +: {
|
"text-completion" +: {
|
||||||
|
|
@ -28,46 +33,18 @@ local prompts = import "prompts/slm.jsonnet";
|
||||||
.with_limits("0.5", "128M")
|
.with_limits("0.5", "128M")
|
||||||
.with_reservations("0.1", "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(
|
local containerSet = engine.containers(
|
||||||
"text-completion", [ container ]
|
"text-completion", [ container ]
|
||||||
);
|
);
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
local service =
|
||||||
engine.internalService(containerSet)
|
engine.internalService(containerSet)
|
||||||
.with_port(8080, 8080, "metrics");
|
.with_port(8080, 8080, "metrics");
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
engine.resources([
|
||||||
envSecrets,
|
envSecrets,
|
||||||
containerSet,
|
containerSet,
|
||||||
containerSetRag,
|
|
||||||
service,
|
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",
|
"ollama-model":: "gemma2:9b",
|
||||||
|
|
||||||
"text-completion" +: {
|
"text-completion" +: {
|
||||||
|
|
@ -28,46 +33,18 @@ local prompts = import "prompts/mixtral.jsonnet";
|
||||||
.with_limits("0.5", "128M")
|
.with_limits("0.5", "128M")
|
||||||
.with_reservations("0.1", "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(
|
local containerSet = engine.containers(
|
||||||
"text-completion", [ container ]
|
"text-completion", [ container ]
|
||||||
);
|
);
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
local service =
|
||||||
engine.internalService(containerSet)
|
engine.internalService(containerSet)
|
||||||
.with_port(8080, 8080, "metrics");
|
.with_port(8080, 8080, "metrics");
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
engine.resources([
|
||||||
envSecrets,
|
envSecrets,
|
||||||
containerSet,
|
containerSet,
|
||||||
containerSetRag,
|
|
||||||
service,
|
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-max-output-tokens":: 4096,
|
||||||
"openai-temperature":: 0.0,
|
"openai-temperature":: 0.0,
|
||||||
"openai-model":: "GPT-3.5-Turbo",
|
"openai-model":: "GPT-3.5-Turbo",
|
||||||
|
|
@ -34,50 +39,18 @@ local prompts = import "prompts/mixtral.jsonnet";
|
||||||
.with_limits("0.5", "128M")
|
.with_limits("0.5", "128M")
|
||||||
.with_reservations("0.1", "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(
|
local containerSet = engine.containers(
|
||||||
"text-completion", [ container ]
|
"text-completion", [ container ]
|
||||||
);
|
);
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
local service =
|
||||||
engine.internalService(containerSet)
|
engine.internalService(containerSet)
|
||||||
.with_port(8080, 8080, "metrics");
|
.with_port(8080, 8080, "metrics");
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
engine.resources([
|
||||||
envSecrets,
|
envSecrets,
|
||||||
containerSet,
|
containerSet,
|
||||||
containerSetRag,
|
|
||||||
service,
|
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";
|
local default_prompts = import "prompts/default-prompts.jsonnet";
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
local base = import "base/base.jsonnet";
|
local base = import "base/base.jsonnet";
|
||||||
local images = import "values/images.jsonnet";
|
local images = import "values/images.jsonnet";
|
||||||
local url = import "values/url.jsonnet";
|
local url = import "values/url.jsonnet";
|
||||||
local prompt = import "prompt-template.jsonnet";
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -181,5 +180,5 @@ local prompt = import "prompt-template.jsonnet";
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
} + prompt
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue