Update Azure with new macros for env vars in secrets

This commit is contained in:
Cyber MacGeddon 2024-10-14 17:28:54 +01:00
parent 1588d6a4f2
commit 0369072bdd

View file

@ -5,8 +5,6 @@ local prompts = import "prompts/mixtral.jsonnet";
{ {
"azure-token":: "${AZURE_TOKEN}",
"azure-endpoint":: "${AZURE_ENDPOINT}",
"azure-max-output-tokens":: 4096, "azure-max-output-tokens":: 4096,
"azure-temperature":: 0.0, "azure-temperature":: 0.0,
@ -14,6 +12,10 @@ local prompts = import "prompts/mixtral.jsonnet";
create:: function(engine) create:: function(engine)
local envSecrets = engine.envSecrets("azure-credentials")
.with_env_var("AZURE_TOKEN")
.with_env_var("AZURE_ENDPOINT");
local container = local container =
engine.container("text-completion") engine.container("text-completion")
.with_image(images.trustgraph) .with_image(images.trustgraph)
@ -21,15 +23,12 @@ local prompts = import "prompts/mixtral.jsonnet";
"text-completion-azure", "text-completion-azure",
"-p", "-p",
url.pulsar, url.pulsar,
"-k",
$["azure-token"],
"-e",
$["azure-endpoint"],
"-x", "-x",
std.toString($["azure-max-output-tokens"]), std.toString($["azure-max-output-tokens"]),
"-t", "-t",
std.toString($["azure-temperature"]), std.toString($["azure-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");
@ -42,6 +41,7 @@ local prompts = import "prompts/mixtral.jsonnet";
.with_port(8000, 8000, "metrics"); .with_port(8000, 8000, "metrics");
engine.resources([ engine.resources([
envSecrets,
containerSet, containerSet,
service, service,
]) ])
@ -52,6 +52,10 @@ local prompts = import "prompts/mixtral.jsonnet";
create:: function(engine) create:: function(engine)
local envSecrets = engine.envSecrets("azure-credentials-rag")
.with_env_var("AZURE_TOKEN")
.with_env_var("AZURE_ENDPOINT");
local container = local container =
engine.container("text-completion-rag") engine.container("text-completion-rag")
.with_image(images.trustgraph) .with_image(images.trustgraph)
@ -59,10 +63,6 @@ local prompts = import "prompts/mixtral.jsonnet";
"text-completion-azure", "text-completion-azure",
"-p", "-p",
url.pulsar, url.pulsar,
"-k",
$["azure-token"],
"-e",
$["azure-endpoint"],
"-x", "-x",
std.toString($["azure-max-output-tokens"]), std.toString($["azure-max-output-tokens"]),
"-t", "-t",
@ -72,6 +72,7 @@ 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");
@ -84,6 +85,7 @@ local prompts = import "prompts/mixtral.jsonnet";
.with_port(8000, 8000, "metrics"); .with_port(8000, 8000, "metrics");
engine.resources([ engine.resources([
envSecrets,
containerSet, containerSet,
service, service,
]) ])