trustgraph/trustgraph_configurator/templates/1.6/components/llamafile.jsonnet
elpresidank 74cc8a4685 Squashed 'ai-context/trustgraph-templates/' content from commit 42a5fd1b
git-subtree-dir: ai-context/trustgraph-templates
git-subtree-split: 42a5fd1b678f32be378062e30451e2052ccb95dd
2026-04-05 21:09:49 -05:00

95 lines
2.8 KiB
Jsonnet

local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local prompts = import "prompts/slm.jsonnet";
local models = import "parameters/llamafile.jsonnet";
{
with:: function(key, value)
self + {
["llamafile-" + key]:: value,
},
"llamafile-models":: models,
"llm-models" +:: $["llamafile-models"],
"text-completion" +: {
create:: function(engine)
local envSecrets = engine.envSecrets("llamafile-credentials")
.with_env_var("LLAMAFILE_URL", "llamafile-url");
local container =
engine.container("text-completion")
.with_image(images.trustgraph_flow)
.with_command([
"text-completion-llamafile",
"-p",
url.pulsar,
"--log-level",
$["log-level"],
])
.with_env_var_secrets(envSecrets)
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"text-completion", [ container ]
);
local service =
engine.internalService(containerSet)
.with_port(8000, 8000, "metrics");
engine.resources([
envSecrets,
containerSet,
service,
])
},
"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_flow)
.with_command([
"text-completion-llamafile",
"-p",
url.pulsar,
"--id",
"text-completion-rag",
"--log-level",
$["log-level"],
])
.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