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
|
|
|
|
2025-01-11 11:40:42 +00:00
|
|
|
with:: function(key, value)
|
|
|
|
|
self + {
|
|
|
|
|
["openai-" + key]:: value,
|
|
|
|
|
},
|
|
|
|
|
|
2024-08-30 17:47:35 +01:00
|
|
|
"openai-max-output-tokens":: 4096,
|
|
|
|
|
"openai-temperature":: 0.0,
|
2024-08-30 21:33:03 +01:00
|
|
|
"openai-model":: "GPT-3.5-Turbo",
|
2024-08-30 17:47:35 +01:00
|
|
|
|
2024-09-05 16:40:47 +01:00
|
|
|
"text-completion" +: {
|
|
|
|
|
|
|
|
|
|
create:: function(engine)
|
|
|
|
|
|
2024-10-15 00:34:52 +01:00
|
|
|
local envSecrets = engine.envSecrets("openai-credentials")
|
|
|
|
|
.with_env_var("OPENAI_TOKEN", "openai-token");
|
|
|
|
|
|
2024-09-05 16:40:47 +01:00
|
|
|
local container =
|
|
|
|
|
engine.container("text-completion")
|
2025-01-28 19:36:05 +00:00
|
|
|
.with_image(images.trustgraph_flow)
|
2024-09-05 16:40:47 +01:00
|
|
|
.with_command([
|
|
|
|
|
"text-completion-openai",
|
|
|
|
|
"-p",
|
|
|
|
|
url.pulsar,
|
|
|
|
|
"-x",
|
|
|
|
|
std.toString($["openai-max-output-tokens"]),
|
|
|
|
|
"-t",
|
2024-11-05 23:04:21 +00:00
|
|
|
"%0.3f" % $["openai-temperature"],
|
2024-09-05 16:40:47 +01:00
|
|
|
"-m",
|
|
|
|
|
$["openai-model"],
|
|
|
|
|
])
|
2024-10-15 00:34:52 +01:00
|
|
|
.with_env_var_secrets(envSecrets)
|
2024-09-05 16:40:47 +01:00
|
|
|
.with_limits("0.5", "128M")
|
|
|
|
|
.with_reservations("0.1", "128M");
|
|
|
|
|
|
|
|
|
|
local containerSet = engine.containers(
|
2024-10-15 00:34:52 +01:00
|
|
|
"text-completion", [ container ]
|
|
|
|
|
);
|
|
|
|
|
|
2024-09-07 18:59:38 +01:00
|
|
|
local service =
|
|
|
|
|
engine.internalService(containerSet)
|
|
|
|
|
.with_port(8080, 8080, "metrics");
|
|
|
|
|
|
2024-09-05 16:40:47 +01:00
|
|
|
engine.resources([
|
2024-10-15 00:34:52 +01:00
|
|
|
envSecrets,
|
2024-09-05 16:40:47 +01:00
|
|
|
containerSet,
|
2024-09-07 18:59:38 +01:00
|
|
|
service,
|
2024-09-05 16:40:47 +01:00
|
|
|
])
|
|
|
|
|
|
2024-10-15 00:34:52 +01:00
|
|
|
},
|
2024-09-05 16:40:47 +01:00
|
|
|
|
2024-08-23 23:34:16 +01:00
|
|
|
} + prompts
|
2024-09-05 16:40:47 +01:00
|
|
|
|