2024-08-30 17:47:35 +01:00
|
|
|
local base = import "base/base.jsonnet";
|
|
|
|
|
local images = import "values/images.jsonnet";
|
|
|
|
|
local url = import "values/url.jsonnet";
|
2024-09-05 16:40:47 +01:00
|
|
|
local prompts = import "prompts/mixtral.jsonnet";
|
|
|
|
|
|
2024-08-14 20:56:57 +01:00
|
|
|
{
|
2024-08-30 17:47:35 +01:00
|
|
|
|
|
|
|
|
"vertexai-model":: "gemini-1.0-pro-001",
|
|
|
|
|
"vertexai-private-key":: "/vertexai/private.json",
|
|
|
|
|
"vertexai-region":: "us-central1",
|
|
|
|
|
"vertexai-max-output-tokens":: 4096,
|
|
|
|
|
"vertexai-temperature":: 0.0,
|
|
|
|
|
|
2024-09-05 16:40:47 +01:00
|
|
|
"text-completion" +: {
|
|
|
|
|
|
|
|
|
|
create:: function(engine)
|
|
|
|
|
|
2024-09-07 18:59:38 +01:00
|
|
|
local cfgVol = engine.secretVolume(
|
|
|
|
|
"vertexai-creds",
|
|
|
|
|
"./vertexai",
|
|
|
|
|
{
|
|
|
|
|
"private.json": importstr "vertexai/private.json",
|
|
|
|
|
}
|
|
|
|
|
);
|
2024-09-05 16:40:47 +01:00
|
|
|
|
|
|
|
|
local container =
|
|
|
|
|
engine.container("text-completion")
|
|
|
|
|
.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",
|
2024-11-05 23:04:21 +00:00
|
|
|
"%0.3f" % $["vertexai-temperature"],
|
2024-09-05 16:40:47 +01:00
|
|
|
"-m",
|
|
|
|
|
$["vertexai-model"],
|
|
|
|
|
])
|
2024-09-07 18:59:38 +01:00
|
|
|
.with_limits("0.5", "256M")
|
|
|
|
|
.with_reservations("0.1", "256M")
|
2024-09-05 16:40:47 +01:00
|
|
|
.with_volume_mount(cfgVol, "/vertexai");
|
|
|
|
|
|
|
|
|
|
local containerSet = engine.containers(
|
|
|
|
|
"text-completion", [ container ]
|
|
|
|
|
);
|
|
|
|
|
|
2024-09-07 18:59:38 +01:00
|
|
|
local service =
|
|
|
|
|
engine.internalService(containerSet)
|
|
|
|
|
.with_port(8000, 8000, "metrics");
|
|
|
|
|
|
2024-09-05 16:40:47 +01:00
|
|
|
engine.resources([
|
|
|
|
|
cfgVol,
|
|
|
|
|
containerSet,
|
2024-09-07 18:59:38 +01:00
|
|
|
service,
|
2024-09-05 16:40:47 +01:00
|
|
|
])
|
2024-08-14 20:56:57 +01:00
|
|
|
|
|
|
|
|
},
|
2024-09-05 16:40:47 +01:00
|
|
|
|
|
|
|
|
"text-completion-rag" +: {
|
|
|
|
|
|
|
|
|
|
create:: function(engine)
|
|
|
|
|
|
2024-09-07 18:59:38 +01:00
|
|
|
local cfgVol = engine.secretVolume(
|
|
|
|
|
"vertexai-creds",
|
|
|
|
|
"./vertexai",
|
|
|
|
|
{
|
|
|
|
|
"private.json": importstr "vertexai/private.json",
|
|
|
|
|
}
|
|
|
|
|
);
|
2024-09-05 16:40:47 +01:00
|
|
|
|
|
|
|
|
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",
|
2024-11-05 23:04:21 +00:00
|
|
|
"%0.3f" % $["vertexai-temperature"],
|
2024-09-05 16:40:47 +01:00
|
|
|
"-m",
|
|
|
|
|
$["vertexai-model"],
|
|
|
|
|
"-i",
|
|
|
|
|
"non-persistent://tg/request/text-completion-rag",
|
|
|
|
|
"-o",
|
|
|
|
|
"non-persistent://tg/response/text-completion-rag-response",
|
|
|
|
|
])
|
2024-09-07 18:59:38 +01:00
|
|
|
.with_limits("0.5", "256M")
|
|
|
|
|
.with_reservations("0.1", "256M")
|
2024-09-05 16:40:47 +01:00
|
|
|
.with_volume_mount(cfgVol, "/vertexai");
|
|
|
|
|
|
|
|
|
|
local containerSet = engine.containers(
|
|
|
|
|
"text-completion-rag", [ container ]
|
|
|
|
|
);
|
|
|
|
|
|
2024-09-07 18:59:38 +01:00
|
|
|
local service =
|
|
|
|
|
engine.internalService(containerSet)
|
|
|
|
|
.with_port(8000, 8000, "metrics");
|
|
|
|
|
|
2024-09-05 16:40:47 +01:00
|
|
|
engine.resources([
|
|
|
|
|
cfgVol,
|
|
|
|
|
containerSet,
|
2024-09-07 18:59:38 +01:00
|
|
|
service,
|
2024-09-05 16:40:47 +01:00
|
|
|
])
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-23 23:34:16 +01:00
|
|
|
} + prompts
|
|
|
|
|
|