Port the template to 0.13, env secrets for k8s

This commit is contained in:
Cyber MacGeddon 2024-10-15 20:41:14 +01:00
parent e8abffa2d0
commit 57aa0d97c0

View file

@ -5,7 +5,6 @@ local prompts = import "prompts/mixtral.jsonnet";
{ {
"googleaistudio-key":: "${GOOGLEAISTUDIO_KEY}",
"googleaistudio-max-output-tokens":: 4096, "googleaistudio-max-output-tokens":: 4096,
"googleaistudio-temperature":: 0.0, "googleaistudio-temperature":: 0.0,
@ -13,6 +12,9 @@ local prompts = import "prompts/mixtral.jsonnet";
create:: function(engine) create:: function(engine)
local envSecrets = engine.envSecrets("bedrock-credentials")
.with_env_var("GOOGLEAISTUDIO_KEY", "googleaistudio-key");
local container = local container =
engine.container("text-completion") engine.container("text-completion")
.with_image(images.trustgraph) .with_image(images.trustgraph)
@ -20,44 +22,22 @@ local prompts = import "prompts/mixtral.jsonnet";
"text-completion-googleaistudio", "text-completion-googleaistudio",
"-p", "-p",
url.pulsar, url.pulsar,
"-k",
$["googleaistudio-key"],
"-x", "-x",
std.toString($["googleaistudio-max-output-tokens"]), std.toString($["googleaistudio-max-output-tokens"]),
"-t", "-t",
std.toString($["googleaistudio-temperature"]), std.toString($["googleaistudio-temperature"]),
]) ])
.with_env_var_secrets(envSecrets)
.with_limits("0.5", "128M") .with_limits("0.5", "128M")
.with_reservations("0.1", "128M"); .with_reservations("0.1", "128M");
local containerSet = engine.containers( local containerRag =
"text-completion", [ container ]
);
local service =
engine.internalService(containerSet)
.with_port(8000, 8000, "metrics");
engine.resources([
containerSet,
service,
])
},
"text-completion-rag" +: {
create:: function(engine)
local container =
engine.container("text-completion-rag") engine.container("text-completion-rag")
.with_image(images.trustgraph) .with_image(images.trustgraph)
.with_command([ .with_command([
"text-completion-googleaistudio", "text-completion-googleaistudio",
"-p", "-p",
url.pulsar, url.pulsar,
"-k",
$["googleaistudio-key"],
"-x", "-x",
std.toString($["googleaistudio-max-output-tokens"]), std.toString($["googleaistudio-max-output-tokens"]),
"-t", "-t",
@ -67,24 +47,35 @@ local prompts = import "prompts/mixtral.jsonnet";
"-o", "-o",
"non-persistent://tg/response/text-completion-rag-response", "non-persistent://tg/response/text-completion-rag-response",
]) ])
.with_env_var_secrets(envSecrets)
.with_limits("0.5", "128M") .with_limits("0.5", "128M")
.with_reservations("0.1", "128M"); .with_reservations("0.1", "128M");
local containerSet = engine.containers( local containerSet = engine.containers(
"text-completion-rag", [ 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,
containerSet, containerSet,
containerSetRag,
service, service,
serviceRag,
]) ])
},
}
} + prompts } + prompts