Refactor templates (#52)

* Switching from docker compose to abstract form - should be easier to k8s later
* Text loader util
* Recreate templates
This commit is contained in:
cybermaggedon 2024-09-05 16:40:47 +01:00 committed by GitHub
parent af5508ff68
commit 65d7f6d261
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 1659 additions and 1277 deletions

View file

@ -2,6 +2,7 @@ local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local prompts = import "prompts/mixtral.jsonnet";
{
"azure-token":: "${AZURE_TOKEN}",
@ -9,70 +10,76 @@ local prompts = import "prompts/mixtral.jsonnet";
"azure-max-output-tokens":: 4096,
"azure-temperature":: 0.0,
services +: {
"text-completion" +: {
create:: function(engine)
"text-completion": base + {
image: images.trustgraph,
command: [
"text-completion-azure",
"-p",
url.pulsar,
"-k",
$["azure-token"],
"-e",
$["azure-endpoint"],
"-x",
std.toString($["azure-max-output-tokens"]),
"-t",
std.toString($["azure-temperature"]),
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local container =
engine.container("text-completion")
.with_image(images.trustgraph)
.with_command([
"text-completion-azure",
"-p",
url.pulsar,
"-k",
$["azure-token"],
"-e",
$["azure-endpoint"],
"-x",
std.toString($["azure-max-output-tokens"]),
"-t",
std.toString($["azure-temperature"]),
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"text-completion", [ container ]
);
engine.resources([
containerSet,
])
"text-completion-rag": base + {
image: images.trustgraph,
command: [
"text-completion-azure",
"-p",
url.pulsar,
"-k",
$["azure-token"],
"-e",
$["azure-endpoint"],
"-i",
"-x",
std.toString($["azure-max-output-tokens"]),
"-t",
std.toString($["azure-temperature"]),
"non-persistent://tg/request/text-completion-rag",
"-o",
"non-persistent://tg/response/text-completion-rag-response",
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
},
"text-completion-rag" +: {
create:: function(engine)
local container =
engine.container("text-completion-rag")
.with_image(images.trustgraph)
.with_command([
"text-completion-azure",
"-p",
url.pulsar,
"-k",
$["azure-token"],
"-e",
$["azure-endpoint"],
"-x",
std.toString($["azure-max-output-tokens"]),
"-t",
std.toString($["azure-temperature"]),
"-i",
"non-persistent://tg/request/text-completion-rag",
"-o",
"non-persistent://tg/response/text-completion-rag-response",
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"text-completion-rag", [ container ]
);
engine.resources([
containerSet,
])
}
} + prompts

View file

@ -3,7 +3,9 @@ local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local prompts = import "prompts/mixtral.jsonnet";
local chunker = import "chunker-recursive.jsonnet";
{
"aws-id-key":: "${AWS_ID_KEY}",
"aws-secret-key":: "${AWS_SECRET_KEY}",
"aws-region":: "us-west-2",
@ -11,78 +13,84 @@ local chunker = import "chunker-recursive.jsonnet";
"bedrock-temperature":: 0.0,
"bedrock-model":: "mistral.mixtral-8x7b-instruct-v0:1",
services +: {
"text-completion" +: {
create:: function(engine)
"text-completion": base + {
image: images.trustgraph,
command: [
"text-completion-bedrock",
"-p",
url.pulsar,
"-z",
$["aws-id-key"],
"-k",
$["aws-secret-key"],
"-r",
$["aws-region"],
"-x",
std.toString($["bedrock-max-output-tokens"]),
"-t",
std.toString($["bedrock-temperature"]),
"-m",
$["bedrock-model"],
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local container =
engine.container("text-completion")
.with_image(images.trustgraph)
.with_command([
"text-completion-bedrock",
"-p",
url.pulsar,
"-z",
$["aws-id-key"],
"-k",
$["aws-secret-key"],
"-r",
$["aws-region"],
"-x",
std.toString($["bedrock-max-output-tokens"]),
"-t",
std.toString($["bedrock-temperature"]),
"-m",
$["bedrock-model"],
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"text-completion", [ container ]
);
engine.resources([
containerSet,
])
"text-completion-rag": base + {
image: images.trustgraph,
command: [
"text-completion-bedrock",
"-p",
url.pulsar,
"-z",
$["aws-id-key"],
"-k",
$["aws-secret-key"],
"-r",
$["aws-region"],
"-x",
std.toString($["bedrock-max-output-tokens"]),
"-t",
std.toString($["bedrock-temperature"]),
"-m",
$["bedrock-model"],
"-i",
"non-persistent://tg/request/text-completion-rag",
"-o",
"non-persistent://tg/response/text-completion-rag-response",
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
},
"text-completion-rag" +: {
create:: function(engine)
local container =
engine.container("text-completion-rag")
.with_image(images.trustgraph)
.with_command([
"text-completion-bedrock",
"-p",
url.pulsar,
"-z",
$["aws-id-key"],
"-k",
$["aws-secret-key"],
"-r",
$["aws-region"],
"-x",
std.toString($["bedrock-max-output-tokens"]),
"-t",
std.toString($["bedrock-temperature"]),
"-m",
$["bedrock-model"],
"-i",
"non-persistent://tg/request/text-completion-rag",
"-o",
"non-persistent://tg/response/text-completion-rag-response",
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"text-completion-rag", [ container ]
);
engine.resources([
containerSet,
])
}
} + prompts + chunker

View file

@ -6,53 +6,59 @@ local cassandra = import "stores/cassandra.jsonnet";
cassandra + {
services +: {
"store-triples" +: {
create:: function(engine)
"store-triples": base + {
image: images.trustgraph,
command: [
"triples-write-cassandra",
"-p",
url.pulsar,
"-g",
cassandra_hosts,
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local container =
engine.container("store-triples")
.with_image(images.trustgraph)
.with_command([
"triples-write-cassandra",
"-p",
url.pulsar,
"-g",
cassandra_hosts,
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
"query-triples": base + {
image: images.trustgraph,
command: [
"triples-query-cassandra",
"-p",
url.pulsar,
"-g",
cassandra_hosts,
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '512M'
},
reservations: {
cpus: '0.1',
memory: '512M'
}
}
},
},
local containerSet = engine.containers(
"stop-triples", [ container ]
);
engine.resources([
containerSet,
])
},
"query-triples" +: {
create:: function(engine)
local container =
engine.container("query-triples")
.with_image(images.trustgraph)
.with_command([
"triples-query-cassandra",
"-p",
url.pulsar,
"-g",
cassandra_hosts,
])
.with_limits("0.5", "512M")
.with_reservations("0.1", "512M");
local containerSet = engine.containers(
"query-triples", [ container ]
);
engine.resources([
containerSet,
])
}
}

View file

@ -2,38 +2,40 @@ local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local prompts = import "prompts/mixtral.jsonnet";
{
"chunk-size":: 2000,
"chunk-overlap":: 100,
services +: {
"chunker" +: {
create:: function(engine)
local container =
engine.container("chunker")
.with_image(images.trustgraph)
.with_command([
"chunker-recursive",
"-p",
url.pulsar,
"--chunk-size",
std.toString($["chunk-size"]),
"--chunk-overlap",
std.toString($["chunk-overlap"]),
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"chunker", [ container ]
);
engine.resources([
containerSet,
])
chunker: base + {
image: images.trustgraph,
command: [
"chunker-recursive",
"-p",
url.pulsar,
"--chunk-size",
std.toString($["chunk-size"]),
"--chunk-overlap",
std.toString($["chunk-overlap"]),
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
},
} + prompts
}

View file

@ -2,71 +2,79 @@ local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local prompts = import "prompts/mixtral.jsonnet";
{
"claude-key":: "${CLAUDE_KEY}",
"claude-max-output-tokens":: 4096,
"claude-temperature":: 0.0,
services +: {
"text-completion" +: {
create:: function(engine)
"text-completion": base + {
image: images.trustgraph,
command: [
"text-completion-claude",
"-p",
url.pulsar,
"-k",
$["claude-key"],
"-x",
std.toString($["claude-max-output-tokens"]),
"-t",
std.toString($["claude-temperature"]),
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local container =
engine.container("text-completion")
.with_image(images.trustgraph)
.with_command([
"text-completion-claude",
"-p",
url.pulsar,
"-k",
$["claude-key"],
"-x",
std.toString($["claude-max-output-tokens"]),
"-t",
std.toString($["claude-temperature"]),
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"text-completion", [ container ]
);
engine.resources([
containerSet,
])
"text-completion-rag": base + {
image: images.trustgraph,
command: [
"text-completion-claude",
"-p",
url.pulsar,
"-k",
$["claude-key"],
"-x",
std.toString($["claude-max-output-tokens"]),
"-t",
std.toString($["claude-temperature"]),
"-i",
"non-persistent://tg/request/text-completion-rag",
"-o",
"non-persistent://tg/response/text-completion-rag-response",
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
},
"text-completion-rag" +: {
create:: function(engine)
local container =
engine.container("text-completion-rag")
.with_image(images.trustgraph)
.with_command([
"text-completion-claude",
"-p",
url.pulsar,
"-k",
$["claude-key"],
"-x",
std.toString($["claude-max-output-tokens"]),
"-t",
std.toString($["claude-temperature"]),
"-i",
"non-persistent://tg/request/text-completion-rag",
"-o",
"non-persistent://tg/response/text-completion-rag-response",
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"text-completion-rag", [ container ]
);
engine.resources([
containerSet,
])
}
} + prompts

View file

@ -1,7 +1,8 @@
local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local prompts = import "prompts/cohere.jsonnet";
local prompts = import "prompts/mixtral.jsonnet";
{
// Override chunking
@ -11,61 +12,68 @@ local prompts = import "prompts/cohere.jsonnet";
"cohere-key":: "${COHERE_KEY}",
"cohere-temperature":: 0.0,
services +: {
"text-completion" +: {
create:: function(engine)
"text-completion": base + {
image: images.trustgraph,
command: [
"text-completion-cohere",
"-p",
url.pulsar,
"-k",
$["cohere-key"],
"-t",
$["cohere-temperature"],
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local container =
engine.container("text-completion")
.with_image(images.trustgraph)
.with_command([
"text-completion-cohere",
"-p",
url.pulsar,
"-k",
$["cohere-key"],
"-t",
$["cohere-temperature"],
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
"text-completion-rag": base + {
image: images.trustgraph,
command: [
"text-completion-cohere",
"-p",
url.pulsar,
"-k",
$["cohere-key"],
"-t",
$["cohere-temperature"],
"-i",
"non-persistent://tg/request/text-completion-rag",
"-o",
"non-persistent://tg/response/text-completion-rag-response",
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local containerSet = engine.containers(
"text-completion", [ container ]
);
engine.resources([
containerSet,
])
},
"text-completion-rag" +: {
create:: function(engine)
local container =
engine.container("text-completion-rag")
.with_image(images.trustgraph)
.with_command([
"text-completion-cohere",
"-p",
url.pulsar,
"-k",
$["cohere-key"],
"-t",
$["cohere-temperature"],
"-i",
"non-persistent://tg/request/text-completion-rag",
"-o",
"non-persistent://tg/response/text-completion-rag-response",
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"text-completion-rag", [ container ]
);
engine.resources([
containerSet,
])
}
} + prompts

View file

@ -1,38 +1,38 @@
local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local prompts = import "prompt-template.jsonnet";
local prompts = import "prompts/mixtral.jsonnet";
{
services +: {
"document-rag" +: {
create:: function(engine)
"document-rag": base + {
image: images.trustgraph,
command: [
"document-rag",
"-p",
url.pulsar,
"--prompt-request-queue",
"non-persistent://tg/request/prompt-rag",
"--prompt-response-queue",
"non-persistent://tg/response/prompt-rag-response",
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local container =
engine.container("document-rag"")
.with_image(images.trustgraph)
.with_command([
"document-rag",
"-p",
url.pulsar,
"--prompt-request-queue",
"non-persistent://tg/request/prompt-rag",
"--prompt-response-queue",
"non-persistent://tg/response/prompt-rag-response",
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
}
local containerSet = engine.containers(
"document-rag"", [ container ]
);
} + prompts
engine.resources([
containerSet,
])
},
}

View file

@ -1,40 +1,38 @@
local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local prompts = import "prompt-template.jsonnet";
local prompts = import "prompts/mixtral.jsonnet";
{
"embeddings-model":: "all-MiniLM-L6-v2",
services +: {
embeddings +: {
create:: function(engine)
embeddings: base + {
image: images.trustgraph,
command: [
"embeddings-hf",
"-p",
url.pulsar,
"-m",
$["embeddings-model"],
],
deploy: {
resources: {
limits: {
cpus: '1.0',
memory: '256M'
},
reservations: {
cpus: '0.5',
memory: '256M'
}
}
},
},
local container =
engine.container("embeddings")
.with_image(images.trustgraph)
.with_command([
"embeddings-hf",
"-p",
url.pulsar,
"-m",
$["embeddings-model"],
])
.with_limits("1.0", "256M")
.with_reservations("0.5", "256M");
}
local containerSet = engine.containers(
"embeddings", [ container ]
);
} + prompts
engine.resources([
containerSet,
])
},
}

View file

@ -1,65 +1,80 @@
local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
{
volumes +: {
"prometheus-data": {},
"grafana-storage": {},
"prometheus" +: {
create:: function(engine)
local vol = engine.volume("prometheus-data").with_size("20G");
local cfgVol = engine.configVolume("./prometheus")
.with_size("20G");
local container =
engine.container("prometheus")
.with_image(images.prometheus)
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M")
.with_port(9090, 9090, "http")
.with_volume_mount(cfgVol, "/etc/prometheus")
.with_volume_mount(vol, "/prometheus");
local containerSet = engine.containers(
"prometheus", [ container ]
);
engine.resources([
cfgVol,
vol,
containerSet,
])
},
services +: {
prometheus: base + {
image: images.prometheus,
ports: [
"9090:9090",
],
volumes: [
"./prometheus:/etc/prometheus",
"prometheus-data:/prometheus",
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
grafana: base + {
image: images.grafana,
ports: [
"3000:3000",
],
volumes: [
"grafana-storage:/var/lib/grafana",
"./grafana/dashboard.yml:/etc/grafana/provisioning/dashboards/dashboard.yml",
"./grafana/datasource.yml:/etc/grafana/provisioning/datasources/datasource.yml",
"./grafana/dashboard.json:/var/lib/grafana/dashboards/dashboard.json",
],
environment: {
// GF_AUTH_ANONYMOUS_ORG_ROLE: "Admin",
// GF_AUTH_ANONYMOUS_ENABLED: "true",
// GF_ORG_ROLE: "Admin",
GF_ORG_NAME: "trustgraph.ai",
// GF_SERVER_ROOT_URL: "https://example.com",
},
deploy: {
resources: {
limits: {
cpus: '1.0',
memory: '256M'
},
reservations: {
cpus: '0.5',
memory: '256M'
}
}
},
},
"grafana" +: {
create:: function(engine)
local vol = engine.volume("grafana-storage").with_size("20G");
local cv1 = engine.configVolume("./grafana/dashboard.yml")
.with_size("20G");
local cv2 = engine.configVolume("./grafana/datasource.yml")
.with_size("20G");
local cv3 = engine.configVolume("./grafana/dashboard.json")
.with_size("20G");
local container =
engine.container("grafana")
.with_image(images.grafana)
.with_environment({
// GF_AUTH_ANONYMOUS_ORG_ROLE: "Admin",
// GF_AUTH_ANONYMOUS_ENABLED: "true",
// GF_ORG_ROLE: "Admin",
GF_ORG_NAME: "trustgraph.ai",
// GF_SERVER_ROOT_URL: "https://example.com",
})
.with_limits("1.0", "256M")
.with_reservations("0.5", "256M")
.with_port(3000, 3000, "cassandra")
.with_volume_mount(vol, "/var/lib/grafana")
.with_volume_mount(cv1, "/etc/grafana/provisioning/dashboards/dashboard.yml")
.with_volume_mount(cv2, "/etc/grafana/provisioning/datasources/datasource.yml")
.with_volume_mount(cv3, "/var/lib/grafana/dashboards/dashboard.json");
local containerSet = engine.containers(
"grafana", [ container ]
);
engine.resources([
vol,
cv1,
cv2,
cv3,
containerSet,
])
},
}

View file

@ -1,7 +1,6 @@
local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local prompts = import "prompt-template.jsonnet";
{
@ -9,84 +8,90 @@ local prompts = import "prompt-template.jsonnet";
"graph-rag-triple-limit":: 30,
"graph-rag-max-subgraph-size":: 3000,
services +: {
"kg-extract-definitions" +: {
create:: function(engine)
"kg-extract-definitions": base + {
image: images.trustgraph,
command: [
"kg-extract-definitions",
"-p",
url.pulsar,
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local container =
engine.container("kg-extract-definitions")
.with_image(images.trustgraph)
.with_command([
"kg-extract-definitions",
"-p",
url.pulsar,
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
"kg-extract-relationships": base + {
image: images.trustgraph,
command: [
"kg-extract-relationships",
"-p",
url.pulsar,
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local containerSet = engine.containers(
"kg-extract-definitions", [ container ]
);
"graph-rag": base + {
image: images.trustgraph,
command: [
"graph-rag",
"-p",
url.pulsar,
"--prompt-request-queue",
"non-persistent://tg/request/prompt-rag",
"--prompt-response-queue",
"non-persistent://tg/response/prompt-rag-response",
"--entity-limit",
std.toString($["graph-rag-entity-limit"]),
"--triple-limit",
std.toString($["graph-rag-triple-limit"]),
"--max-subgraph-size",
std.toString($["graph-rag-max-subgraph-size"]),
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
engine.resources([
containerSet,
])
}
},
} + prompts
"kg-extract-relationships" +: {
create:: function(engine)
local container =
engine.container("kg-extract-relationships")
.with_image(images.trustgraph)
.with_command([
"kg-extract-relationships",
"-p",
url.pulsar,
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"kg-extract-relationships", [ container ]
);
engine.resources([
containerSet,
])
},
"graph-rag" +: {
create:: function(engine)
local container =
engine.container("graph-rag")
.with_image(images.trustgraph)
.with_command([
"graph-rag",
"-p",
url.pulsar,
"--prompt-request-queue",
"non-persistent://tg/request/prompt-rag",
"--prompt-response-queue",
"non-persistent://tg/response/prompt-rag-response",
"--entity-limit",
std.toString($["graph-rag-entity-limit"]),
"--triple-limit",
std.toString($["graph-rag-triple-limit"]),
"--max-subgraph-size",
std.toString($["graph-rag-max-subgraph-size"]),
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"graph-rag", [ container ]
);
engine.resources([
containerSet,
])
},
}

View file

@ -5,54 +5,62 @@ local neo4j = import "stores/neo4j.jsonnet";
neo4j + {
services +: {
"neo4j-url":: "bolt://neo4j:7687",
"query-triples": base + {
image: images.trustgraph,
command: [
"triples-query-neo4j",
"-p",
url.pulsar,
"-g",
"bolt://neo4j:7687",
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
"store-triples" +: {
create:: function(engine)
"store-triples": base + {
image: images.trustgraph,
command: [
"triples-write-neo4j",
"-p",
url.pulsar,
"-g",
"bolt://neo4j:7687",
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
}
local container =
engine.container("store-triples")
.with_image(images.trustgraph)
.with_command([
"triples-write-neo4j",
"-p",
url.pulsar,
"-g",
$["neo4j-url"],
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"store-triples", [ container ]
);
engine.resources([
containerSet,
])
},
"query-triples" +: {
create:: function(engine)
local container =
engine.container("query-triples")
.with_image(images.trustgraph)
.with_command([
"triples-query-neo4j",
"-p",
url.pulsar,
"-g",
$["neo4j-url"],
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"query-triples", [ container ]
);
engine.resources([
containerSet,
])
}
}

View file

@ -2,66 +2,74 @@ local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local prompts = import "prompts/slm.jsonnet";
{
"ollama-model":: "gemma2:9b",
"ollama-url":: "${OLLAMA_HOST}",
services +: {
"text-completion" +: {
create:: function(engine)
"text-completion": base + {
image: images.trustgraph,
command: [
"text-completion-ollama",
"-p",
url.pulsar,
"-m",
$["ollama-model"],
"-r",
$["ollama-url"],
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local container =
engine.container("text-completion")
.with_image(images.trustgraph)
.with_command([
"text-completion-ollama",
"-p",
url.pulsar,
"-m",
$["ollama-model"],
"-r",
$["ollama-url"],
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"text-completion", [ container ]
);
engine.resources([
containerSet,
])
"text-completion-rag": base + {
image: images.trustgraph,
command: [
"text-completion-ollama",
"-p",
url.pulsar,
"-m",
$["ollama-model"],
"-r",
$["ollama-url"],
"-i",
"non-persistent://tg/request/text-completion-rag",
"-o",
"non-persistent://tg/response/text-completion-rag-response",
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
},
"text-completion-rag" +: {
create:: function(engine)
local container =
engine.container("text-completion-rag")
.with_image(images.trustgraph)
.with_command([
"text-completion-ollama",
"-p",
url.pulsar,
"-m",
$["ollama-model"],
"-r",
$["ollama-url"],
"-i",
"non-persistent://tg/request/text-completion-rag",
"-o",
"non-persistent://tg/response/text-completion-rag-response",
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"text-completion-rag", [ container ]
);
engine.resources([
containerSet,
])
}
} + prompts

View file

@ -1,7 +1,8 @@
local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local prompts = import "prompts/openai.jsonnet";
local prompts = import "prompts/mixtral.jsonnet";
{
"openai-key":: "${OPENAI_KEY}",
@ -9,69 +10,76 @@ local prompts = import "prompts/openai.jsonnet";
"openai-temperature":: 0.0,
"openai-model":: "GPT-3.5-Turbo",
services +: {
"text-completion" +: {
create:: function(engine)
"text-completion": base + {
image: images.trustgraph,
command: [
"text-completion-openai",
"-p",
url.pulsar,
"-k",
$["openai-key"],
"-x",
std.toString($["openai-max-output-tokens"]),
"-t",
std.toString($["openai-temperature"]),
"-m",
$["openai-model"],
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local container =
engine.container("text-completion")
.with_image(images.trustgraph)
.with_command([
"text-completion-openai",
"-p",
url.pulsar,
"-k",
$["openai-key"],
"-x",
std.toString($["openai-max-output-tokens"]),
"-t",
std.toString($["openai-temperature"]),
"-m",
$["openai-model"],
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"text-completion", [ container ]
);
engine.resources([
containerSet,
])
"text-completion-rag": base + {
image: images.trustgraph,
command: [
"text-completion-openai",
"-p",
url.pulsar,
"-k",
$["openai-key"],
"-x",
std.toString($["openai-max-output-tokens"]),
"-t",
std.toString($["openai-temperature"]),
"-m",
$["openai-model"],
"-i",
"non-persistent://tg/request/text-completion-rag",
"-o",
"non-persistent://tg/response/text-completion-rag-response",
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
},
"text-completion-rag" +: {
create:: function(engine)
local container =
engine.container("text-completion-rag")
.with_image(images.trustgraph)
.with_command([
"text-completion-openai",
"-p",
url.pulsar,
"-k",
$["openai-key"],
"-x",
std.toString($["openai-max-output-tokens"]),
"-t",
std.toString($["openai-temperature"]),
"-m",
$["openai-model"],
"-i",
"non-persistent://tg/request/text-completion-rag",
"-o",
"non-persistent://tg/response/text-completion-rag-response",
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"text-completion-rag", [ container ]
);
engine.resources([
containerSet,
])
}
} + prompts

View file

@ -1,67 +1,71 @@
local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local prompts = import "prompts/mixtral.jsonnet";
{
services +: {
"prompt" +: {
create:: function(engine)
"prompt": base + {
image: images.trustgraph,
command: [
"prompt-generic",
"-p",
url.pulsar,
"--text-completion-request-queue",
"non-persistent://tg/request/text-completion",
"--text-completion-response-queue",
"non-persistent://tg/response/text-completion-response",
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local container =
engine.container("prompt")
.with_image(images.trustgraph)
.with_command([
"prompt-generic",
"-p",
url.pulsar,
"--text-completion-request-queue",
"non-persistent://tg/request/text-completion",
"--text-completion-response-queue",
"non-persistent://tg/response/text-completion-response",
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
"prompt-rag": base + {
image: images.trustgraph,
command: [
"prompt-generic",
"-p",
url.pulsar,
"-i",
"non-persistent://tg/request/prompt-rag",
"-o",
"non-persistent://tg/response/prompt-rag-response",
"--text-completion-request-queue",
"non-persistent://tg/request/text-completion-rag",
"--text-completion-response-queue",
"non-persistent://tg/response/text-completion-rag-response",
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local containerSet = engine.containers(
"prompt", [ container ]
);
}
engine.resources([
containerSet,
])
},
"prompt-rag" +: {
create:: function(engine)
local container =
engine.container("prompt-rag")
.with_image(images.trustgraph)
.with_command([
"prompt-generic",
"-p",
url.pulsar,
"-i",
"non-persistent://tg/request/prompt-rag",
"-o",
"non-persistent://tg/response/prompt-rag-response",
"--text-completion-request-queue",
"non-persistent://tg/request/text-completion-rag",
"--text-completion-response-queue",
"non-persistent://tg/response/text-completion-rag-response",
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"prompt-rag", [ container ]
);
engine.resources([
containerSet,
])
},
}

View file

@ -1,89 +1,92 @@
// For VertexAI Gemini
local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local prompts = import "prompts/mixtral.jsonnet";
local default_prompts = import "prompts/default-prompts.jsonnet";
default_prompts + {
{
services +: {
"prompt" +: {
create:: function(engine)
"prompt": base + {
image: images.trustgraph,
command: [
"prompt-template",
"-p",
url.pulsar,
"--text-completion-request-queue",
"non-persistent://tg/request/text-completion",
"--text-completion-response-queue",
"non-persistent://tg/response/text-completion-response",
"--definition-template",
$["prompt-definition-template"],
"--relationship-template",
$["prompt-relationship-template"],
"--knowledge-query-template",
$["prompt-knowledge-query-template"],
"--document-query-template",
$["prompt-document-query-template"],
"--rows-template",
$["prompt-rows-template"],
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local container =
engine.container("prompt")
.with_image(images.trustgraph)
.with_command([
"prompt-template",
"-p",
url.pulsar,
"--text-completion-request-queue",
"non-persistent://tg/request/text-completion",
"--text-completion-response-queue",
"non-persistent://tg/response/text-completion-response",
"--definition-template",
$["prompt-definition-template"],
"--relationship-template",
$["prompt-relationship-template"],
"--knowledge-query-template",
$["prompt-knowledge-query-template"],
"--document-query-template",
$["prompt-document-query-template"],
"--rows-template",
$["prompt-rows-template"],
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
"prompt-rag": base + {
image: images.trustgraph,
command: [
"prompt-template",
"-p",
url.pulsar,
"-i",
"non-persistent://tg/request/prompt-rag",
"-o",
"non-persistent://tg/response/prompt-rag-response",
"--text-completion-request-queue",
"non-persistent://tg/request/text-completion-rag",
"--text-completion-response-queue",
"non-persistent://tg/response/text-completion-rag-response",
"--definition-template",
$["prompt-definition-template"],
"--relationship-template",
$["prompt-relationship-template"],
"--knowledge-query-template",
$["prompt-knowledge-query-template"],
"--document-query-template",
$["prompt-document-query-template"],
"--rows-template",
$["prompt-rows-template"],
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local containerSet = engine.containers(
"prompt", [ container ]
);
engine.resources([
containerSet,
])
},
}
"prompt-rag" +: {
create:: function(engine)
local container =
engine.container("prompt-rag")
.with_image(images.trustgraph)
.with_command([
"prompt-template",
"-p",
url.pulsar,
"-i",
"non-persistent://tg/request/prompt-rag",
"-o",
"non-persistent://tg/response/prompt-rag-response",
"--text-completion-request-queue",
"non-persistent://tg/request/text-completion-rag",
"--text-completion-response-queue",
"non-persistent://tg/response/text-completion-rag-response",
"--definition-template",
$["prompt-definition-template"],
"--relationship-template",
$["prompt-relationship-template"],
"--knowledge-query-template",
$["prompt-knowledge-query-template"],
"--document-query-template",
$["prompt-document-query-template"],
"--rows-template",
$["prompt-rows-template"],
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"prompt-rag", [ container ]
);
engine.resources([
containerSet,
])
},
} + default_prompts

View file

@ -1,62 +1,62 @@
local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
{
volumes +: {
"pulsar-conf": {},
"pulsar-data": {},
},
services +: {
pulsar: base + {
image: images.pulsar,
command: "bin/pulsar standalone",
ports: [
"6650:6650",
"8080:8080",
],
environment: {
"PULSAR_MEM": "-Xms700M -Xmx700M"
},
volumes: [
"pulsar-conf:/pulsar/conf",
"pulsar-data:/pulsar/data",
],
deploy: {
resources: {
limits: {
cpus: '1.0',
memory: '900M'
},
reservations: {
cpus: '0.5',
memory: '900M'
}
}
},
},
"init-pulsar": base + {
image: images.pulsar,
command: [
"sh",
"-c",
"pulsar-admin --admin-url http://pulsar:8080 tenants create tg && pulsar-admin --admin-url http://pulsar:8080 namespaces create tg/flow && pulsar-admin --admin-url http://pulsar:8080 namespaces create tg/request && pulsar-admin --admin-url http://pulsar:8080 namespaces create tg/response && pulsar-admin --admin-url http://pulsar:8080 namespaces set-retention --size -1 --time 3m tg/response",
],
depends_on: {
pulsar: {
condition: "service_started",
}
},
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
"pulsar" +: {
create:: function(engine)
local confVolume = engine.volume("pulsar-conf").with_size("2G");
local dataVolume = engine.volume("pulsar-data").with_size("20G");
local container =
engine.container("pulsar")
.with_image(images.pulsar)
.with_command("bin/pulsar standalone")
.with_environment({
"PULSAR_MEM": "-Xms700M -Xmx700M"
})
.with_limits("1.0", "900M")
.with_reservations("0.5", "900M")
.with_volume_mount(confVolume, "/pulsar/conf")
.with_volume_mount(dataVolume, "/pulsar/data")
.with_port(6650, 6650, "bookie")
.with_port(8080, 8080, "http");
local adminContainer =
engine.container("init-pulsar")
.with_image(images.pulsar)
.with_command([
"sh",
"-c",
"pulsar-admin --admin-url http://pulsar:8080 tenants create tg && pulsar-admin --admin-url http://pulsar:8080 namespaces create tg/flow && pulsar-admin --admin-url http://pulsar:8080 namespaces create tg/request && pulsar-admin --admin-url http://pulsar:8080 namespaces create tg/response && pulsar-admin --admin-url http://pulsar:8080 namespaces set-retention --size -1 --time 3m tg/response",
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"pulsar",
[
container, adminContainer
]
);
local service =
engine.service(containerSet)
.with_port(6650, 6650)
.with_port(8080, 8080);
engine.resources([
confVolume,
dataVolume,
containerSet,
service,
])
}
}

View file

@ -1,105 +1,117 @@
local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local cassandra_hosts = "cassandra";
local qdrant = import "stores/qdrant.jsonnet";
qdrant + {
services +: {
"store-graph-embeddings" +: {
create:: function(engine)
"store-graph-embeddings": base + {
image: images.trustgraph,
command: [
"ge-write-qdrant",
"-p",
url.pulsar,
"-t",
url.qdrant,
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local container =
engine.container("store-graph-embeddings")
.with_image(images.trustgraph)
.with_command([
"ge-write-qdrant",
"-p",
url.pulsar,
"-t",
url.qdrant,
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
"query-graph-embeddings": base + {
image: images.trustgraph,
command: [
"ge-query-qdrant",
"-p",
url.pulsar,
"-t",
url.qdrant,
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local containerSet = engine.containers(
"store-graph-embeddings", [ container ]
);
// Document embeddings writer & query service.
engine.resources([
containerSet,
])
"store-doc-embeddings": base + {
image: images.trustgraph,
command: [
"de-write-qdrant",
"-p",
url.pulsar,
"-t",
url.qdrant,
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
},
"query-graph-embeddings" +: {
create:: function(engine)
local container =
engine.container("query-graph-embeddings")
.with_image(images.trustgraph)
.with_command([
"ge-query-qdrant",
"-p",
url.pulsar,
"-t",
url.qdrant,
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"query-graph-embeddings", [ container ]
);
engine.resources([
containerSet,
])
},
"store-doc-embeddings" +: {
create:: function(engine)
local container =
engine.container("store-doc-embeddings")
.with_image(images.trustgraph)
.with_command([
"de-write-qdrant",
"-p",
url.pulsar,
"-t",
url.qdrant,
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"store-doc-embeddings", [ container ]
);
engine.resources([
containerSet,
])
},
"query-doc-embeddings" +: {
create:: function(engine)
local container =
engine.container("query-doc-embeddings")
.with_image(images.trustgraph)
.with_command([
"de-query-qdrant",
"-p",
url.pulsar,
"-t",
url.qdrant,
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"query-doc-embeddings", [ container ]
);
engine.resources([
containerSet,
])
"query-doc-embeddings": base + {
image: images.trustgraph,
command: [
"de-query-qdrant",
"-p",
url.pulsar,
"-t",
url.qdrant,
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
}

View file

@ -1,85 +1,91 @@
local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local prompts = import "prompt-template.jsonnet";
local prompt = import "prompt-template.jsonnet";
{
"chunk-size":: 250,
"chunk-overlap":: 15,
services +: {
"chunker" +: {
create:: function(engine)
"pdf-decoder": base + {
image: images.trustgraph,
command: [
"pdf-decoder",
"-p",
url.pulsar,
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local container =
engine.container("chunker")
.with_image(images.trustgraph)
.with_command([
"chunker-token",
"-p",
url.pulsar,
"--chunk-size",
std.toString($["chunk-size"]),
"--chunk-overlap",
std.toString($["chunk-overlap"]),
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
chunker: base + {
image: images.trustgraph,
command: [
"chunker-token",
"-p",
url.pulsar,
"--chunk-size",
std.toString($["chunk-size"]),
"--chunk-overlap",
std.toString($["chunk-overlap"]),
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local containerSet = engine.containers(
"chunker", [ container ]
);
vectorize: base + {
image: images.trustgraph,
command: [
"embeddings-vectorize",
"-p",
url.pulsar,
],
deploy: {
resources: {
limits: {
cpus: '1.0',
memory: '512M'
},
reservations: {
cpus: '0.5',
memory: '512M'
}
}
},
},
engine.resources([
containerSet,
])
}
},
} + prompts
"pdf-decoder" +: {
create:: function(engine)
local container =
engine.container("pdf-decoder")
.with_image(images.trustgraph)
.with_command([
"pdf-decoder",
"-p",
url.pulsar,
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M");
local containerSet = engine.containers(
"pdf-decoder", [ container ]
);
engine.resources([
containerSet,
])
},
"vectorize" +: {
create:: function(engine)
local container =
engine.container("vectorize")
.with_image(images.trustgraph)
.with_command([
"embeddings-vectorize",
"-p",
url.pulsar,
])
.with_limits("1.0", "512M")
.with_reservations("0.5", "512M");
local containerSet = engine.containers(
"vectorize", [ container ]
);
engine.resources([
containerSet,
])
},
} + prompt

View file

@ -1,7 +1,8 @@
local base = import "base/base.jsonnet";
local images = import "values/images.jsonnet";
local url = import "values/url.jsonnet";
local prompts = import "prompts/gemini.jsonnet";
local prompts = import "prompts/mixtral.jsonnet";
{
"vertexai-model":: "gemini-1.0-pro-001",
@ -10,80 +11,88 @@ local prompts = import "prompts/gemini.jsonnet";
"vertexai-max-output-tokens":: 4096,
"vertexai-temperature":: 0.0,
services +: {
"text-completion" +: {
create:: function(engine)
"text-completion": base + {
image: images.trustgraph,
command: [
"text-completion-vertexai",
"-p",
url.pulsar,
"-k",
$["vertexai-private-key"],
"-r",
$["vertexai-region"],
"-x",
std.toString($["vertexai-max-output-tokens"]),
"-t",
std.toString($["vertexai-temperature"]),
"-m",
$["vertexai-model"],
],
volumes: [
"./vertexai:/vertexai"
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
local cfgVol = engine.configVolume("./vertexai");
"text-completion-rag": base + {
image: images.trustgraph,
command: [
"text-completion-vertexai",
"-p",
url.pulsar,
"-k",
$["vertexai-private-key"],
"-r",
$["vertexai-region"],
"-x",
std.toString($["vertexai-max-output-tokens"]),
"-t",
std.toString($["vertexai-temperature"]),
"-m",
$["vertexai-model"],
"-i",
"non-persistent://tg/request/text-completion-rag",
"-o",
"non-persistent://tg/response/text-completion-rag-response",
],
volumes: [
"./vertexai:/vertexai"
],
deploy: {
resources: {
limits: {
cpus: '0.5',
memory: '128M'
},
reservations: {
cpus: '0.1',
memory: '128M'
}
}
},
},
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",
std.toString($["vertexai-temperature"]),
"-m",
$["vertexai-model"],
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M")
.with_volume_mount(cfgVol, "/vertexai");
local containerSet = engine.containers(
"text-completion", [ container ]
);
engine.resources([
cfgVol,
containerSet,
])
},
"text-completion-rag" +: {
create:: function(engine)
local cfgVol = engine.configVolume("./vertexai");
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",
std.toString($["vertexai-temperature"]),
"-m",
$["vertexai-model"],
"-i",
"non-persistent://tg/request/text-completion-rag",
"-o",
"non-persistent://tg/response/text-completion-rag-response",
])
.with_limits("0.5", "128M")
.with_reservations("0.1", "128M")
.with_volume_mount(cfgVol, "/vertexai");
local containerSet = engine.containers(
"text-completion-rag", [ container ]
);
engine.resources([
cfgVol,
containerSet,
])
}
} + prompts