mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-06-04 20:35:14 +02:00
Remove template dir, see github.com/trustgraph-ai/trustgraph-templates (#336)
This commit is contained in:
parent
1d222235d3
commit
b08c7f03a6
116 changed files with 0 additions and 6701 deletions
|
|
@ -1,125 +0,0 @@
|
||||||
|
|
||||||
# TrustGraph template generation
|
|
||||||
|
|
||||||
There are two utilities here:
|
|
||||||
|
|
||||||
- `generate`: Generates a single Docker Compose launch configuration
|
|
||||||
based on configuration you provide.
|
|
||||||
- `generate-all`: Generates the release bundle for releases. You won't
|
|
||||||
need to use this unless you are managing releases.
|
|
||||||
|
|
||||||
## `generate-all`
|
|
||||||
|
|
||||||
Previously, this generates a full set of all vector DB / triple store / LLM
|
|
||||||
combinations, and put them in a single ZIP file. But this got out of
|
|
||||||
hand, so at the time of writing, this generates a single configuraton
|
|
||||||
using Qdrant vector DB, Ollama LLM support and Cassandra for a triple store.
|
|
||||||
|
|
||||||
The combinations are contained withing the code, it takes two arguments:
|
|
||||||
- output ZIP file (is over-written)
|
|
||||||
- TrustGraph version number
|
|
||||||
|
|
||||||
```
|
|
||||||
templates/generate-all output.zip 0.18.11
|
|
||||||
```
|
|
||||||
|
|
||||||
## `generate`
|
|
||||||
|
|
||||||
This utility takes a configuration file describing the components to bundle,
|
|
||||||
and outputs a Docker Compose YAML file.
|
|
||||||
|
|
||||||
### Input configuration
|
|
||||||
|
|
||||||
The input configuration is a JSON file, an array of components to pull into
|
|
||||||
the configuration. For each component, there is a name and a (possibly empty)
|
|
||||||
object describing addtional parameters for that component.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"name": "cassandra",
|
|
||||||
"parameters": {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "pulsar",
|
|
||||||
"parameters": {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "qdrant",
|
|
||||||
"parameters": {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "embeddings-hf",
|
|
||||||
"parameters": {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "graph-rag",
|
|
||||||
"parameters": {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "grafana",
|
|
||||||
"parameters": {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "trustgraph",
|
|
||||||
"parameters": {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "googleaistudio",
|
|
||||||
"parameters": {
|
|
||||||
"googleaistudio-temperature": 0.3,
|
|
||||||
"googleaistudio-max-output-tokens": 2048,
|
|
||||||
"googleaistudio-model": "gemini-1.5-pro-002"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "prompt-template",
|
|
||||||
"parameters": {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "override-recursive-chunker",
|
|
||||||
"parameters": {
|
|
||||||
"chunk-size": 1000,
|
|
||||||
"chunk-overlap": 50
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "workbench-ui",
|
|
||||||
"parameters": {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "agent-manager-react",
|
|
||||||
"parameters": {}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
If you want to make your own configuration you could try changing the
|
|
||||||
configuration above:
|
|
||||||
- Components which are essential: pulsar, trustgraph, graph-rag, grafana,
|
|
||||||
agent-manager-react
|
|
||||||
- You need a triple store, one of: cassandra, memgraph, falkordb, neo4j
|
|
||||||
- You need a vector store, one of: qdrant, pinecone
|
|
||||||
- You need an LLM, one of: azure, azure-openai, bedrock, claude, cohere,
|
|
||||||
llamafile, ollama, openai, vertexai.
|
|
||||||
- You need an embeddings implementation, one of: embeddings-hf,
|
|
||||||
embeddings-ollama
|
|
||||||
- Optionally add the Workbench tool: workbench-ui
|
|
||||||
|
|
||||||
Components have over-ridable parameters, look in the component definition
|
|
||||||
in `templates/components/` to see what you can override.
|
|
||||||
|
|
||||||
### Invocation
|
|
||||||
|
|
||||||
Two parameters:
|
|
||||||
- The output ZIP file
|
|
||||||
- The version number
|
|
||||||
|
|
||||||
The configuration file described above is provided on standard input
|
|
||||||
|
|
||||||
```
|
|
||||||
templates/generate out.zip 0.18.9 < config.json
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
[
|
|
||||||
import "patterns/document-rag.jsonnet",
|
|
||||||
import "patterns/embeddings-hf.jsonnet",
|
|
||||||
import "patterns/embeddings-ollama.jsonnet",
|
|
||||||
import "patterns/grafana.jsonnet",
|
|
||||||
import "patterns/triple-store-cassandra.jsonnet",
|
|
||||||
import "patterns/triple-store-neo4j.jsonnet",
|
|
||||||
import "patterns/triple-store-falkordb.jsonnet",
|
|
||||||
import "patterns/graph-rag.jsonnet",
|
|
||||||
import "patterns/llm-azure.jsonnet",
|
|
||||||
import "patterns/llm-azure-openai.jsonnet",
|
|
||||||
import "patterns/llm-bedrock.jsonnet",
|
|
||||||
import "patterns/llm-claude.jsonnet",
|
|
||||||
import "patterns/llm-cohere.jsonnet",
|
|
||||||
import "patterns/llm-llamafile.jsonnet",
|
|
||||||
import "patterns/llm-mistral.jsonnet",
|
|
||||||
import "patterns/llm-ollama.jsonnet",
|
|
||||||
import "patterns/llm-openai.jsonnet",
|
|
||||||
import "patterns/llm-vertexai.jsonnet",
|
|
||||||
import "patterns/override-recursive-chunker.jsonnet",
|
|
||||||
import "patterns/prompt-template-definitions.jsonnet",
|
|
||||||
import "patterns/prompt-template-document-query.jsonnet",
|
|
||||||
import "patterns/prompt-template-kg-query.jsonnet",
|
|
||||||
import "patterns/prompt-template-relationships.jsonnet",
|
|
||||||
import "patterns/prompt-template-rows-template.jsonnet",
|
|
||||||
import "patterns/pulsar-manager.jsonnet",
|
|
||||||
import "patterns/pulsar.jsonnet",
|
|
||||||
import "patterns/trustgraph-base.jsonnet",
|
|
||||||
import "patterns/vector-store-milvus.jsonnet",
|
|
||||||
import "patterns/vector-store-qdrant.jsonnet",
|
|
||||||
]
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
restart: "on-failure:100",
|
|
||||||
}
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
{
|
|
||||||
|
|
||||||
// Essentials
|
|
||||||
"trustgraph-base": import "components/trustgraph.jsonnet",
|
|
||||||
"pulsar": import "components/pulsar.jsonnet",
|
|
||||||
|
|
||||||
// LLMs
|
|
||||||
"azure": import "components/azure.jsonnet",
|
|
||||||
"azure-openai": import "components/azure-openai.jsonnet",
|
|
||||||
"bedrock": import "components/bedrock.jsonnet",
|
|
||||||
"claude": import "components/claude.jsonnet",
|
|
||||||
"cohere": import "components/cohere.jsonnet",
|
|
||||||
"googleaistudio": import "components/googleaistudio.jsonnet",
|
|
||||||
"lmstudio": import "components/lmstudio.jsonnet",
|
|
||||||
"mistral": import "components/mistral.jsonnet",
|
|
||||||
"ollama": import "components/ollama.jsonnet",
|
|
||||||
"openai": import "components/openai.jsonnet",
|
|
||||||
"vertexai": import "components/vertexai.jsonnet",
|
|
||||||
|
|
||||||
// LLMs for RAG
|
|
||||||
"azure-rag": import "components/azure-rag.jsonnet",
|
|
||||||
"azure-openai-rag": import "components/azure-openai-rag.jsonnet",
|
|
||||||
"bedrock-rag": import "components/bedrock-rag.jsonnet",
|
|
||||||
"claude-rag": import "components/claude-rag.jsonnet",
|
|
||||||
"cohere-rag": import "components/cohere-rag.jsonnet",
|
|
||||||
"googleaistudio-rag": import "components/googleaistudio-rag.jsonnet",
|
|
||||||
"lmstudio-rag": import "components/lmstudio-rag.jsonnet",
|
|
||||||
"mistral-rag": import "components/mistral-rag.jsonnet",
|
|
||||||
"ollama-rag": import "components/ollama-rag.jsonnet",
|
|
||||||
"openai-rag": import "components/openai-rag.jsonnet",
|
|
||||||
"vertexai-rag": import "components/vertexai-rag.jsonnet",
|
|
||||||
|
|
||||||
// Embeddings
|
|
||||||
"embeddings-ollama": import "components/embeddings-ollama.jsonnet",
|
|
||||||
"embeddings-hf": import "components/embeddings-hf.jsonnet",
|
|
||||||
"embeddings-fastembed": import "components/embeddings-fastembed.jsonnet",
|
|
||||||
|
|
||||||
// Processing pipelines
|
|
||||||
"graph-rag": import "components/graph-rag.jsonnet",
|
|
||||||
"document-rag": import "components/document-rag.jsonnet",
|
|
||||||
|
|
||||||
// OCR options
|
|
||||||
"ocr": import "components/ocr.jsonnet",
|
|
||||||
"mistral-ocr": import "components/mistral-ocr.jsonnet",
|
|
||||||
|
|
||||||
// Librarian - document management
|
|
||||||
"librarian": import "components/librarian.jsonnet",
|
|
||||||
|
|
||||||
// Vector stores
|
|
||||||
"vector-store-milvus": import "components/milvus.jsonnet",
|
|
||||||
"vector-store-qdrant": import "components/qdrant.jsonnet",
|
|
||||||
"vector-store-pinecone": import "components/pinecone.jsonnet",
|
|
||||||
|
|
||||||
// Triples stores
|
|
||||||
"triple-store-cassandra": import "components/cassandra.jsonnet",
|
|
||||||
"triple-store-neo4j": import "components/neo4j.jsonnet",
|
|
||||||
"triple-store-falkordb": import "components/falkordb.jsonnet",
|
|
||||||
"triple-store-memgraph": import "components/memgraph.jsonnet",
|
|
||||||
|
|
||||||
// Observability support
|
|
||||||
"grafana": import "components/grafana.jsonnet",
|
|
||||||
|
|
||||||
// Pulsar manager is a UI for Pulsar. Uses a LOT of memory
|
|
||||||
"pulsar-manager": import "components/pulsar-manager.jsonnet",
|
|
||||||
|
|
||||||
"llamafile": import "components/llamafile.jsonnet",
|
|
||||||
"override-recursive-chunker": import "components/chunker-recursive.jsonnet",
|
|
||||||
|
|
||||||
// The prompt manager
|
|
||||||
"prompt-template": import "components/prompt-template.jsonnet",
|
|
||||||
"prompt-overrides": import "components/prompt-overrides.jsonnet",
|
|
||||||
|
|
||||||
// ReAct agent
|
|
||||||
"agent-manager-react": import "components/agent-manager-react.jsonnet",
|
|
||||||
|
|
||||||
// Optional UI
|
|
||||||
"workbench-ui": import "components/workbench-ui.jsonnet",
|
|
||||||
|
|
||||||
// Does nothing. But, can be a hack to overwrite parameters
|
|
||||||
"null": {},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
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";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
tools:: [],
|
|
||||||
|
|
||||||
"agent-manager" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("agent-manager")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"agent-manager-react",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"--prompt-request-queue",
|
|
||||||
"non-persistent://tg/request/prompt-rag",
|
|
||||||
"--prompt-response-queue",
|
|
||||||
"non-persistent://tg/response/prompt-rag",
|
|
||||||
"--tool-type",
|
|
||||||
] + [
|
|
||||||
tool.id + "=" + tool.type
|
|
||||||
for tool in $.tools
|
|
||||||
] + [
|
|
||||||
"--tool-description"
|
|
||||||
] + [
|
|
||||||
tool.id + "=" + tool.description
|
|
||||||
for tool in $.tools
|
|
||||||
] + [
|
|
||||||
"--tool-argument"
|
|
||||||
] + [
|
|
||||||
"%s=%s:%s:%s" % [
|
|
||||||
tool.id, arg.name, arg.type, arg.description
|
|
||||||
]
|
|
||||||
for tool in $.tools
|
|
||||||
for arg in tool.arguments
|
|
||||||
]
|
|
||||||
)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"agent-manager", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + default_prompts
|
|
||||||
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["ollama-rag-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"azure-openai-rag-model":: "GPT-3.5-Turbo",
|
|
||||||
"azure-openai-rag-max-output-tokens":: 4192,
|
|
||||||
"azure-openai-rag-temperature":: 0.0,
|
|
||||||
|
|
||||||
"text-completion-rag" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("azure-openai-credentials")
|
|
||||||
.with_env_var("AZURE_TOKEN", "azure-token");
|
|
||||||
|
|
||||||
local containerRag =
|
|
||||||
engine.container("text-completion-rag")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-azure",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-x",
|
|
||||||
std.toString($["azure-openai-rag-max-output-tokens"]),
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["azure-openai-rag-temperature"],
|
|
||||||
"-i",
|
|
||||||
"non-persistent://tg/request/text-completion-rag",
|
|
||||||
"-o",
|
|
||||||
"non-persistent://tg/response/text-completion-rag",
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSetRag,
|
|
||||||
serviceRag,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["azure-openai-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"azure-openai-model":: "GPT-3.5-Turbo",
|
|
||||||
"azure-openai-max-output-tokens":: 4192,
|
|
||||||
"azure-openai-temperature":: 0.0,
|
|
||||||
|
|
||||||
"text-completion" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("azure-openai-credentials")
|
|
||||||
.with_env_var("AZURE_TOKEN", "azure-token");
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("text-completion")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-azure-openai",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-m",
|
|
||||||
$["azure-openai-model"],
|
|
||||||
"-x",
|
|
||||||
std.toString($["azure-openai-max-output-tokens"]),
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["azure-openai-temperature"],
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"text-completion", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["azure-rag-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"azure-rag-max-output-tokens":: 4096,
|
|
||||||
"azure-rag-temperature":: 0.0,
|
|
||||||
|
|
||||||
"text-completion-rag" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("azure-credentials")
|
|
||||||
.with_env_var("AZURE_TOKEN", "azure-token")
|
|
||||||
.with_env_var("AZURE_ENDPOINT", "azure-endpoint");
|
|
||||||
|
|
||||||
local containerRag =
|
|
||||||
engine.container("text-completion-rag")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-azure",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-x",
|
|
||||||
std.toString($["azure-rag-max-output-tokens"]),
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["azure-rag-temperature"],
|
|
||||||
"-i",
|
|
||||||
"non-persistent://tg/request/text-completion-rag",
|
|
||||||
"-o",
|
|
||||||
"non-persistent://tg/response/text-completion-rag",
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSetRag,
|
|
||||||
serviceRag,
|
|
||||||
])
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["azure-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"azure-max-output-tokens":: 4096,
|
|
||||||
"azure-temperature":: 0.0,
|
|
||||||
|
|
||||||
"text-completion" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("azure-credentials")
|
|
||||||
.with_env_var("AZURE_TOKEN", "azure-token")
|
|
||||||
.with_env_var("AZURE_ENDPOINT", "azure-endpoint");
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("text-completion")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-azure",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-x",
|
|
||||||
std.toString($["azure-max-output-tokens"]),
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["azure-temperature"],
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"text-completion", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
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 chunker = import "chunker-recursive.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["bedrock-rag-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"bedrock-rag-max-output-tokens":: 4096,
|
|
||||||
"bedrock-rag-temperature":: 0.0,
|
|
||||||
"bedrock-rag-model":: "mistral.mixtral-8x7b-instruct-v0:1",
|
|
||||||
|
|
||||||
"text-completion-rag" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("bedrock-credentials")
|
|
||||||
.with_env_var("AWS_ACCESS_KEY_ID", "aws-id-key")
|
|
||||||
.with_env_var("AWS_SECRET_ACCESS_KEY", "aws-secret")
|
|
||||||
.with_env_var("AWS_DEFAULT_REGION", "aws-region");
|
|
||||||
|
|
||||||
local containerRag =
|
|
||||||
engine.container("text-completion-rag")
|
|
||||||
.with_image(images.trustgraph_bedrock)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-bedrock",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-x",
|
|
||||||
std.toString($["bedrock-rag-max-output-tokens"]),
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["bedrock-rag-temperature"],
|
|
||||||
"-m",
|
|
||||||
$["bedrock-rag-model"],
|
|
||||||
"-i",
|
|
||||||
"non-persistent://tg/request/text-completion-rag",
|
|
||||||
"-o",
|
|
||||||
"non-persistent://tg/response/text-completion-rag",
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSetRag,
|
|
||||||
serviceRag,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts + chunker
|
|
||||||
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
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 chunker = import "chunker-recursive.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["bedrock-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"bedrock-max-output-tokens":: 4096,
|
|
||||||
"bedrock-temperature":: 0.0,
|
|
||||||
"bedrock-model":: "mistral.mixtral-8x7b-instruct-v0:1",
|
|
||||||
|
|
||||||
"text-completion" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("bedrock-credentials")
|
|
||||||
.with_env_var("AWS_ACCESS_KEY_ID", "aws-id-key")
|
|
||||||
.with_env_var("AWS_SECRET_ACCESS_KEY", "aws-secret")
|
|
||||||
.with_env_var("AWS_DEFAULT_REGION", "aws-region");
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("text-completion")
|
|
||||||
.with_image(images.trustgraph_bedrock)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-bedrock",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-x",
|
|
||||||
std.toString($["bedrock-max-output-tokens"]),
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["bedrock-temperature"],
|
|
||||||
"-m",
|
|
||||||
$["bedrock-model"],
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"text-completion", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts + chunker
|
|
||||||
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local cassandra_hosts = "cassandra";
|
|
||||||
local cassandra = import "stores/cassandra.jsonnet";
|
|
||||||
|
|
||||||
cassandra + {
|
|
||||||
|
|
||||||
"store-triples" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("store-triples")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"triples-write-cassandra",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-g",
|
|
||||||
cassandra_hosts,
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"store-triples", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"query-triples" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("query-triples")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.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 ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
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,
|
|
||||||
|
|
||||||
"chunker" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("chunker")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.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 ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["claude-rag-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"claude-rag-model":: "claude-3-sonnet-20240229",
|
|
||||||
"claude-rag-max-output-tokens":: 4096,
|
|
||||||
"claude-rag-temperature":: 0.0,
|
|
||||||
|
|
||||||
"text-completion-rag" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("claude-credentials")
|
|
||||||
.with_env_var("CLAUDE_KEY", "claude-key");
|
|
||||||
|
|
||||||
local containerRag =
|
|
||||||
engine.container("text-completion-rag")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-claude",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-x",
|
|
||||||
std.toString($["claude-rag-max-output-tokens"]),
|
|
||||||
"-m",
|
|
||||||
$["claude-rag-model"],
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["claude-rag-temperature"],
|
|
||||||
"-i",
|
|
||||||
"non-persistent://tg/request/text-completion-rag",
|
|
||||||
"-o",
|
|
||||||
"non-persistent://tg/response/text-completion-rag",
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSetRag,
|
|
||||||
serviceRag,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["claude-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"claude-model":: "claude-3-sonnet-20240229",
|
|
||||||
"claude-max-output-tokens":: 4096,
|
|
||||||
"claude-temperature":: 0.0,
|
|
||||||
|
|
||||||
"text-completion" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("claude-credentials")
|
|
||||||
.with_env_var("CLAUDE_KEY", "claude-key");
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("text-completion")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-claude",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-x",
|
|
||||||
std.toString($["claude-max-output-tokens"]),
|
|
||||||
"-m",
|
|
||||||
$["claude-model"],
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["claude-temperature"],
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"text-completion", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["cohere-rag-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"cohere-rag-temperature":: 0.0,
|
|
||||||
|
|
||||||
"text-completion-rag" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("cohere-credentials")
|
|
||||||
.with_env_var("COHERE_KEY", "cohere-key");
|
|
||||||
|
|
||||||
local containerRag =
|
|
||||||
engine.container("text-completion-rag")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-cohere",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["cohere-rag-temperature"],
|
|
||||||
"-i",
|
|
||||||
"non-persistent://tg/request/text-completion-rag",
|
|
||||||
"-o",
|
|
||||||
"non-persistent://tg/response/text-completion-rag",
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSetRag,
|
|
||||||
serviceRag,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["cohere-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"cohere-temperature":: 0.0,
|
|
||||||
|
|
||||||
"text-completion" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("cohere-credentials")
|
|
||||||
.with_env_var("COHERE_KEY", "cohere-key");
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("text-completion")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-cohere",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["cohere-temperature"],
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"text-completion", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,77 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
"document-rag-doc-limit":: 20,
|
|
||||||
|
|
||||||
"document-rag" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("document-rag")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"document-rag",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"--doc-limit",
|
|
||||||
std.toString($["document-rag-doc-limit"]),
|
|
||||||
"--prompt-request-queue",
|
|
||||||
"non-persistent://tg/request/prompt-rag",
|
|
||||||
"--prompt-response-queue",
|
|
||||||
"non-persistent://tg/response/prompt-rag",
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"document-rag", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"document-embeddings" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("document-embeddings")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"document-embeddings",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
])
|
|
||||||
.with_limits("1.0", "512M")
|
|
||||||
.with_reservations("0.5", "512M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"document-embeddings", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
"embeddings-model":: "sentence-transformers/all-MiniLM-L6-v2",
|
|
||||||
|
|
||||||
embeddings +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("embeddings")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"embeddings-fastembed",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-m",
|
|
||||||
$["embeddings-model"],
|
|
||||||
])
|
|
||||||
.with_limits("1.0", "400M")
|
|
||||||
.with_reservations("0.5", "400M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"embeddings", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
"embeddings-model":: "all-MiniLM-L6-v2",
|
|
||||||
|
|
||||||
embeddings +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("embeddings")
|
|
||||||
.with_image(images.trustgraph_hf)
|
|
||||||
.with_command([
|
|
||||||
"embeddings-hf",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-m",
|
|
||||||
$["embeddings-model"],
|
|
||||||
])
|
|
||||||
.with_limits("1.0", "400M")
|
|
||||||
.with_reservations("0.5", "400M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"embeddings", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
"embeddings-model":: "mxbai-embed-large",
|
|
||||||
"ollama-url":: "${OLLAMA_HOST}",
|
|
||||||
|
|
||||||
embeddings +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("embeddings")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"embeddings-ollama",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-m",
|
|
||||||
$["embeddings-model"],
|
|
||||||
"-r",
|
|
||||||
$["ollama-url"],
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"embeddings", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,76 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local falkordb = import "stores/falkordb.jsonnet";
|
|
||||||
|
|
||||||
falkordb + {
|
|
||||||
|
|
||||||
"falkordb-url":: "falkor://falkordb:6379",
|
|
||||||
|
|
||||||
"store-triples" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("store-triples")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"triples-write-falkordb",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-g",
|
|
||||||
$["falkordb-url"],
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"store-triples", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"query-triples" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("query-triples")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"triples-query-falkordb",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-g",
|
|
||||||
$["falkordb-url"],
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"query-triples", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["googleaistudio-rag-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"googleaistudio-rag-max-output-tokens":: 4096,
|
|
||||||
"googleaistudio-rag-temperature":: 0.0,
|
|
||||||
"googleaistudio-rag-model":: "gemini-1.5-flash-002",
|
|
||||||
|
|
||||||
"text-completion-rag" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("googleaistudio-credentials")
|
|
||||||
.with_env_var("GOOGLE_AI_STUDIO_KEY", "googleaistudio-key");
|
|
||||||
|
|
||||||
local containerRag =
|
|
||||||
engine.container("text-completion-rag")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-googleaistudio",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-x",
|
|
||||||
std.toString(
|
|
||||||
$["googleaistudio-rag-max-output-tokens"]
|
|
||||||
),
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["googleaistudio-rag-temperature"],
|
|
||||||
"-m",
|
|
||||||
$["googleaistudio-rag-model"],
|
|
||||||
"-i",
|
|
||||||
"non-persistent://tg/request/text-completion-rag",
|
|
||||||
"-o",
|
|
||||||
"non-persistent://tg/response/text-completion-rag",
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSetRag,
|
|
||||||
serviceRag,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["googleaistudio-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"googleaistudio-max-output-tokens":: 4096,
|
|
||||||
"googleaistudio-temperature":: 0.0,
|
|
||||||
"googleaistudio-model":: "gemini-1.5-flash-002",
|
|
||||||
|
|
||||||
"text-completion" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("googleaistudio-credentials")
|
|
||||||
.with_env_var("GOOGLE_AI_STUDIO_KEY", "googleaistudio-key");
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("text-completion")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-googleaistudio",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-x",
|
|
||||||
std.toString($["googleaistudio-max-output-tokens"]),
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["googleaistudio-temperature"],
|
|
||||||
"-m",
|
|
||||||
$["googleaistudio-model"],
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"text-completion", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,122 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
"prometheus" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local vol = engine.volume("prometheus-data").with_size("20G");
|
|
||||||
|
|
||||||
local cfgVol = engine.configVolume(
|
|
||||||
"prometheus-cfg", "prometheus",
|
|
||||||
{
|
|
||||||
"prometheus.yml": importstr "prometheus/prometheus.yml",
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
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 ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.service(containerSet)
|
|
||||||
.with_port(9090, 9090, "http");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
cfgVol,
|
|
||||||
vol,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"grafana" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local vol = engine.volume("grafana-storage").with_size("20G");
|
|
||||||
|
|
||||||
local provDashVol = engine.configVolume(
|
|
||||||
"prov-dash", "grafana/provisioning/",
|
|
||||||
{
|
|
||||||
"dashboard.yml":
|
|
||||||
importstr "grafana/provisioning/dashboard.yml",
|
|
||||||
}
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
local provDataVol = engine.configVolume(
|
|
||||||
"prov-data", "grafana/provisioning/",
|
|
||||||
{
|
|
||||||
"datasource.yml":
|
|
||||||
importstr "grafana/provisioning/datasource.yml",
|
|
||||||
}
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
local dashVol = engine.configVolume(
|
|
||||||
"dashboards", "grafana/dashboards/",
|
|
||||||
{
|
|
||||||
"dashboard.json":
|
|
||||||
importstr "grafana/dashboards/dashboard.json",
|
|
||||||
}
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
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(
|
|
||||||
provDashVol, "/etc/grafana/provisioning/dashboards/"
|
|
||||||
)
|
|
||||||
.with_volume_mount(
|
|
||||||
provDataVol, "/etc/grafana/provisioning/datasources/"
|
|
||||||
)
|
|
||||||
.with_volume_mount(
|
|
||||||
dashVol, "/var/lib/grafana/dashboards/"
|
|
||||||
);
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"grafana", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.service(containerSet)
|
|
||||||
.with_port(3000, 3000, "http");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
vol,
|
|
||||||
provDashVol,
|
|
||||||
provDataVol,
|
|
||||||
dashVol,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,175 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
"graph-rag-entity-limit":: 50,
|
|
||||||
"graph-rag-triple-limit":: 30,
|
|
||||||
"graph-rag-max-subgraph-size":: 400,
|
|
||||||
"graph-rag-max-path-length":: 2,
|
|
||||||
|
|
||||||
"kg-extract-definitions" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("kg-extract-definitions")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"kg-extract-definitions",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"kg-extract-definitions", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"kg-extract-relationships" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("kg-extract-relationships")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.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 ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"kg-extract-topics" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("kg-extract-topics")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"kg-extract-topics",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"kg-extract-topics", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"graph-rag" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("graph-rag")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.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",
|
|
||||||
"--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"]),
|
|
||||||
"--max-path-length",
|
|
||||||
std.toString($["graph-rag-max-path-length"]),
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"graph-rag", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"graph-embeddings" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("graph-embeddings")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"graph-embeddings",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
])
|
|
||||||
.with_limits("1.0", "512M")
|
|
||||||
.with_reservations("0.5", "512M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"graph-embeddings", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local minio = import "stores/minio.jsonnet";
|
|
||||||
local cassandra = import "stores/cassandra.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
"librarian" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("librarian")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"librarian",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "256M")
|
|
||||||
.with_reservations("0.1", "256M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"librarian", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Minio and Cassandra are used by the Librarian
|
|
||||||
+ minio + cassandra
|
|
||||||
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/slm.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["llamafile-rag-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"llamafile-rag-model":: "LLaMA_CPP",
|
|
||||||
|
|
||||||
"text-completion-rag" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("llamafile-credentials")
|
|
||||||
.with_env_var("LLAMAFILE_URL", "llamafile-url");
|
|
||||||
|
|
||||||
local containerRag =
|
|
||||||
engine.container("text-completion-rag")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-llamafile",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-m",
|
|
||||||
$["llamafile-rag-model"],
|
|
||||||
"-i",
|
|
||||||
"non-persistent://tg/request/text-completion-rag",
|
|
||||||
"-o",
|
|
||||||
"non-persistent://tg/response/text-completion-rag",
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSetRag,
|
|
||||||
serviceRag,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/slm.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["llamafile-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"llamafile-model":: "LLaMA_CPP",
|
|
||||||
|
|
||||||
"text-completion" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("llamafile-credentials")
|
|
||||||
.with_env_var("LLAMAFILE_URL", "llamafile-url");
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("text-completion")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-llamafile",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-m",
|
|
||||||
$["llamafile-model"],
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"text-completion", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["lmstudio-rag-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"lmstudio-rag-max-output-tokens":: 4096,
|
|
||||||
"lmstudio-rag-temperature":: 0.0,
|
|
||||||
"lmstudio-rag-model":: "GPT-3.5-Turbo",
|
|
||||||
|
|
||||||
"text-completion-rag" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("lmstudio-credentials")
|
|
||||||
.with_env_var("LMSTUDIO_URL", "lmstudio-url");
|
|
||||||
|
|
||||||
local containerRag =
|
|
||||||
engine.container("text-completion-rag")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-lmstudio",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-x",
|
|
||||||
std.toString($["lmstudio-rag-max-output-tokens"]),
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["lmstudio-rag-temperature"],
|
|
||||||
"-m",
|
|
||||||
$["lmstudio-rag-model"],
|
|
||||||
"-i",
|
|
||||||
"non-persistent://tg/request/text-completion-rag",
|
|
||||||
"-o",
|
|
||||||
"non-persistent://tg/response/text-completion-rag",
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSetRag,
|
|
||||||
serviceRag,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["lmstudio-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"lmstudio-max-output-tokens":: 4096,
|
|
||||||
"lmstudio-temperature":: 0.0,
|
|
||||||
"lmstudio-model":: "GPT-3.5-Turbo",
|
|
||||||
|
|
||||||
"text-completion" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("lmstudio-credentials")
|
|
||||||
.with_env_var("LMSTUDIO_URL", "lmstudio-url");
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("text-completion")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-lmstudio",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-x",
|
|
||||||
std.toString($["lmstudio-max-output-tokens"]),
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["lmstudio-temperature"],
|
|
||||||
"-m",
|
|
||||||
$["lmstudio-model"],
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"text-completion", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,81 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local memgraph = import "stores/memgraph.jsonnet";
|
|
||||||
|
|
||||||
memgraph + {
|
|
||||||
|
|
||||||
"memgraph-url":: "bolt://memgraph:7687",
|
|
||||||
"memgraph-database":: "memgraph",
|
|
||||||
|
|
||||||
"store-triples" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("store-triples")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"triples-write-memgraph",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-g",
|
|
||||||
$["memgraph-url"],
|
|
||||||
"--database",
|
|
||||||
$["memgraph-database"],
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"store-triples", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"query-triples" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("query-triples")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"triples-query-memgraph",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-g",
|
|
||||||
$["memgraph-url"],
|
|
||||||
"--database",
|
|
||||||
$["memgraph-database"],
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"query-triples", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,139 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local cassandra_hosts = "cassandra";
|
|
||||||
local milvus = import "stores/milvus.jsonnet";
|
|
||||||
|
|
||||||
milvus + {
|
|
||||||
|
|
||||||
"store-graph-embeddings" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("store-graph-embeddings")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"ge-write-milvus",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-t",
|
|
||||||
url.milvus,
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"store-graph-embeddings", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"query-graph-embeddings" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("query-graph-embeddings")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"ge-query-milvus",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-t",
|
|
||||||
url.milvus,
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"query-graph-embeddings", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"store-doc-embeddings" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("store-doc-embeddings")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"de-write-milvus",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-t",
|
|
||||||
url.milvus,
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"store-doc-embeddings", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"query-doc-embeddings" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("query-doc-embeddings")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"de-query-milvus",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-t",
|
|
||||||
url.milvus,
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"query-doc-embeddings", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["mistral-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"pdf-decoder" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("mistral-credentials")
|
|
||||||
.with_env_var("MISTRAL_TOKEN", "mistral-token");
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("mistral-ocr")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"pdf-ocr-mistral",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"mistral-ocr", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["mistral-rag-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"mistral-rag-max-output-tokens":: 4096,
|
|
||||||
"mistral-rag-temperature":: 0.0,
|
|
||||||
"mistral-rag-model":: "ministral-8b-latest",
|
|
||||||
|
|
||||||
"text-completion-rag" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("mistral-credentials")
|
|
||||||
.with_env_var("MISTRAL_TOKEN", "mistral-token");
|
|
||||||
|
|
||||||
local containerRag =
|
|
||||||
engine.container("text-completion-rag")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-mistral",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-x",
|
|
||||||
std.toString($["mistral-rag-max-output-tokens"]),
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["mistral-rag-temperature"],
|
|
||||||
"-m",
|
|
||||||
$["mistral-rag-model"],
|
|
||||||
"-i",
|
|
||||||
"non-persistent://tg/request/text-completion-rag",
|
|
||||||
"-o",
|
|
||||||
"non-persistent://tg/response/text-completion-rag",
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSetRag,
|
|
||||||
serviceRag,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["mistral-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"mistral-max-output-tokens":: 4096,
|
|
||||||
"mistral-temperature":: 0.0,
|
|
||||||
"mistral-model":: "ministral-8b-latest",
|
|
||||||
|
|
||||||
"text-completion" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("mistral-credentials")
|
|
||||||
.with_env_var("MISTRAL_TOKEN", "mistral-token");
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("text-completion")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-mistral",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-x",
|
|
||||||
std.toString($["mistral-max-output-tokens"]),
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["mistral-temperature"],
|
|
||||||
"-m",
|
|
||||||
$["mistral-model"],
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"text-completion", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,76 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local neo4j = import "stores/neo4j.jsonnet";
|
|
||||||
|
|
||||||
neo4j + {
|
|
||||||
|
|
||||||
"neo4j-url":: "bolt://neo4j:7687",
|
|
||||||
|
|
||||||
"store-triples" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("store-triples")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.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 ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"query-triples" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("query-triples")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.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 ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
"pdf-decoder" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("pdf-ocr")
|
|
||||||
.with_image(images.trustgraph_ocr)
|
|
||||||
.with_command([
|
|
||||||
"pdf-ocr",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
])
|
|
||||||
.with_limits("1.0", "512M")
|
|
||||||
.with_reservations("0.1", "512M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"pdf-ocr", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["ollama-rag-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"ollama-rag-model":: "gemma2:9b",
|
|
||||||
|
|
||||||
"text-completion-rag" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("ollama-credentials")
|
|
||||||
.with_env_var("OLLAMA_HOST", "ollama-host");
|
|
||||||
|
|
||||||
local containerRag =
|
|
||||||
engine.container("text-completion-rag")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-ollama",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-m",
|
|
||||||
$["ollama-rag-model"],
|
|
||||||
"-i",
|
|
||||||
"non-persistent://tg/request/text-completion-rag",
|
|
||||||
"-o",
|
|
||||||
"non-persistent://tg/response/text-completion-rag",
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSetRag,
|
|
||||||
serviceRag,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["ollama-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"ollama-model":: "gemma2:9b",
|
|
||||||
|
|
||||||
"text-completion" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("ollama-credentials")
|
|
||||||
.with_env_var("OLLAMA_HOST", "ollama-host");
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("text-completion")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-ollama",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-m",
|
|
||||||
$["ollama-model"],
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"text-completion", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["openai-rag-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"openai-rag-max-output-tokens":: 4096,
|
|
||||||
"openai-rag-temperature":: 0.0,
|
|
||||||
"openai-rag-model":: "GPT-3.5-Turbo",
|
|
||||||
|
|
||||||
"text-completion-rag" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("openai-credentials")
|
|
||||||
.with_env_var("OPENAI_TOKEN", "openai-token");
|
|
||||||
|
|
||||||
local containerRag =
|
|
||||||
engine.container("text-completion-rag")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-openai",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-x",
|
|
||||||
std.toString($["openai-rag-max-output-tokens"]),
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["openai-rag-temperature"],
|
|
||||||
"-m",
|
|
||||||
$["openai-rag-model"],
|
|
||||||
"-i",
|
|
||||||
"non-persistent://tg/request/text-completion-rag",
|
|
||||||
"-o",
|
|
||||||
"non-persistent://tg/response/text-completion-rag",
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSetRag = engine.containers(
|
|
||||||
"text-completion-rag", [ containerRag ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local serviceRag =
|
|
||||||
engine.internalService(containerSetRag)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSetRag,
|
|
||||||
serviceRag,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["openai-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"openai-max-output-tokens":: 4096,
|
|
||||||
"openai-temperature":: 0.0,
|
|
||||||
"openai-model":: "GPT-3.5-Turbo",
|
|
||||||
|
|
||||||
"text-completion" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("openai-credentials")
|
|
||||||
.with_env_var("OPENAI_TOKEN", "openai-token")
|
|
||||||
.with_env_var("OPENAI_BASE_URL", "openai-url");
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("text-completion")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-openai",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-x",
|
|
||||||
std.toString($["openai-max-output-tokens"]),
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["openai-temperature"],
|
|
||||||
"-m",
|
|
||||||
$["openai-model"],
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"text-completion", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,153 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local cassandra_hosts = "cassandra";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
"pinecone-cloud":: "aws",
|
|
||||||
"pinecone-region":: "us-east-1",
|
|
||||||
|
|
||||||
"store-graph-embeddings" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("pinecone-api-key")
|
|
||||||
.with_env_var("PINECONE_API_KEY", "pinecone-api-key");
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("store-graph-embeddings")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"ge-write-pinecone",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"store-graph-embeddings", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"query-graph-embeddings" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("pinecone-api-key")
|
|
||||||
.with_env_var("PINECONE_API_KEY", "pinecone-api-key");
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("query-graph-embeddings")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"ge-query-pinecone",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"query-graph-embeddings", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"store-doc-embeddings" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("pinecone-api-key")
|
|
||||||
.with_env_var("PINECONE_API_KEY", "pinecone-api-key");
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("store-doc-embeddings")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"de-write-pinecone",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"store-doc-embeddings", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"query-doc-embeddings" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("pinecone-api-key")
|
|
||||||
.with_env_var("PINECONE_API_KEY", "pinecone-api-key");
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("query-doc-embeddings")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"de-query-pinecone",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"query-doc-embeddings", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
local default_prompts = import "prompts/default-prompts.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
if (key == "system-template") then
|
|
||||||
self + {
|
|
||||||
prompts +:: {
|
|
||||||
"system-template": value,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
self + {
|
|
||||||
prompts +:: {
|
|
||||||
templates +:: {
|
|
||||||
[key] +:: {
|
|
||||||
prompt: value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
} + default_prompts
|
|
||||||
|
|
||||||
|
|
@ -1,125 +0,0 @@
|
||||||
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";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
prompts:: default_prompts,
|
|
||||||
|
|
||||||
local prompt_template_args = [ "--prompt" ] + [
|
|
||||||
p.key + "=" + p.value.prompt,
|
|
||||||
for p in std.objectKeysValuesAll($.prompts.templates)
|
|
||||||
],
|
|
||||||
|
|
||||||
local prompt_response_type_args = [ "--prompt-response-type" ] + [
|
|
||||||
p.key + "=" + p.value["response-type"],
|
|
||||||
for p in std.objectKeysValuesAll($.prompts.templates)
|
|
||||||
if std.objectHas(p.value, "response-type")
|
|
||||||
],
|
|
||||||
|
|
||||||
local prompt_schema_args = [ "--prompt-schema" ] + [
|
|
||||||
(
|
|
||||||
p.key + "=" +
|
|
||||||
std.manifestJsonMinified(p.value["schema"])
|
|
||||||
)
|
|
||||||
for p in std.objectKeysValuesAll($.prompts.templates)
|
|
||||||
if std.objectHas(p.value, "schema")
|
|
||||||
],
|
|
||||||
|
|
||||||
local prompt_term_args = [ "--prompt-term" ] + [
|
|
||||||
p.key + "=" + t.key + ":" + t.value
|
|
||||||
for p in std.objectKeysValuesAll($.prompts.templates)
|
|
||||||
if std.objectHas(p.value, "terms")
|
|
||||||
for t in std.objectKeysValuesAll(p.value.terms)
|
|
||||||
],
|
|
||||||
|
|
||||||
local prompt_args = prompt_template_args + prompt_response_type_args +
|
|
||||||
prompt_schema_args + prompt_term_args,
|
|
||||||
|
|
||||||
"prompt" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("prompt")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.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",
|
|
||||||
|
|
||||||
"--system-prompt",
|
|
||||||
$["prompts"]["system-template"],
|
|
||||||
|
|
||||||
] + prompt_args
|
|
||||||
)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"prompt", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"prompt-rag" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("prompt-rag")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"prompt-template",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-i",
|
|
||||||
"non-persistent://tg/request/prompt-rag",
|
|
||||||
"-o",
|
|
||||||
"non-persistent://tg/response/prompt-rag",
|
|
||||||
"--text-completion-request-queue",
|
|
||||||
"non-persistent://tg/request/text-completion-rag",
|
|
||||||
"--text-completion-response-queue",
|
|
||||||
"non-persistent://tg/response/text-completion-rag",
|
|
||||||
|
|
||||||
"--system-prompt",
|
|
||||||
$["prompts"]["system-template"],
|
|
||||||
|
|
||||||
] + prompt_args
|
|
||||||
)
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"prompt-rag", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + default_prompts
|
|
||||||
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
"pulsar" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
// FIXME: Should persist something?
|
|
||||||
// local volume = engine.volume(...)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("pulsar")
|
|
||||||
.with_image(images.pulsar_manager)
|
|
||||||
.with_environment({
|
|
||||||
SPRING_CONFIGURATION_FILE: "/pulsar-manager/pulsar-manager/application.properties",
|
|
||||||
})
|
|
||||||
.with_limits("0.5", "1.4G")
|
|
||||||
.with_reservations("0.1", "1.4G")
|
|
||||||
.with_port(9527, 9527, "api")
|
|
||||||
.with_port(7750, 7750, "api2");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"pulsar", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.service(containerSet)
|
|
||||||
.with_port(9527, 9527, "api")
|
|
||||||
.with_port(7750, 7750, "api2);
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,191 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
|
|
||||||
// This is a Pulsar configuration. Non-standalone mode so we deploy
|
|
||||||
// individual components: bookkeeper, broker and zookeeper.
|
|
||||||
//
|
|
||||||
// This also deploys the TrustGraph 'admin' container which initialises
|
|
||||||
// TrustGraph-specific namespaces etc.
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
"pulsar" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
// Zookeeper volume
|
|
||||||
local zkVolume = engine.volume("zookeeper").with_size("1G");
|
|
||||||
|
|
||||||
// Zookeeper container
|
|
||||||
local zkContainer =
|
|
||||||
engine.container("zookeeper")
|
|
||||||
.with_image(images.pulsar)
|
|
||||||
.with_command([
|
|
||||||
"bash",
|
|
||||||
"-c",
|
|
||||||
"bin/apply-config-from-env.py conf/zookeeper.conf && bin/generate-zookeeper-config.sh conf/zookeeper.conf && exec bin/pulsar zookeeper"
|
|
||||||
])
|
|
||||||
.with_limits("1", "400M")
|
|
||||||
.with_reservations("0.05", "400M")
|
|
||||||
.with_user("0:1000")
|
|
||||||
.with_volume_mount(zkVolume, "/pulsar/data/zookeeper")
|
|
||||||
.with_environment({
|
|
||||||
"metadataStoreUrl": "zk:zookeeper:2181",
|
|
||||||
"PULSAR_MEM": "-Xms256m -Xmx256m -XX:MaxDirectMemorySize=256m",
|
|
||||||
})
|
|
||||||
.with_port(2181, 2181, "zookeeper")
|
|
||||||
.with_port(2888, 2888, "zookeeper2")
|
|
||||||
.with_port(3888, 3888, "zookeeper3");
|
|
||||||
|
|
||||||
// Pulsar cluster init container
|
|
||||||
local initContainer =
|
|
||||||
engine.container("pulsar-init")
|
|
||||||
.with_image(images.pulsar)
|
|
||||||
.with_command([
|
|
||||||
"bash",
|
|
||||||
"-c",
|
|
||||||
"sleep 10 && bin/pulsar initialize-cluster-metadata --cluster cluster-a --zookeeper zookeeper:2181 --configuration-store zookeeper:2181 --web-service-url http://pulsar:8080 --broker-service-url pulsar://pulsar:6650",
|
|
||||||
])
|
|
||||||
.with_limits("1", "512M")
|
|
||||||
.with_reservations("0.05", "512M")
|
|
||||||
.with_environment({
|
|
||||||
"PULSAR_MEM": "-Xms256m -Xmx256m -XX:MaxDirectMemorySize=256m",
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// Bookkeeper volume
|
|
||||||
local bookieVolume = engine.volume("bookie").with_size("20G");
|
|
||||||
|
|
||||||
// Bookkeeper container
|
|
||||||
local bookieContainer =
|
|
||||||
engine.container("bookie")
|
|
||||||
.with_image(images.pulsar)
|
|
||||||
.with_command([
|
|
||||||
"bash",
|
|
||||||
"-c",
|
|
||||||
"bin/apply-config-from-env.py conf/bookkeeper.conf && exec bin/pulsar bookie"
|
|
||||||
// false ^ causes this to be a 'failure' exit.
|
|
||||||
])
|
|
||||||
.with_limits("1", "800M")
|
|
||||||
.with_reservations("0.1", "800M")
|
|
||||||
.with_user("0:1000")
|
|
||||||
.with_volume_mount(bookieVolume, "/pulsar/data/bookkeeper")
|
|
||||||
.with_environment({
|
|
||||||
"clusterName": "cluster-a",
|
|
||||||
"zkServers": "zookeeper:2181",
|
|
||||||
"bookieId": "bookie",
|
|
||||||
"metadataStoreUri": "metadata-store:zk:zookeeper:2181",
|
|
||||||
"advertisedAddress": "bookie",
|
|
||||||
"BOOKIE_MEM": "-Xms512m -Xmx512m -XX:MaxDirectMemorySize=256m",
|
|
||||||
})
|
|
||||||
.with_port(3181, 3181, "bookie");
|
|
||||||
|
|
||||||
// Pulsar broker, stateless (uses ZK and Bookkeeper for state)
|
|
||||||
local brokerContainer =
|
|
||||||
engine.container("pulsar")
|
|
||||||
.with_image(images.pulsar)
|
|
||||||
.with_command([
|
|
||||||
"bash",
|
|
||||||
"-c",
|
|
||||||
"bin/apply-config-from-env.py conf/broker.conf && exec bin/pulsar broker"
|
|
||||||
])
|
|
||||||
.with_limits("1", "800M")
|
|
||||||
.with_reservations("0.1", "800M")
|
|
||||||
.with_environment({
|
|
||||||
"metadataStoreUrl": "zk:zookeeper:2181",
|
|
||||||
"zookeeperServers": "zookeeper:2181",
|
|
||||||
"clusterName": "cluster-a",
|
|
||||||
"managedLedgerDefaultEnsembleSize": "1",
|
|
||||||
"managedLedgerDefaultWriteQuorum": "1",
|
|
||||||
"managedLedgerDefaultAckQuorum": "1",
|
|
||||||
"advertisedAddress": "pulsar",
|
|
||||||
"advertisedListeners": "external:pulsar://pulsar:6650,localhost:pulsar://localhost:6650",
|
|
||||||
"PULSAR_MEM": "-Xms512m -Xmx512m -XX:MaxDirectMemorySize=256m",
|
|
||||||
})
|
|
||||||
.with_port(6650, 6650, "pulsar")
|
|
||||||
.with_port(8080, 8080, "admin");
|
|
||||||
|
|
||||||
// Trustgraph Pulsar initialisation
|
|
||||||
local adminContainer =
|
|
||||||
engine.container("init-trustgraph")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"tg-init-pulsar",
|
|
||||||
"-p",
|
|
||||||
url.pulsar_admin,
|
|
||||||
])
|
|
||||||
.with_limits("1", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
// Container sets
|
|
||||||
local zkContainerSet = engine.containers(
|
|
||||||
"zookeeper",
|
|
||||||
[
|
|
||||||
zkContainer,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
local initContainerSet = engine.containers(
|
|
||||||
"init-pulsar",
|
|
||||||
[
|
|
||||||
initContainer,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
local bookieContainerSet = engine.containers(
|
|
||||||
"bookie",
|
|
||||||
[
|
|
||||||
bookieContainer,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
local brokerContainerSet = engine.containers(
|
|
||||||
"pulsar",
|
|
||||||
[
|
|
||||||
brokerContainer,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
local adminContainerSet = engine.containers(
|
|
||||||
"init-pulsar",
|
|
||||||
[
|
|
||||||
adminContainer
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
// Zookeeper service
|
|
||||||
local zkService =
|
|
||||||
engine.service(zkContainerSet)
|
|
||||||
.with_port(2181, 2181, "zookeeper")
|
|
||||||
.with_port(2888, 2888, "zookeeper2")
|
|
||||||
.with_port(3888, 3888, "zookeeper3");
|
|
||||||
|
|
||||||
// Bookkeeper service
|
|
||||||
local bookieService =
|
|
||||||
engine.service(bookieContainerSet)
|
|
||||||
.with_port(3181, 3181, "bookie");
|
|
||||||
|
|
||||||
// Pulsar broker service
|
|
||||||
local brokerService =
|
|
||||||
engine.service(brokerContainerSet)
|
|
||||||
.with_port(6650, 6650, "pulsar")
|
|
||||||
.with_port(8080, 8080, "admin");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
zkVolume,
|
|
||||||
bookieVolume,
|
|
||||||
zkContainerSet,
|
|
||||||
initContainerSet,
|
|
||||||
bookieContainerSet,
|
|
||||||
brokerContainerSet,
|
|
||||||
adminContainerSet,
|
|
||||||
zkService,
|
|
||||||
bookieService,
|
|
||||||
brokerService,
|
|
||||||
])
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,139 +0,0 @@
|
||||||
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 + {
|
|
||||||
|
|
||||||
"store-graph-embeddings" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("store-graph-embeddings")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"ge-write-qdrant",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-t",
|
|
||||||
url.qdrant,
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"store-graph-embeddings", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"query-graph-embeddings" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("query-graph-embeddings")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.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 ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"store-doc-embeddings" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("store-doc-embeddings")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.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 ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"query-doc-embeddings" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("query-doc-embeddings")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.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 ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8080, 8080, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,184 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
"api-gateway-port":: 8088,
|
|
||||||
"api-gateway-timeout":: 600,
|
|
||||||
|
|
||||||
"chunk-size":: 250,
|
|
||||||
"chunk-overlap":: 15,
|
|
||||||
|
|
||||||
"api-gateway" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local envSecrets = engine.envSecrets("gateway-secret")
|
|
||||||
.with_env_var("GATEWAY_SECRET", "gateway-secret");
|
|
||||||
|
|
||||||
local port = $["api-gateway-port"];
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("api-gateway")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"api-gateway",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"--timeout",
|
|
||||||
std.toString($["api-gateway-timeout"]),
|
|
||||||
"--port",
|
|
||||||
std.toString(port),
|
|
||||||
])
|
|
||||||
.with_env_var_secrets(envSecrets)
|
|
||||||
.with_limits("0.5", "256M")
|
|
||||||
.with_reservations("0.1", "256M")
|
|
||||||
.with_port(8000, 8000, "metrics")
|
|
||||||
.with_port(port, port, "api");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"api-gateway", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics")
|
|
||||||
.with_port(port, port, "api");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
envSecrets,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"chunker" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("chunker")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.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");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"chunker", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"pdf-decoder" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("pdf-decoder")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"pdf-decoder",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"pdf-decoder", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"metering" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("metering")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"metering",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"metering", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
"metering-rag" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("metering-rag")
|
|
||||||
.with_image(images.trustgraph_flow)
|
|
||||||
.with_command([
|
|
||||||
"metering",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-i",
|
|
||||||
"non-persistent://tg/response/text-completion-rag",
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "128M")
|
|
||||||
.with_reservations("0.1", "128M");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"metering-rag", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["vertexai-rag-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"vertexai-rag-model":: "gemini-1.0-pro-001",
|
|
||||||
"vertexai-rag-private-key":: "/vertexai/private.json",
|
|
||||||
"vertexai-rag-region":: "us-central1",
|
|
||||||
"vertexai-rag-max-output-tokens":: 4096,
|
|
||||||
"vertexai-rag-temperature":: 0.0,
|
|
||||||
|
|
||||||
"text-completion-rag" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local cfgVol = engine.secretVolume(
|
|
||||||
"vertexai-creds",
|
|
||||||
"./vertexai",
|
|
||||||
{
|
|
||||||
"private.json": importstr "vertexai/private.json",
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("text-completion-rag")
|
|
||||||
.with_image(images.trustgraph_vertexai)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-vertexai",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-k",
|
|
||||||
$["vertexai-rag-private-key"],
|
|
||||||
"-r",
|
|
||||||
$["vertexai-rag-region"],
|
|
||||||
"-x",
|
|
||||||
std.toString($["vertexai-rag-max-output-tokens"]),
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["vertexai-rag-temperature"],
|
|
||||||
"-m",
|
|
||||||
$["vertexai-rag-model"],
|
|
||||||
"-i",
|
|
||||||
"non-persistent://tg/request/text-completion-rag",
|
|
||||||
"-o",
|
|
||||||
"non-persistent://tg/response/text-completion-rag",
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "256M")
|
|
||||||
.with_reservations("0.1", "256M")
|
|
||||||
.with_volume_mount(cfgVol, "/vertexai");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"text-completion-rag", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
cfgVol,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
local base = import "base/base.jsonnet";
|
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
local url = import "values/url.jsonnet";
|
|
||||||
local prompts = import "prompts/mixtral.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
with:: function(key, value)
|
|
||||||
self + {
|
|
||||||
["vertexai-" + key]:: value,
|
|
||||||
},
|
|
||||||
|
|
||||||
"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,
|
|
||||||
|
|
||||||
"text-completion" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local cfgVol = engine.secretVolume(
|
|
||||||
"vertexai-creds",
|
|
||||||
"./vertexai",
|
|
||||||
{
|
|
||||||
"private.json": importstr "vertexai/private.json",
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("text-completion")
|
|
||||||
.with_image(images.trustgraph_vertexai)
|
|
||||||
.with_command([
|
|
||||||
"text-completion-vertexai",
|
|
||||||
"-p",
|
|
||||||
url.pulsar,
|
|
||||||
"-k",
|
|
||||||
$["vertexai-private-key"],
|
|
||||||
"-r",
|
|
||||||
$["vertexai-region"],
|
|
||||||
"-x",
|
|
||||||
std.toString($["vertexai-max-output-tokens"]),
|
|
||||||
"-t",
|
|
||||||
"%0.3f" % $["vertexai-temperature"],
|
|
||||||
"-m",
|
|
||||||
$["vertexai-model"],
|
|
||||||
])
|
|
||||||
.with_limits("0.5", "256M")
|
|
||||||
.with_reservations("0.1", "256M")
|
|
||||||
.with_volume_mount(cfgVol, "/vertexai");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"text-completion", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8000, 8000, "metrics");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
cfgVol,
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
} + prompts
|
|
||||||
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
local images = import "values/images.jsonnet";
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
"workbench-ui" +: {
|
|
||||||
|
|
||||||
create:: function(engine)
|
|
||||||
|
|
||||||
local container =
|
|
||||||
engine.container("workbench-ui")
|
|
||||||
.with_image(images["workbench-ui"])
|
|
||||||
.with_limits("0.1", "256M")
|
|
||||||
.with_reservations("0.1", "256M")
|
|
||||||
.with_port(8888, 8888, "ui");
|
|
||||||
|
|
||||||
local containerSet = engine.containers(
|
|
||||||
"workbench-ui", [ container ]
|
|
||||||
);
|
|
||||||
|
|
||||||
local service =
|
|
||||||
engine.internalService(containerSet)
|
|
||||||
.with_port(8888, 8888, "ui");
|
|
||||||
|
|
||||||
engine.resources([
|
|
||||||
containerSet,
|
|
||||||
service,
|
|
||||||
])
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
|
|
||||||
local engine = import "engine/aks-k8s.jsonnet";
|
|
||||||
local decode = import "util/decode-config.jsonnet";
|
|
||||||
local components = import "components.jsonnet";
|
|
||||||
|
|
||||||
// Import config
|
|
||||||
local config = import "config.json";
|
|
||||||
|
|
||||||
// Produce patterns from config
|
|
||||||
local patterns = decode(config);
|
|
||||||
|
|
||||||
// Extract resources usnig the engine
|
|
||||||
local resourceList = engine.package(patterns);
|
|
||||||
|
|
||||||
resourceList
|
|
||||||
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
|
|
||||||
local engine = import "engine/docker-compose.jsonnet";
|
|
||||||
local decode = import "util/decode-config.jsonnet";
|
|
||||||
local components = import "components.jsonnet";
|
|
||||||
|
|
||||||
// Import config
|
|
||||||
local config = import "config.json";
|
|
||||||
|
|
||||||
// Produce patterns from config
|
|
||||||
local patterns = decode(config);
|
|
||||||
|
|
||||||
// Extract resources usnig the engine
|
|
||||||
local resources = std.foldl(
|
|
||||||
function(state, p) state + p.create(engine),
|
|
||||||
std.objectValues(patterns),
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
|
|
||||||
resources
|
|
||||||
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
|
|
||||||
local engine = import "engine/gcp-k8s.jsonnet";
|
|
||||||
local decode = import "util/decode-config.jsonnet";
|
|
||||||
local components = import "components.jsonnet";
|
|
||||||
|
|
||||||
// Import config
|
|
||||||
local config = import "config.json";
|
|
||||||
|
|
||||||
// Produce patterns from config
|
|
||||||
local patterns = decode(config);
|
|
||||||
|
|
||||||
// Extract resources usnig the engine
|
|
||||||
local resourceList = engine.package(patterns);
|
|
||||||
|
|
||||||
resourceList
|
|
||||||
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
|
|
||||||
local engine = import "engine/minikube-k8s.jsonnet";
|
|
||||||
local decode = import "util/decode-config.jsonnet";
|
|
||||||
local components = import "components.jsonnet";
|
|
||||||
|
|
||||||
// Import config
|
|
||||||
local config = import "config.json";
|
|
||||||
|
|
||||||
// Produce patterns from config
|
|
||||||
local patterns = decode(config);
|
|
||||||
|
|
||||||
local ns = {
|
|
||||||
apiVersion: "v1",
|
|
||||||
kind: "Namespace",
|
|
||||||
metadata: {
|
|
||||||
name: "trustgraph",
|
|
||||||
},
|
|
||||||
"spec": {
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Extract resources using the engine
|
|
||||||
local resourceList = engine.package(patterns);
|
|
||||||
|
|
||||||
resourceList
|
|
||||||
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
|
|
||||||
local k8s = import "k8s.jsonnet";
|
|
||||||
|
|
||||||
local ns = {
|
|
||||||
apiVersion: "v1",
|
|
||||||
kind: "Namespace",
|
|
||||||
metadata: {
|
|
||||||
name: "trustgraph",
|
|
||||||
},
|
|
||||||
"spec": {
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
local sc = {
|
|
||||||
apiVersion: "storage.k8s.io/v1",
|
|
||||||
kind: "StorageClass",
|
|
||||||
metadata: {
|
|
||||||
name: "tg",
|
|
||||||
},
|
|
||||||
provisioner: "disk.csi.azure.com",
|
|
||||||
parameters: {
|
|
||||||
// Standard disks (spinning magnetic), Locally Redundant Storage
|
|
||||||
// Cheapest, basically
|
|
||||||
skuName: "Standard_LRS",
|
|
||||||
},
|
|
||||||
reclaimPolicy: "Delete",
|
|
||||||
volumeBindingMode: "WaitForFirstConsumer",
|
|
||||||
};
|
|
||||||
|
|
||||||
k8s + {
|
|
||||||
|
|
||||||
// Extract resources usnig the engine
|
|
||||||
package:: function(patterns)
|
|
||||||
local resources = [sc, ns] + std.flattenArrays([
|
|
||||||
p.create(self) for p in std.objectValues(patterns)
|
|
||||||
]);
|
|
||||||
local resourceList = {
|
|
||||||
apiVersion: "v1",
|
|
||||||
kind: "List",
|
|
||||||
items: [ns, sc] + resources,
|
|
||||||
};
|
|
||||||
resourceList
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,237 +0,0 @@
|
||||||
{
|
|
||||||
|
|
||||||
// Extract resources usnig the engine
|
|
||||||
package:: function(patterns)
|
|
||||||
std.foldl(
|
|
||||||
function(state, p) state + p.create(self),
|
|
||||||
std.objectValues(patterns),
|
|
||||||
{}
|
|
||||||
),
|
|
||||||
|
|
||||||
container:: function(name)
|
|
||||||
{
|
|
||||||
|
|
||||||
local container = self,
|
|
||||||
|
|
||||||
name: name,
|
|
||||||
limits: {},
|
|
||||||
reservations: {},
|
|
||||||
ports: [],
|
|
||||||
volumes: [],
|
|
||||||
environment: {},
|
|
||||||
|
|
||||||
with_image:: function(x) self + { image: x },
|
|
||||||
|
|
||||||
with_user:: function(x) self + { user: x },
|
|
||||||
|
|
||||||
with_command:: function(x) self + { command: x },
|
|
||||||
|
|
||||||
with_environment:: function(x) self + {
|
|
||||||
environment: super.environment + x,
|
|
||||||
},
|
|
||||||
|
|
||||||
with_limits:: function(c, m) self + { limits: { cpus: c, memory: m } },
|
|
||||||
|
|
||||||
with_reservations::
|
|
||||||
function(c, m) self + { reservations: { cpus: c, memory: m } },
|
|
||||||
|
|
||||||
with_volume_mount::
|
|
||||||
function(vol, mnt)
|
|
||||||
self + {
|
|
||||||
volumes: super.volumes + [{
|
|
||||||
volume: vol, mount: mnt
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
|
|
||||||
with_port::
|
|
||||||
function(src, dest, name) self + {
|
|
||||||
ports: super.ports + [
|
|
||||||
{ src: src, dest: dest, name : name }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
with_env_var_secrets::
|
|
||||||
function(vars)
|
|
||||||
std.foldl(
|
|
||||||
function(obj, x) obj.with_environment(
|
|
||||||
{ [x]: "${" + x + "}" }
|
|
||||||
),
|
|
||||||
vars.variables,
|
|
||||||
self
|
|
||||||
),
|
|
||||||
|
|
||||||
add:: function() {
|
|
||||||
services +: {
|
|
||||||
[container.name]: {
|
|
||||||
image: container.image,
|
|
||||||
deploy: {
|
|
||||||
resources: {
|
|
||||||
limits: container.limits,
|
|
||||||
reservations: container.reservations,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
restart: "on-failure:100",
|
|
||||||
} +
|
|
||||||
|
|
||||||
(if std.objectHas(container, "command") then
|
|
||||||
{ command: container.command }
|
|
||||||
else {}) +
|
|
||||||
|
|
||||||
(if std.objectHas(container, "user") then
|
|
||||||
{ user: container.user }
|
|
||||||
else {}) +
|
|
||||||
|
|
||||||
(if ! std.isEmpty(container.environment) then
|
|
||||||
{ environment: container.environment }
|
|
||||||
else {}) +
|
|
||||||
|
|
||||||
(if std.length(container.ports) > 0 then
|
|
||||||
{
|
|
||||||
ports: [
|
|
||||||
"%d:%d" % [port.src, port.dest]
|
|
||||||
for port in container.ports
|
|
||||||
]
|
|
||||||
}
|
|
||||||
else {}) +
|
|
||||||
|
|
||||||
(if std.length(container.volumes) > 0 then
|
|
||||||
{
|
|
||||||
volumes: [
|
|
||||||
"%s:%s" % [vol.volume.volid, vol.mount]
|
|
||||||
for vol in container.volumes
|
|
||||||
]
|
|
||||||
}
|
|
||||||
else {})
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
internalService:: function(containers)
|
|
||||||
{
|
|
||||||
|
|
||||||
local service = self,
|
|
||||||
|
|
||||||
name: containers.name,
|
|
||||||
|
|
||||||
with_port:: function(src, dest, name)
|
|
||||||
self + { port: [src, dest] },
|
|
||||||
|
|
||||||
add:: function() {
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
service:: function(containers)
|
|
||||||
{
|
|
||||||
|
|
||||||
local service = self,
|
|
||||||
|
|
||||||
name: containers.name,
|
|
||||||
|
|
||||||
with_port:: function(src, dest, name)
|
|
||||||
self + { port: [src, dest] },
|
|
||||||
|
|
||||||
add:: function() {
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
volume:: function(name)
|
|
||||||
{
|
|
||||||
|
|
||||||
local volume = self,
|
|
||||||
|
|
||||||
name: name,
|
|
||||||
|
|
||||||
volid:: name,
|
|
||||||
|
|
||||||
with_size:: function(size) self + { size: size },
|
|
||||||
|
|
||||||
add:: function() {
|
|
||||||
volumes +: {
|
|
||||||
[volume.name]: {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
configVolume:: function(name, dir, parts)
|
|
||||||
{
|
|
||||||
|
|
||||||
local volume = self,
|
|
||||||
|
|
||||||
name: dir,
|
|
||||||
|
|
||||||
volid:: "./" + dir,
|
|
||||||
|
|
||||||
with_size:: function(size) self + { size: size },
|
|
||||||
|
|
||||||
add:: function() {
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
secretVolume:: function(name, dir, parts)
|
|
||||||
{
|
|
||||||
|
|
||||||
local volume = self,
|
|
||||||
|
|
||||||
name: dir,
|
|
||||||
|
|
||||||
volid:: dir,
|
|
||||||
|
|
||||||
with_size:: function(size) self + { size: size },
|
|
||||||
|
|
||||||
add:: function() {
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
envSecrets:: function(name)
|
|
||||||
{
|
|
||||||
|
|
||||||
local volume = self,
|
|
||||||
|
|
||||||
name: name,
|
|
||||||
|
|
||||||
volid:: name,
|
|
||||||
|
|
||||||
variables:: [],
|
|
||||||
|
|
||||||
with_env_var::
|
|
||||||
function(name, key) self + {
|
|
||||||
variables: super.variables + [name],
|
|
||||||
},
|
|
||||||
|
|
||||||
add:: function() {
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
containers:: function(name, containers)
|
|
||||||
{
|
|
||||||
|
|
||||||
local cont = self,
|
|
||||||
|
|
||||||
name: name,
|
|
||||||
containers: containers,
|
|
||||||
|
|
||||||
add:: function() std.foldl(
|
|
||||||
function(state, c) state + c.add(),
|
|
||||||
cont.containers,
|
|
||||||
{}
|
|
||||||
),
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
resources:: function(res)
|
|
||||||
std.foldl(
|
|
||||||
function(state, c) state + c.add(),
|
|
||||||
res,
|
|
||||||
{}
|
|
||||||
),
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
|
|
||||||
local k8s = import "k8s.jsonnet";
|
|
||||||
|
|
||||||
local ns = {
|
|
||||||
apiVersion: "v1",
|
|
||||||
kind: "Namespace",
|
|
||||||
metadata: {
|
|
||||||
name: "trustgraph",
|
|
||||||
},
|
|
||||||
"spec": {
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
local sc = {
|
|
||||||
apiVersion: "storage.k8s.io/v1",
|
|
||||||
kind: "StorageClass",
|
|
||||||
metadata: {
|
|
||||||
name: "tg",
|
|
||||||
},
|
|
||||||
provisioner: "pd.csi.storage.gke.io",
|
|
||||||
parameters: {
|
|
||||||
type: "pd-balanced",
|
|
||||||
"csi.storage.k8s.io/fstype": "ext4",
|
|
||||||
},
|
|
||||||
reclaimPolicy: "Delete",
|
|
||||||
volumeBindingMode: "WaitForFirstConsumer",
|
|
||||||
};
|
|
||||||
|
|
||||||
k8s + {
|
|
||||||
|
|
||||||
// Extract resources usnig the engine
|
|
||||||
package:: function(patterns)
|
|
||||||
local resources = [sc, ns] + std.flattenArrays([
|
|
||||||
p.create(self) for p in std.objectValues(patterns)
|
|
||||||
]);
|
|
||||||
local resourceList = {
|
|
||||||
apiVersion: "v1",
|
|
||||||
kind: "List",
|
|
||||||
items: [ns, sc] + resources,
|
|
||||||
};
|
|
||||||
resourceList
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,358 +0,0 @@
|
||||||
{
|
|
||||||
|
|
||||||
container:: function(name)
|
|
||||||
{
|
|
||||||
|
|
||||||
local container = self,
|
|
||||||
|
|
||||||
name: name,
|
|
||||||
limits: {},
|
|
||||||
reservations: {},
|
|
||||||
ports: [],
|
|
||||||
volumes: [],
|
|
||||||
environment: [],
|
|
||||||
|
|
||||||
with_image:: function(x) self + { image: x },
|
|
||||||
|
|
||||||
with_user:: function(x) self + { user: x },
|
|
||||||
|
|
||||||
with_command:: function(x) self + { command: x },
|
|
||||||
|
|
||||||
with_environment:: function(x) self + {
|
|
||||||
environment: super.environment + [
|
|
||||||
{
|
|
||||||
name: v.key, value: v.value
|
|
||||||
}
|
|
||||||
for v in std.objectKeysValues(x)
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
with_limits:: function(c, m) self + { limits: { cpu: c, memory: m } },
|
|
||||||
|
|
||||||
with_reservations::
|
|
||||||
function(c, m) self + { reservations: { cpu: c, memory: m } },
|
|
||||||
|
|
||||||
with_volume_mount::
|
|
||||||
function(vol, mnt)
|
|
||||||
self + {
|
|
||||||
volumes: super.volumes + [{
|
|
||||||
volume: vol, mount: mnt
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
|
|
||||||
with_port::
|
|
||||||
function(src, dest, name) self + {
|
|
||||||
ports: super.ports + [
|
|
||||||
{ src: src, dest: dest, name : name }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
with_env_var_secrets::
|
|
||||||
function(vars)
|
|
||||||
std.foldl(
|
|
||||||
function(obj, x) obj + {
|
|
||||||
environment: super.environment + [{
|
|
||||||
name: x,
|
|
||||||
valueFrom: {
|
|
||||||
secretKeyRef: {
|
|
||||||
name: vars.name,
|
|
||||||
key: vars.keyMap[x],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
vars.variables,
|
|
||||||
self
|
|
||||||
),
|
|
||||||
|
|
||||||
add:: function() [
|
|
||||||
|
|
||||||
{
|
|
||||||
apiVersion: "apps/v1",
|
|
||||||
kind: "Deployment",
|
|
||||||
metadata: {
|
|
||||||
name: container.name,
|
|
||||||
namespace: "trustgraph",
|
|
||||||
labels: {
|
|
||||||
app: container.name
|
|
||||||
}
|
|
||||||
},
|
|
||||||
spec: {
|
|
||||||
replicas: 1,
|
|
||||||
selector: {
|
|
||||||
matchLabels: {
|
|
||||||
app: container.name,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
template: {
|
|
||||||
metadata: {
|
|
||||||
labels: {
|
|
||||||
app: container.name,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
spec: {
|
|
||||||
containers: [
|
|
||||||
{
|
|
||||||
name: container.name,
|
|
||||||
image: container.image,
|
|
||||||
|
|
||||||
// FIXME: Make everything run as
|
|
||||||
// root. Needed to get filesystems
|
|
||||||
// to be accessible. There's a
|
|
||||||
// better way of doing this?
|
|
||||||
securityContext: {
|
|
||||||
runAsUser: 0,
|
|
||||||
runAsGroup: 0,
|
|
||||||
},
|
|
||||||
|
|
||||||
resources: {
|
|
||||||
requests: container.reservations,
|
|
||||||
limits: container.limits
|
|
||||||
},
|
|
||||||
} + (
|
|
||||||
if std.length(container.ports) > 0 then
|
|
||||||
{
|
|
||||||
ports: [
|
|
||||||
{
|
|
||||||
hostPort: port.src,
|
|
||||||
containerPort: port.dest,
|
|
||||||
}
|
|
||||||
for port in container.ports
|
|
||||||
]
|
|
||||||
} else
|
|
||||||
{}) +
|
|
||||||
|
|
||||||
(if std.objectHas(container, "command") then
|
|
||||||
{ command: container.command }
|
|
||||||
else {}) +
|
|
||||||
|
|
||||||
(if ! std.isEmpty(container.environment) then
|
|
||||||
{
|
|
||||||
env: container.environment,
|
|
||||||
}
|
|
||||||
else {}) +
|
|
||||||
|
|
||||||
(if std.length(container.volumes) > 0 then
|
|
||||||
{
|
|
||||||
volumeMounts: [
|
|
||||||
{
|
|
||||||
mountPath: vol.mount,
|
|
||||||
name: vol.volume.name,
|
|
||||||
}
|
|
||||||
for vol in container.volumes
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{}
|
|
||||||
)
|
|
||||||
],
|
|
||||||
volumes: [
|
|
||||||
vol.volume.volRef()
|
|
||||||
for vol in container.volumes
|
|
||||||
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
} + {}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
// Just an alias
|
|
||||||
internalService:: self.service,
|
|
||||||
|
|
||||||
service:: function(containers)
|
|
||||||
{
|
|
||||||
|
|
||||||
local service = self,
|
|
||||||
|
|
||||||
name: containers.name,
|
|
||||||
|
|
||||||
ports: [],
|
|
||||||
|
|
||||||
with_port::
|
|
||||||
function(src, dest, name)
|
|
||||||
self + {
|
|
||||||
ports: super.ports + [
|
|
||||||
{ src: src, dest: dest, name: name }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
add:: function() [
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
apiVersion: "v1",
|
|
||||||
kind: "Service",
|
|
||||||
metadata: {
|
|
||||||
name: service.name,
|
|
||||||
namespace: "trustgraph",
|
|
||||||
},
|
|
||||||
spec: {
|
|
||||||
selector: {
|
|
||||||
app: service.name,
|
|
||||||
},
|
|
||||||
ports: [
|
|
||||||
{
|
|
||||||
port: port.src,
|
|
||||||
targetPort: port.dest,
|
|
||||||
name: port.name,
|
|
||||||
}
|
|
||||||
for port in service.ports
|
|
||||||
],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
volume:: function(name)
|
|
||||||
{
|
|
||||||
|
|
||||||
local volume = self,
|
|
||||||
|
|
||||||
name: name,
|
|
||||||
|
|
||||||
with_size:: function(size) self + { size: size },
|
|
||||||
|
|
||||||
add:: function() [
|
|
||||||
{
|
|
||||||
apiVersion: "v1",
|
|
||||||
kind: "PersistentVolumeClaim",
|
|
||||||
metadata: {
|
|
||||||
name: volume.name,
|
|
||||||
namespace: "trustgraph",
|
|
||||||
},
|
|
||||||
spec: {
|
|
||||||
storageClassName: "tg",
|
|
||||||
accessModes: [ "ReadWriteOnce" ],
|
|
||||||
resources: {
|
|
||||||
requests: {
|
|
||||||
storage: volume.size,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
volRef:: function() {
|
|
||||||
name: volume.name,
|
|
||||||
persistentVolumeClaim: { claimName: volume.name },
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
configVolume:: function(name, dir, parts)
|
|
||||||
{
|
|
||||||
|
|
||||||
local volume = self,
|
|
||||||
|
|
||||||
name: name,
|
|
||||||
|
|
||||||
with_size:: function(size) self + { size: size },
|
|
||||||
|
|
||||||
add:: function() [
|
|
||||||
{
|
|
||||||
apiVersion: "v1",
|
|
||||||
kind: "ConfigMap",
|
|
||||||
metadata: {
|
|
||||||
name: volume.name,
|
|
||||||
namespace: "trustgraph",
|
|
||||||
},
|
|
||||||
data: parts
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
|
|
||||||
volRef:: function() {
|
|
||||||
name: volume.name,
|
|
||||||
configMap: { name: volume.name },
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
secretVolume:: function(name, dir, parts)
|
|
||||||
{
|
|
||||||
|
|
||||||
local volume = self,
|
|
||||||
|
|
||||||
name: name,
|
|
||||||
|
|
||||||
with_size:: function(size) self + { size: size },
|
|
||||||
|
|
||||||
add:: function() [
|
|
||||||
{
|
|
||||||
apiVersion: "v1",
|
|
||||||
kind: "Secret",
|
|
||||||
metadata: {
|
|
||||||
name: volume.name,
|
|
||||||
namespace: "trustgraph",
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
[item.key]: std.base64(item.value)
|
|
||||||
for item in std.objectKeysValues(parts)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
volRef:: function() {
|
|
||||||
name: volume.name,
|
|
||||||
secret: { secretName: volume.name },
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
envSecrets:: function(name)
|
|
||||||
{
|
|
||||||
|
|
||||||
local volume = self,
|
|
||||||
|
|
||||||
name: name,
|
|
||||||
|
|
||||||
variables: [],
|
|
||||||
keyMap: {},
|
|
||||||
|
|
||||||
with_size:: function(size) self + { size: size },
|
|
||||||
|
|
||||||
add:: function() [
|
|
||||||
],
|
|
||||||
|
|
||||||
volRef:: function() {
|
|
||||||
name: volume.name,
|
|
||||||
secret: { secretName: volume.name },
|
|
||||||
},
|
|
||||||
|
|
||||||
with_env_var::
|
|
||||||
function(name, key) self + {
|
|
||||||
variables: super.variables + [name],
|
|
||||||
keyMap: super.keyMap + { [name]: key },
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
containers:: function(name, containers)
|
|
||||||
{
|
|
||||||
|
|
||||||
local cont = self,
|
|
||||||
|
|
||||||
name: name,
|
|
||||||
containers: containers,
|
|
||||||
|
|
||||||
add:: function() std.flattenArrays(
|
|
||||||
[ c.add() for c in cont.containers ]
|
|
||||||
),
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
resources:: function(res)
|
|
||||||
|
|
||||||
std.flattenArrays(
|
|
||||||
[ c.add() for c in res ]
|
|
||||||
),
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,115 +0,0 @@
|
||||||
|
|
||||||
local k8s = import "k8s.jsonnet";
|
|
||||||
|
|
||||||
local ns = {
|
|
||||||
apiVersion: "v1",
|
|
||||||
kind: "Namespace",
|
|
||||||
metadata: {
|
|
||||||
name: "trustgraph",
|
|
||||||
},
|
|
||||||
"spec": {
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
k8s + {
|
|
||||||
|
|
||||||
// Extract resources usnig the engine
|
|
||||||
package:: function(patterns)
|
|
||||||
local resources = [ns] + std.flattenArrays([
|
|
||||||
p.create(self) for p in std.objectValues(patterns)
|
|
||||||
]);
|
|
||||||
local resourceList = {
|
|
||||||
apiVersion: "v1",
|
|
||||||
kind: "List",
|
|
||||||
items: resources,
|
|
||||||
};
|
|
||||||
resourceList,
|
|
||||||
|
|
||||||
volume:: function(name)
|
|
||||||
{
|
|
||||||
local volume = self,
|
|
||||||
name: name,
|
|
||||||
with_size:: function(size) self + { size: size },
|
|
||||||
add:: function() [
|
|
||||||
{
|
|
||||||
apiVersion: "v1",
|
|
||||||
kind: "PersistentVolume",
|
|
||||||
metadata: {
|
|
||||||
name: volume.name,
|
|
||||||
},
|
|
||||||
spec: {
|
|
||||||
accessModes: [ "ReadWriteOnce" ],
|
|
||||||
capacity: {
|
|
||||||
storage: volume.size,
|
|
||||||
},
|
|
||||||
persistentVolumeReclaimPolicy: "Delete",
|
|
||||||
hostPath: {
|
|
||||||
path: "/data/pv-" + volume.name,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
apiVersion: "v1",
|
|
||||||
kind: "PersistentVolumeClaim",
|
|
||||||
metadata: {
|
|
||||||
name: volume.name,
|
|
||||||
namespace: "trustgraph",
|
|
||||||
},
|
|
||||||
spec: {
|
|
||||||
accessModes: [ "ReadWriteOnce" ],
|
|
||||||
resources: {
|
|
||||||
requests: {
|
|
||||||
storage: volume.size,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
volRef:: function() {
|
|
||||||
name: volume.name,
|
|
||||||
persistentVolumeClaim: { claimName: volume.name },
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
service:: function(containers)
|
|
||||||
{
|
|
||||||
local service = self,
|
|
||||||
name: containers.name,
|
|
||||||
ports: [],
|
|
||||||
with_port::
|
|
||||||
function(src, dest, name)
|
|
||||||
self + {
|
|
||||||
ports: super.ports + [
|
|
||||||
{ src: src, dest: dest, name: name }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
add:: function() [
|
|
||||||
{
|
|
||||||
apiVersion: "v1",
|
|
||||||
kind: "Service",
|
|
||||||
metadata: {
|
|
||||||
name: service.name,
|
|
||||||
namespace: "trustgraph",
|
|
||||||
},
|
|
||||||
spec: {
|
|
||||||
selector: {
|
|
||||||
app: service.name,
|
|
||||||
},
|
|
||||||
type: "LoadBalancer",
|
|
||||||
ports: [
|
|
||||||
{
|
|
||||||
port: port.src,
|
|
||||||
targetPort: port.dest,
|
|
||||||
name: port.name,
|
|
||||||
}
|
|
||||||
for port in service.ports
|
|
||||||
],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,235 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import _jsonnet as j
|
|
||||||
import json
|
|
||||||
import yaml
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import zipfile
|
|
||||||
import pathlib
|
|
||||||
from io import BytesIO
|
|
||||||
|
|
||||||
logger = logging.getLogger("generate")
|
|
||||||
logging.basicConfig(level=logging.INFO, format='%(message)s')
|
|
||||||
|
|
||||||
private_json = "Put your GCP private.json here"
|
|
||||||
|
|
||||||
class Generator:
|
|
||||||
|
|
||||||
def __init__(
|
|
||||||
self, config, templates="./templates/", resources="./resources",
|
|
||||||
version="0.0.0",
|
|
||||||
):
|
|
||||||
|
|
||||||
self.templates = pathlib.Path(templates)
|
|
||||||
self.resources = pathlib.Path(resources)
|
|
||||||
self.config = config
|
|
||||||
self.version = f"\"{version}\"".encode("utf-8")
|
|
||||||
|
|
||||||
def process(self, config):
|
|
||||||
|
|
||||||
res = j.evaluate_snippet("config", config, import_callback=self.load)
|
|
||||||
return json.loads(res)
|
|
||||||
|
|
||||||
def load(self, dir, filename):
|
|
||||||
|
|
||||||
logger.debug("Request jsonnet: %s %s", dir, filename)
|
|
||||||
|
|
||||||
if filename == "config.json" and dir == "":
|
|
||||||
path = os.path.join(".", dir, filename)
|
|
||||||
return str(path), self.config
|
|
||||||
|
|
||||||
if filename == "version.jsonnet" and dir == "templates/values/":
|
|
||||||
path = os.path.join(".", dir, filename)
|
|
||||||
return str(path), self.version
|
|
||||||
|
|
||||||
if dir:
|
|
||||||
candidates = [
|
|
||||||
self.templates.joinpath(dir, filename),
|
|
||||||
self.templates.joinpath(filename),
|
|
||||||
self.resources.joinpath(dir, filename),
|
|
||||||
self.resources.joinpath(filename),
|
|
||||||
pathlib.Path(dir).joinpath(filename),
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
candidates = [
|
|
||||||
self.templates.joinpath(filename),
|
|
||||||
pathlib.Path(dir).joinpath(filename),
|
|
||||||
pathlib.Path(filename),
|
|
||||||
]
|
|
||||||
|
|
||||||
try:
|
|
||||||
|
|
||||||
if filename == "vertexai/private.json":
|
|
||||||
|
|
||||||
return str(candidates[0]), private_json.encode("utf-8")
|
|
||||||
|
|
||||||
for c in candidates:
|
|
||||||
logger.debug("Try: %s", c)
|
|
||||||
|
|
||||||
if os.path.isfile(c):
|
|
||||||
with open(c, "rb") as f:
|
|
||||||
logger.debug("Loading: %s", c)
|
|
||||||
return str(c), f.read()
|
|
||||||
|
|
||||||
raise RuntimeError(
|
|
||||||
f"Could not load file={filename} dir={dir}"
|
|
||||||
)
|
|
||||||
|
|
||||||
except:
|
|
||||||
|
|
||||||
path = os.path.join(self.templates, filename)
|
|
||||||
logger.debug("Try: %s", path)
|
|
||||||
with open(path, "rb") as f:
|
|
||||||
logger.debug("Loaded: %s", path)
|
|
||||||
return str(path), f.read()
|
|
||||||
|
|
||||||
class Packager:
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.templates = pathlib.Path("./templates")
|
|
||||||
self.resources = pathlib.Path("./")
|
|
||||||
|
|
||||||
def process(
|
|
||||||
self, config, version="0.0.0", platform="docker-compose",
|
|
||||||
):
|
|
||||||
|
|
||||||
config = config.encode("utf-8")
|
|
||||||
|
|
||||||
gen = Generator(
|
|
||||||
config, templates=self.templates, resources=self.resources,
|
|
||||||
version=version
|
|
||||||
)
|
|
||||||
|
|
||||||
path = self.templates.joinpath(
|
|
||||||
f"config-to-{platform}.jsonnet"
|
|
||||||
)
|
|
||||||
wrapper = path.read_text()
|
|
||||||
|
|
||||||
processed = gen.process(wrapper)
|
|
||||||
|
|
||||||
return processed
|
|
||||||
|
|
||||||
def generate(self, config, version, platform):
|
|
||||||
|
|
||||||
logger.info(f"Generating for platform={platform} version={version}")
|
|
||||||
|
|
||||||
try:
|
|
||||||
|
|
||||||
if platform in set(["docker-compose", "podman-compose"]):
|
|
||||||
return self.generate_docker_compose(
|
|
||||||
"docker-compose", version, config
|
|
||||||
)
|
|
||||||
elif platform in set(["minikube-k8s", "gcp-k8s", "aks-k8s"]):
|
|
||||||
return self.generate_k8s(
|
|
||||||
platform, version, config
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
raise RuntimeError("Bad configuration")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logging.error(f"Exception: {e}")
|
|
||||||
raise e
|
|
||||||
|
|
||||||
def generate_docker_compose(self, platform, version, config):
|
|
||||||
|
|
||||||
processed = self.process(
|
|
||||||
config, platform=platform, version=version
|
|
||||||
)
|
|
||||||
|
|
||||||
y = yaml.dump(processed)
|
|
||||||
|
|
||||||
mem = BytesIO()
|
|
||||||
|
|
||||||
with zipfile.ZipFile(mem, mode='w') as out:
|
|
||||||
|
|
||||||
def output(name, content):
|
|
||||||
logger.info(f"Adding {name}...")
|
|
||||||
out.writestr(name, content)
|
|
||||||
|
|
||||||
fname = "docker-compose.yaml"
|
|
||||||
|
|
||||||
output(fname, y)
|
|
||||||
|
|
||||||
# Grafana config
|
|
||||||
path = self.resources.joinpath(
|
|
||||||
"grafana/dashboards/dashboard.json"
|
|
||||||
)
|
|
||||||
res = path.read_text()
|
|
||||||
output("grafana/dashboards/dashboard.json", res)
|
|
||||||
|
|
||||||
path = self.resources.joinpath(
|
|
||||||
"grafana/provisioning/dashboard.yml"
|
|
||||||
)
|
|
||||||
res = path.read_text()
|
|
||||||
output("grafana/provisioning/dashboard.yml", res)
|
|
||||||
|
|
||||||
path = self.resources.joinpath(
|
|
||||||
"grafana/provisioning/datasource.yml"
|
|
||||||
)
|
|
||||||
res = path.read_text()
|
|
||||||
output("grafana/provisioning/datasource.yml", res)
|
|
||||||
|
|
||||||
# Prometheus config
|
|
||||||
path = self.resources.joinpath(
|
|
||||||
"prometheus/prometheus.yml"
|
|
||||||
)
|
|
||||||
res = path.read_text()
|
|
||||||
output("prometheus/prometheus.yml", res)
|
|
||||||
|
|
||||||
logger.info("Generation complete.")
|
|
||||||
|
|
||||||
return mem.getvalue()
|
|
||||||
|
|
||||||
def generate_k8s(self, platform, version, config):
|
|
||||||
|
|
||||||
processed = self.process(
|
|
||||||
config, platform=platform, version=version
|
|
||||||
)
|
|
||||||
|
|
||||||
y = yaml.dump(processed)
|
|
||||||
|
|
||||||
mem = BytesIO()
|
|
||||||
|
|
||||||
with zipfile.ZipFile(mem, mode='w') as out:
|
|
||||||
|
|
||||||
def output(name, content):
|
|
||||||
logger.info(f"Adding {name}...")
|
|
||||||
out.writestr(name, content)
|
|
||||||
|
|
||||||
fname = "resources.yaml"
|
|
||||||
|
|
||||||
output(fname, y)
|
|
||||||
|
|
||||||
logger.info("Generation complete.")
|
|
||||||
|
|
||||||
return mem.getvalue()
|
|
||||||
|
|
||||||
def main():
|
|
||||||
|
|
||||||
if len(sys.argv) != 4:
|
|
||||||
print()
|
|
||||||
print("Usage:")
|
|
||||||
print(" generate <outfile> <version> <platform> < input.json")
|
|
||||||
print()
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
outfile = sys.argv[1]
|
|
||||||
version = sys.argv[2]
|
|
||||||
platform = sys.argv[3]
|
|
||||||
|
|
||||||
cfg = sys.stdin.read()
|
|
||||||
|
|
||||||
logger.info(f"Outputting to {outfile}...")
|
|
||||||
|
|
||||||
p = Packager()
|
|
||||||
resp = p.generate(cfg, version, platform)
|
|
||||||
|
|
||||||
with open(outfile, "wb") as f:
|
|
||||||
f.write(resp)
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
main()
|
|
||||||
|
|
||||||
|
|
@ -1,195 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import _jsonnet as j
|
|
||||||
import json
|
|
||||||
import yaml
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import zipfile
|
|
||||||
|
|
||||||
logger = logging.getLogger("generate")
|
|
||||||
logging.basicConfig(level=logging.INFO, format='%(message)s')
|
|
||||||
|
|
||||||
private_json = "Put your GCP private.json here"
|
|
||||||
|
|
||||||
class Generator:
|
|
||||||
|
|
||||||
def __init__(self, config, base="./templates/", version="0.0.0"):
|
|
||||||
|
|
||||||
self.jsonnet_base = base
|
|
||||||
self.config = config
|
|
||||||
self.version = f"\"{version}\"".encode("utf-8")
|
|
||||||
|
|
||||||
def process(self, config):
|
|
||||||
|
|
||||||
res = j.evaluate_snippet("config", config, import_callback=self.load)
|
|
||||||
return json.loads(res)
|
|
||||||
|
|
||||||
def load(self, dir, filename):
|
|
||||||
|
|
||||||
logger.debug("Request jsonnet: %s %s", dir, filename)
|
|
||||||
|
|
||||||
if filename == "config.json" and dir == "":
|
|
||||||
path = os.path.join(".", dir, filename)
|
|
||||||
return str(path), self.config
|
|
||||||
|
|
||||||
if filename == "version.jsonnet" and dir == "./templates/values/":
|
|
||||||
path = os.path.join(".", dir, filename)
|
|
||||||
return str(path), self.version
|
|
||||||
|
|
||||||
if dir:
|
|
||||||
candidates = [
|
|
||||||
os.path.join(".", dir, filename),
|
|
||||||
os.path.join(".", filename)
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
candidates = [
|
|
||||||
os.path.join(".", filename)
|
|
||||||
]
|
|
||||||
|
|
||||||
try:
|
|
||||||
|
|
||||||
if filename == "vertexai/private.json":
|
|
||||||
|
|
||||||
return candidates[0], private_json.encode("utf-8")
|
|
||||||
|
|
||||||
for c in candidates:
|
|
||||||
logger.debug("Try: %s", c)
|
|
||||||
|
|
||||||
if os.path.isfile(c):
|
|
||||||
with open(c, "rb") as f:
|
|
||||||
logger.debug("Loading: %s", c)
|
|
||||||
return str(c), f.read()
|
|
||||||
|
|
||||||
raise RuntimeError(
|
|
||||||
f"Could not load file={filename} dir={dir}"
|
|
||||||
)
|
|
||||||
|
|
||||||
except:
|
|
||||||
|
|
||||||
path = os.path.join(self.jsonnet_base, filename)
|
|
||||||
logger.debug("Try: %s", path)
|
|
||||||
with open(path, "rb") as f:
|
|
||||||
logger.debug("Loaded: %s", path)
|
|
||||||
return str(path), f.read()
|
|
||||||
|
|
||||||
def config_object(items):
|
|
||||||
|
|
||||||
return [
|
|
||||||
{ "name": v, "parameters": {} }
|
|
||||||
for v in items
|
|
||||||
]
|
|
||||||
|
|
||||||
def full_config_object(
|
|
||||||
vector_store="qdrant", embeddings="embeddings-hf",
|
|
||||||
graph_store="cassandra", llm="vertexai",
|
|
||||||
):
|
|
||||||
|
|
||||||
return config_object([
|
|
||||||
"triple-store-" + graph_store,
|
|
||||||
"pulsar",
|
|
||||||
"vector-store-" + vector_store,
|
|
||||||
embeddings,
|
|
||||||
"graph-rag",
|
|
||||||
"grafana",
|
|
||||||
"trustgraph-base",
|
|
||||||
llm,
|
|
||||||
llm + "-rag",
|
|
||||||
"workbench-ui",
|
|
||||||
"prompt-template",
|
|
||||||
"agent-manager-react",
|
|
||||||
])
|
|
||||||
|
|
||||||
def generate_config(
|
|
||||||
vector_store="qdrant", embeddings="embeddings-hf",
|
|
||||||
graph_store="cassandra", llm="vertexai",
|
|
||||||
platform="docker-compose",
|
|
||||||
version="0.0.0"
|
|
||||||
):
|
|
||||||
|
|
||||||
config = full_config_object(
|
|
||||||
vector_store=vector_store,
|
|
||||||
embeddings=embeddings,
|
|
||||||
graph_store=graph_store,
|
|
||||||
llm=llm,
|
|
||||||
)
|
|
||||||
|
|
||||||
with open(f"./templates/config-to-{platform}.jsonnet", "r") as f:
|
|
||||||
wrapper = f.read()
|
|
||||||
|
|
||||||
gen = Generator(json.dumps(config).encode("utf-8"), version=version)
|
|
||||||
|
|
||||||
processed = gen.process(wrapper)
|
|
||||||
|
|
||||||
y = yaml.dump(processed)
|
|
||||||
|
|
||||||
return y
|
|
||||||
|
|
||||||
def generate_all(output, version):
|
|
||||||
|
|
||||||
for platform in [
|
|
||||||
"docker-compose",
|
|
||||||
# "minikube-k8s", "gcp-k8s"
|
|
||||||
]:
|
|
||||||
for model in [
|
|
||||||
# "azure", "azure-openai", "bedrock", "claude", "cohere",
|
|
||||||
# "googleaistudio", "llamafile", "mistral",
|
|
||||||
"ollama",
|
|
||||||
# "openai", "vertexai",
|
|
||||||
]:
|
|
||||||
for graph in [
|
|
||||||
"cassandra",
|
|
||||||
# "neo4j", "falkordb"
|
|
||||||
]:
|
|
||||||
|
|
||||||
y = generate_config(
|
|
||||||
llm=model, graph_store=graph, platform=platform,
|
|
||||||
version=version
|
|
||||||
)
|
|
||||||
|
|
||||||
fname = f"{platform}/tg-{model}-{graph}.yaml"
|
|
||||||
|
|
||||||
output(fname, y)
|
|
||||||
|
|
||||||
|
|
||||||
if len(sys.argv) < 3:
|
|
||||||
raise RuntimeError("Usage: generate-all <file> <version>")
|
|
||||||
|
|
||||||
outfile = sys.argv[1]
|
|
||||||
version = sys.argv[2]
|
|
||||||
|
|
||||||
logger.info(f"Outputting to {outfile}...")
|
|
||||||
|
|
||||||
with zipfile.ZipFile(outfile, mode='w') as out:
|
|
||||||
|
|
||||||
def output(name, content):
|
|
||||||
logger.info(f"Adding {name}...")
|
|
||||||
out.writestr(name, content)
|
|
||||||
|
|
||||||
generate_all(output=output, version=version)
|
|
||||||
|
|
||||||
# Placeholder for the private.json file. Won't put actual credentials
|
|
||||||
# here.
|
|
||||||
output("docker-compose/vertexai/private.json", private_json)
|
|
||||||
|
|
||||||
# Grafana config
|
|
||||||
with open("grafana/dashboards/dashboard.json") as f:
|
|
||||||
output("docker-compose/grafana/dashboards/dashboard.json", f.read())
|
|
||||||
|
|
||||||
with open("grafana/provisioning/dashboard.yml") as f:
|
|
||||||
output("docker-compose/grafana/provisioning/dashboard.yml", f.read())
|
|
||||||
|
|
||||||
with open("grafana/provisioning/datasource.yml") as f:
|
|
||||||
output("docker-compose/grafana/provisioning/datasource.yml", f.read())
|
|
||||||
|
|
||||||
# Prometheus config
|
|
||||||
with open("prometheus/prometheus.yml") as f:
|
|
||||||
output("docker-compose/prometheus/prometheus.yml", f.read())
|
|
||||||
|
|
||||||
# A README
|
|
||||||
with open("templates/zip-readme.md") as f:
|
|
||||||
output("README.md", f.read())
|
|
||||||
|
|
||||||
logger.info("Output file written.")
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
|
|
||||||
local all = import "all-patterns.jsonnet";
|
|
||||||
|
|
||||||
std.foldl(
|
|
||||||
function(m, p) m + { [p.pattern.name]: p.module},
|
|
||||||
all,
|
|
||||||
{}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
|
|
||||||
local engine = import "engine/docker-compose.jsonnet";
|
|
||||||
local components = import "components.jsonnet";
|
|
||||||
|
|
||||||
// Options
|
|
||||||
local options = std.split(std.extVar("options"), ",");
|
|
||||||
|
|
||||||
// Produce patterns from config
|
|
||||||
local patterns = std.foldl(
|
|
||||||
function(state, p) state + components[p],
|
|
||||||
options,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
|
|
||||||
// Extract resources usnig the engine
|
|
||||||
local resources = engine.package(patterns);
|
|
||||||
|
|
||||||
resources
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
|
|
||||||
local engine = import "engine/docker-compose.jsonnet";
|
|
||||||
local components = import "components.jsonnet";
|
|
||||||
|
|
||||||
// Options
|
|
||||||
local options = std.split(std.extVar("options"), ",");
|
|
||||||
|
|
||||||
// Produce patterns from config
|
|
||||||
local patterns = std.foldl(
|
|
||||||
function(state, p) state + components[p],
|
|
||||||
options,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
|
|
||||||
// Extract resources usnig the engine
|
|
||||||
local resources = engine.package(patterns);
|
|
||||||
|
|
||||||
std.manifestYamlDoc(resources)
|
|
||||||
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
|
|
||||||
local engine = import "engine/minikube-k8s.jsonnet";
|
|
||||||
local components = import "components.jsonnet";
|
|
||||||
|
|
||||||
// Options
|
|
||||||
local options = std.split(std.extVar("options"), ",");
|
|
||||||
|
|
||||||
// Produce patterns from config
|
|
||||||
local patterns = std.foldl(
|
|
||||||
function(state, p) state + components[p],
|
|
||||||
options,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
|
|
||||||
// Extract resources usnig the engine
|
|
||||||
local resources = engine.package(patterns);
|
|
||||||
|
|
||||||
resources
|
|
||||||
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "document-rag",
|
|
||||||
icon: "🤝😂",
|
|
||||||
title: "Add DocumentRAG processing flow",
|
|
||||||
description: "This pattern adds DocumentRAG components for extracting and querying documents based on document embeddings. You should make sure a vector store is included in your plan.",
|
|
||||||
requires: ["pulsar", "trustgraph", "llm"],
|
|
||||||
features: ["document-rag"],
|
|
||||||
args: [
|
|
||||||
],
|
|
||||||
category: [ "processing" ],
|
|
||||||
},
|
|
||||||
module: "components/document-rag.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "embeddings-hf",
|
|
||||||
icon: "🤖💬",
|
|
||||||
title: "Add embeddings model which uses HuggingFace models",
|
|
||||||
description: "This pattern integrates an embeddings model based on HuggingFace sentence-transformer library.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["llm"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "embeddings-model",
|
|
||||||
label: "Embeddings model",
|
|
||||||
type: "select",
|
|
||||||
description: "Embeddings model for sentence analysis",
|
|
||||||
options: [
|
|
||||||
{ id: "all-MiniLM-L6-v2", description: "all-MiniLM-L6-v2" },
|
|
||||||
{ id: "mixedbread-ai/mxbai-embed-large-v1", description: "mxbai-embed-large-v1" },
|
|
||||||
],
|
|
||||||
default: "all-MiniLM-L6-v2",
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
category: [ "embeddings" ],
|
|
||||||
},
|
|
||||||
module: "components/embeddings-hf.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "embeddings-ollama",
|
|
||||||
icon: "🤖💬",
|
|
||||||
title: "Add embeddings model hosted on Ollama",
|
|
||||||
description: "This pattern integrates an embeddings model based on HuggingFace sentence-transformer library.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["llm"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "embeddings-model",
|
|
||||||
label: "Embeddings model",
|
|
||||||
type: "select",
|
|
||||||
description: "Embeddings model for sentence analysis",
|
|
||||||
options: [
|
|
||||||
{ id: "mxbai-embed-large", description: "mxbai-embed-large" },
|
|
||||||
],
|
|
||||||
default: "mxbai-embed-large",
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "ollama-url",
|
|
||||||
label: "URL",
|
|
||||||
type: "text",
|
|
||||||
width: 120,
|
|
||||||
description: "URL of the Ollama service",
|
|
||||||
default: "http://ollama:11434",
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
category: [ "embeddings" ],
|
|
||||||
},
|
|
||||||
module: "components/embeddings-hf.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "grafana",
|
|
||||||
icon: "📈🧯",
|
|
||||||
title: "Add Prometheus and Grafana for monitoring and dashboards",
|
|
||||||
description: "System monitoring and dashboarding using Grafana and Prometheus",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["prometheus", "grafana"],
|
|
||||||
args: [
|
|
||||||
],
|
|
||||||
category: ["monitoring"],
|
|
||||||
},
|
|
||||||
module: "components/grafana.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "graph-rag",
|
|
||||||
icon: "🤝😂",
|
|
||||||
title: "Add GraphRAG processing flow",
|
|
||||||
description: "This pattern adds GraphRAG components for extracting and querying graph edges. You should make sure a triple store and vector store are included in your plan.",
|
|
||||||
requires: ["pulsar", "trustgraph", "llm"],
|
|
||||||
features: ["graph-rag"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "graph-rag-entity-limit",
|
|
||||||
label: "GraphRAG entity query limit",
|
|
||||||
type: "integer",
|
|
||||||
description: "Limit on entities to fetch from vector store",
|
|
||||||
default: 50,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "graph-rag-triple-limit",
|
|
||||||
label: "GraphRAG triple query limit",
|
|
||||||
type: "integer",
|
|
||||||
description: "Limit on triples to fetch from triple store",
|
|
||||||
default: 30,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "graph-rag-max-subgraph-size",
|
|
||||||
label: "GraphRAG maximum subgraph size",
|
|
||||||
type: "integer",
|
|
||||||
description: "Limit on size of subgraph to present to text-completion model",
|
|
||||||
default: 3000,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
category: [ "processing" ],
|
|
||||||
},
|
|
||||||
module: "components/trustgraph.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "azure-openai",
|
|
||||||
icon: "🤖💬",
|
|
||||||
title: "Add Azure OpenAI LLM endpoint for text completion",
|
|
||||||
description: "This pattern integrates an Azure OpenAI LLM endpoint hosted in the Azure cloud for text completion operations. You need an Azure subscription to be able to use this service.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["llm"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "azure-openai-max-output-tokens",
|
|
||||||
label: "Maximum output tokens",
|
|
||||||
type: "integer",
|
|
||||||
description: "Limit on number tokens to generate",
|
|
||||||
default: 4096,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "azure-openai-temperature",
|
|
||||||
label: "Temperature",
|
|
||||||
type: "slider",
|
|
||||||
description: "Controlling predictability / creativity balance",
|
|
||||||
min: 0,
|
|
||||||
max: 1,
|
|
||||||
step: 0.05,
|
|
||||||
default: 0.5,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
category: [ "llm" ],
|
|
||||||
},
|
|
||||||
module: "components/azure.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "azure",
|
|
||||||
icon: "🤖💬",
|
|
||||||
title: "Add Azure LLM endpoint for text completion",
|
|
||||||
description: "This pattern integrates an Azure LLM endpoint hosted in the Azure cloud for text completion operations. You need an Azure subscription and to have an endpoint deployed to be able to use this service.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["llm"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "azure-max-output-tokens",
|
|
||||||
label: "Maximum output tokens",
|
|
||||||
type: "integer",
|
|
||||||
description: "Limit on number tokens to generate",
|
|
||||||
default: 4096,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "azure-temperature",
|
|
||||||
label: "Temperature",
|
|
||||||
type: "slider",
|
|
||||||
description: "Controlling predictability / creativity balance",
|
|
||||||
min: 0,
|
|
||||||
max: 1,
|
|
||||||
step: 0.05,
|
|
||||||
default: 0.5,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
category: [ "llm" ],
|
|
||||||
},
|
|
||||||
module: "components/azure.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "bedrock",
|
|
||||||
icon: "🤖💬",
|
|
||||||
title: "Add AWS Bedrock for text completion",
|
|
||||||
description: "This pattern integrates an AWS Bedrock LLM service hosted in the AWS cloud for text completion operations. You need an AWS cloud subscription and to have Bedrock configured to be able to use this service.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["llm"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "bedrock-max-output-tokens",
|
|
||||||
label: "Maximum output tokens",
|
|
||||||
type: "integer",
|
|
||||||
description: "Limit on number tokens to generate",
|
|
||||||
default: 4096,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "bedrock-temperature",
|
|
||||||
label: "Temperature",
|
|
||||||
type: "slider",
|
|
||||||
description: "Controlling predictability / creativity balance",
|
|
||||||
min: 0,
|
|
||||||
max: 1,
|
|
||||||
step: 0.05,
|
|
||||||
default: 0.5,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
category: [ "llm" ],
|
|
||||||
},
|
|
||||||
module: "components/bedrock.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "claude",
|
|
||||||
icon: "🤖💬",
|
|
||||||
title: "Add Anthropic Claude for text completion",
|
|
||||||
description: "This pattern integrates an Anthropic Claude LLM service for text completion operations. You need a Claude subscription to be able to use this service.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["llm"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "claude-max-output-tokens",
|
|
||||||
label: "Maximum output tokens",
|
|
||||||
type: "integer",
|
|
||||||
description: "Limit on number tokens to generate",
|
|
||||||
default: 4096,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "claude-temperature",
|
|
||||||
label: "Temperature",
|
|
||||||
type: "slider",
|
|
||||||
description: "Controlling predictability / creativity balance",
|
|
||||||
min: 0,
|
|
||||||
max: 1,
|
|
||||||
step: 0.05,
|
|
||||||
default: 0.5,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
category: [ "llm" ],
|
|
||||||
},
|
|
||||||
module: "components/claude.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "cohere",
|
|
||||||
icon: "🤖💬",
|
|
||||||
title: "Add Cohere LLM endpoint for text completion",
|
|
||||||
description: "This pattern integrates the Cohere LLM service for text completion operations. You need a Cohere subscription and API keys to be able to use this service.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["llm"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "cohere-max-output-tokens",
|
|
||||||
label: "Maximum output tokens",
|
|
||||||
type: "integer",
|
|
||||||
description: "Limit on number tokens to generate",
|
|
||||||
default: 4096,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "cohere-temperature",
|
|
||||||
label: "Temperature",
|
|
||||||
type: "slider",
|
|
||||||
description: "Controlling predictability / creativity balance",
|
|
||||||
min: 0,
|
|
||||||
max: 1,
|
|
||||||
step: 0.05,
|
|
||||||
default: 0.5,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
category: [ "llm" ],
|
|
||||||
},
|
|
||||||
module: "components/cohere.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "googleaistudio",
|
|
||||||
icon: "🤖💬",
|
|
||||||
title: "Add GoogleAIStudio for text completion",
|
|
||||||
description: "This pattern integrates a GoogleAIStudio LLM service for text completion operations. You need a GoogleAISTudio API key to be able to use this service.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["llm"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "googleaistudio-max-output-tokens",
|
|
||||||
label: "Maximum output tokens",
|
|
||||||
type: "integer",
|
|
||||||
description: "Limit on number tokens to generate",
|
|
||||||
default: 4096,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "googleaistudio-temperature",
|
|
||||||
label: "Temperature",
|
|
||||||
type: "slider",
|
|
||||||
description: "Controlling predictability / creativity balance",
|
|
||||||
min: 0,
|
|
||||||
max: 1,
|
|
||||||
step: 0.05,
|
|
||||||
default: 0.5,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
category: [ "llm" ],
|
|
||||||
},
|
|
||||||
module: "components/googleaistudio.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "llamafile",
|
|
||||||
icon: "🤖💬",
|
|
||||||
title: "Add Llamafile-invoked LLMs for text completion",
|
|
||||||
description: "This pattern integrates a Llamafile service for text completion operations. You need to have a running Llamafile implementation executing the necessary model in order to be able to use this service.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["llm"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "llamafile-max-output-tokens",
|
|
||||||
label: "Maximum output tokens",
|
|
||||||
type: "integer",
|
|
||||||
description: "Limit on number tokens to generate",
|
|
||||||
default: 4096,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "llamafile-temperature",
|
|
||||||
label: "Temperature",
|
|
||||||
type: "slider",
|
|
||||||
description: "Controlling predictability / creativity balance",
|
|
||||||
min: 0,
|
|
||||||
max: 1,
|
|
||||||
step: 0.05,
|
|
||||||
default: 0.5,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "llamafile-url",
|
|
||||||
label: "URL",
|
|
||||||
type: "text",
|
|
||||||
width: 120,
|
|
||||||
description: "URL of the Llamafile service",
|
|
||||||
default: "http://llamafile:8080",
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
category: [ "llm" ],
|
|
||||||
},
|
|
||||||
module: "components/llamafile.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "mistral",
|
|
||||||
icon: "🤖💬",
|
|
||||||
title: "Add Mistral LLM endpoint for text completion",
|
|
||||||
description: "This pattern integrates a Mistral LLM service for text completion operations. You need a Mistral subscription and have an API key to be able to use this service.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["llm"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "mistral-max-output-tokens",
|
|
||||||
label: "Maximum output tokens",
|
|
||||||
type: "integer",
|
|
||||||
description: "Limit on number tokens to generate",
|
|
||||||
default: 4096,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "mistral-temperature",
|
|
||||||
label: "Temperature",
|
|
||||||
type: "slider",
|
|
||||||
description: "Controlling predictability / creativity balance",
|
|
||||||
min: 0,
|
|
||||||
max: 1,
|
|
||||||
step: 0.05,
|
|
||||||
default: 0.5,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
category: [ "llm" ],
|
|
||||||
},
|
|
||||||
module: "components/mistral.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "ollama",
|
|
||||||
icon: "🤖💬",
|
|
||||||
title: "Add Ollama LLM for text completion",
|
|
||||||
description: "This pattern integrates an Ollama service for text completion operations. You need to have a running Ollama service with the necessary models added in order to be able to use this service.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["llm"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "ollama-max-output-tokens",
|
|
||||||
label: "Maximum output tokens",
|
|
||||||
type: "integer",
|
|
||||||
description: "Limit on number tokens to generate",
|
|
||||||
default: 4096,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "ollama-temperature",
|
|
||||||
label: "Temperature",
|
|
||||||
type: "slider",
|
|
||||||
description: "Controlling predictability / creativity balance",
|
|
||||||
min: 0,
|
|
||||||
max: 1,
|
|
||||||
step: 0.05,
|
|
||||||
default: 0.5,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "ollama-url",
|
|
||||||
label: "URL",
|
|
||||||
type: "text",
|
|
||||||
width: 120,
|
|
||||||
description: "URL of the Ollama service",
|
|
||||||
default: "http://ollama:11434",
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
category: [ "llm" ],
|
|
||||||
},
|
|
||||||
module: "components/ollama.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "openai",
|
|
||||||
icon: "🤖💬",
|
|
||||||
title: "Add OpenAI LLM endpoint for text completion",
|
|
||||||
description: "This pattern integrates an OpenAI LLM service for text completion operations. You need an OpenAI subscription and have an API key to be able to use this service.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["llm"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "openai-max-output-tokens",
|
|
||||||
label: "Maximum output tokens",
|
|
||||||
type: "integer",
|
|
||||||
description: "Limit on number tokens to generate",
|
|
||||||
default: 4096,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "openai-temperature",
|
|
||||||
label: "Temperature",
|
|
||||||
type: "slider",
|
|
||||||
description: "Controlling predictability / creativity balance",
|
|
||||||
min: 0,
|
|
||||||
max: 1,
|
|
||||||
step: 0.05,
|
|
||||||
default: 0.5,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
category: [ "llm" ],
|
|
||||||
},
|
|
||||||
module: "components/openai.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "vertexai",
|
|
||||||
icon: "🤖💬",
|
|
||||||
title: "Add Google Cloud VertexAI LLM for text completion",
|
|
||||||
description: "This pattern integrates a VertexAI endpoint hosted in Google Cloud for text completion operations. You need a GCP subscription and to have VertexAI enabled to be able to use this service.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["llm"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "vertexai-max-output-tokens",
|
|
||||||
label: "Maximum output tokens",
|
|
||||||
type: "integer",
|
|
||||||
description: "Limit on number tokens to generate",
|
|
||||||
default: 4096,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "vertexai-temperature",
|
|
||||||
label: "Temperature",
|
|
||||||
type: "slider",
|
|
||||||
description: "Controlling predictability / creativity balance",
|
|
||||||
min: 0,
|
|
||||||
max: 1,
|
|
||||||
step: 0.05,
|
|
||||||
default: 0.5,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
category: [ "llm" ],
|
|
||||||
},
|
|
||||||
module: "components/vertexai.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "override-recursive-chunker",
|
|
||||||
icon: "✂️🪚",
|
|
||||||
title: "Replace default chunker with recursive chunker",
|
|
||||||
description: "The default chunker used in Trustgraph core is a token-based chunker. This pattern replaces that with a recursive chunker, and allows ou to configure the chunking parameters.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: [],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "chunk-size",
|
|
||||||
type: "integer",
|
|
||||||
description: "Chunk size value",
|
|
||||||
default: 2000,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "chunk-overlap",
|
|
||||||
type: "integer",
|
|
||||||
description: "Overlap size value",
|
|
||||||
default: 100,
|
|
||||||
required: true,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
category: [ "chunking" ],
|
|
||||||
},
|
|
||||||
module: "components/cassandra.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "prompt-template-definitions",
|
|
||||||
icon: "📜️️💬",
|
|
||||||
title: "Override definition extraction prompt",
|
|
||||||
description: "This pattern overrides the default definition extraction LLM prompt allowing you to provide your own prompt.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["extract-definition-prompt"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "prompt-definition-template",
|
|
||||||
type: "multiline",
|
|
||||||
size: 2000,
|
|
||||||
rows: 10,
|
|
||||||
description: "Definition extraction prompt",
|
|
||||||
default: "<instructions>\nStudy the following text and derive definitions for any discovered entities.\nDo not provide definitions for entities whose definitions are incomplete\nor unknown.\nOutput relationships in JSON format as an arary of objects with fields:\n- entity: the name of the entity\n- definition: English text which defines the entity\n</instructions>\n\n<text>\n{text}\n</text>\n\n<requirements>\nYou will respond only with raw JSON format data. Do not provide\nexplanations. Do not use special characters in the abstract text. The\nabstract will be written as plain text. Do not add markdown formatting\nor headers or prefixes. Do not include null or unknown definitions.\n</requirements>",
|
|
||||||
required: true,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
category: [ "prompting" ],
|
|
||||||
},
|
|
||||||
module: "components/null.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "prompt-template-document-query",
|
|
||||||
icon: "📜️️💬",
|
|
||||||
title: "Override document query prompt",
|
|
||||||
description: "This pattern overrides the default document query prompt used for DocumentRAG allowing you to specify your own prompt.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["document-query-prompt"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "prompt-document-query-template",
|
|
||||||
type: "multiline",
|
|
||||||
size: 2000,
|
|
||||||
rows: 10,
|
|
||||||
description: "Document query prompt",
|
|
||||||
default: "Study the following context. Use only the information provided in the context in your response. Do not speculate if the answer is not found in the provided set of knowledge statements.\n\nHere is the context:\n{documents}\n\nUse only the provided knowledge statements to respond to the following:\n{query}\n",
|
|
||||||
required: true,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
category: [ "prompting" ],
|
|
||||||
},
|
|
||||||
module: "components/null.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "prompt-template-kq-query",
|
|
||||||
icon: "📜️️💬",
|
|
||||||
title: "Override knowledge query prompt",
|
|
||||||
description: "This pattern overrides the default knowledge query LLM prompt allowing you to provide your own prompt.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["kg-query-prompt"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "prompt-knowledge-query-template",
|
|
||||||
type: "multiline",
|
|
||||||
size: 2000,
|
|
||||||
rows: 10,
|
|
||||||
description: "Knowledge graph extraction prompt",
|
|
||||||
default: "Study the following set of knowledge statements. The statements are written in Cypher format that has been extracted from a knowledge graph. Use only the provided set of knowledge statements in your response. Do not speculate if the answer is not found in the provided set of knowledge statements.\n\nHere's the knowledge statements:\n{graph}\n\nUse only the provided knowledge statements to respond to the following:\n{query}\n",
|
|
||||||
required: true,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
category: [ "prompting" ],
|
|
||||||
},
|
|
||||||
module: "components/null.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "prompt-template-relationships",
|
|
||||||
icon: "📜️️💬",
|
|
||||||
title: "Override relationship extraction prompt",
|
|
||||||
description: "This pattern overrides the default relationship extraction LLM prompt allowing you to provide your own prompt.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["extract-relationship-prompt"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "prompt-relationship-template",
|
|
||||||
type: "multiline",
|
|
||||||
size: 2000,
|
|
||||||
rows: 10,
|
|
||||||
description: "Relationship extraction prompt",
|
|
||||||
default: "<instructions>\nStudy the following text and derive entity relationships. For each\nrelationship, derive the subject, predicate and object of the relationship.\nOutput relationships in JSON format as an arary of objects with fields:\n- subject: the subject of the relationship\n- predicate: the predicate\n- object: the object of the relationship\n- object-entity: false if the object is a simple data type: name, value or date. true if it is an entity.\n</instructions>\n\n<text>\n{text}\n</text>\n\n<requirements>\nYou will respond only with raw JSON format data. Do not provide\nexplanations. Do not use special characters in the abstract text. The\nabstract must be written as plain text. Do not add markdown formatting\nor headers or prefixes.\n</requirements>",
|
|
||||||
required: true,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
category: [ "prompting" ],
|
|
||||||
},
|
|
||||||
module: "components/null.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "prompt-template-rows-template",
|
|
||||||
icon: "📜️️💬",
|
|
||||||
title: "Override table/row extraction prompt",
|
|
||||||
description: "This pattern overrides the default table/row extraction prompt to be changed. This is used for DatabaseRAG pipelines.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["extract-rows-prompt"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "prompt-rows-template",
|
|
||||||
type: "multiline",
|
|
||||||
size: 2000,
|
|
||||||
rows: 10,
|
|
||||||
description: "Row data extraction prompt",
|
|
||||||
default: "<instructions>\nStudy the following text and derive objects which match the schema provided.\n\nYou must output an array of JSON objects for each object you discover\nwhich matches the schema. For each object, output a JSON object whose fields\ncarry the name field specified in the schema.\n</instructions>\n\n<schema>\n{schema}\n</schema>\n\n<text>\n{text}\n</text>\n\n<requirements>\nYou will respond only with raw JSON format data. Do not provide\nexplanations. Do not add markdown formatting or headers or prefixes.\n</requirements>",
|
|
||||||
required: true,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
category: [ "prompting" ],
|
|
||||||
},
|
|
||||||
module: "components/null.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "pulsar-manager",
|
|
||||||
icon: "🏻🛃",
|
|
||||||
title: "Add Pulsar Manager",
|
|
||||||
description: "Adds Pulsar Manager which provides a web interface to manage Pulsar. Pulsar Manager is a large container and deployment requiring over 1GB of RAM, so is not deployed by default. This is not a required component, it may be useful to help manage a large operational deployment.",
|
|
||||||
requires: ["pulsar"],
|
|
||||||
features: ["pulsar-manager"],
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
name: "initial-admin-password",
|
|
||||||
label: "Password",
|
|
||||||
type: "text",
|
|
||||||
width: 40,
|
|
||||||
description: "Admin password to apply at initialisation",
|
|
||||||
default: "pulsaradmin",
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
category: [ "foundation" ],
|
|
||||||
},
|
|
||||||
module: "components/pulsar.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "pulsar",
|
|
||||||
icon: "🌟☄️",
|
|
||||||
title: "Deploy foundation messaging fabric",
|
|
||||||
description: "Deploy Pulsar as the inter-process messaging fabric. Pulsar is a Cloud-native, distributed messaging and Streaming. Apache Pulsar is an open-source, distributed messaging and streaming platform built for the cloud. Trustgraph uses Pulsar to manage the message flow between all components.",
|
|
||||||
requires: [],
|
|
||||||
features: ["pulsar"],
|
|
||||||
args: [
|
|
||||||
],
|
|
||||||
category: [ "foundation" ],
|
|
||||||
},
|
|
||||||
module: "components/pulsar.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "triple-store-cassandra",
|
|
||||||
icon: "🖇️🙋♀️",
|
|
||||||
title: "Adds a Cassandra store configured to act as a triple store",
|
|
||||||
description: "GraphRAG processing needs a triple store. This pattern adds a Cassandra store, along with plumbing so that Cassandra is integrated with GraphRag indexing and querying.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["cassandra", "triple-store"],
|
|
||||||
args: [],
|
|
||||||
category: ["knowledge-graph"],
|
|
||||||
},
|
|
||||||
module: "components/cassandra.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "triple-store-falkordb",
|
|
||||||
icon: "🖇️🙋♀️",
|
|
||||||
title: "Adds a FalkorDB store configured to act as a triple store.",
|
|
||||||
description: "GraphRAG processing needs a triple store. This pattern adds a FalkorDB store, along with plumbing so that FalkorDB is integrated with GraphRag indexing and querying.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["falkordb", "triple-store"],
|
|
||||||
args: [],
|
|
||||||
category: [ "knowledge-graph" ],
|
|
||||||
},
|
|
||||||
module: "components/falkordb.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "triple-store-neo4j",
|
|
||||||
icon: "🖇️🙋♀️",
|
|
||||||
title: "Adds a Neo4j store configured to act as a triple store.",
|
|
||||||
description: "GraphRAG processing needs a triple store. This pattern adds a Neo4j store, along with plumbing so that Neo4j is integrated with GraphRag indexing and querying.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["neo4j", "triple-store"],
|
|
||||||
args: [],
|
|
||||||
category: [ "knowledge-graph" ],
|
|
||||||
},
|
|
||||||
module: "components/neo4j.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "trustgraph-base",
|
|
||||||
icon: "🤝😂",
|
|
||||||
title: "Add Trustgraph base processing flows",
|
|
||||||
description: "This pattern adds a core set of Trustgraph flows, including PDF ingest, chunking, embeddings, and knowledge graph extraction. You should also consider adding an LLM and at least one RAG processing flow.",
|
|
||||||
requires: ["pulsar"],
|
|
||||||
features: ["trustgraph"],
|
|
||||||
args: [
|
|
||||||
],
|
|
||||||
category: [ "foundation" ],
|
|
||||||
},
|
|
||||||
module: "components/trustgraph.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "vector-store-milvus",
|
|
||||||
icon: "❓🌐",
|
|
||||||
title: "Add Milvus, a vector embeddings store",
|
|
||||||
description: "The Trustgraph core does not include a vector store by default. This configuration pattern adds a simple Milvus store and integrates with embeddings handling.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["milvus", "vectordb"],
|
|
||||||
args: [
|
|
||||||
],
|
|
||||||
category: [ "vector-store" ],
|
|
||||||
},
|
|
||||||
module: "components/milvus.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
pattern: {
|
|
||||||
name: "vector-store-qdrant",
|
|
||||||
icon: "❓🌐",
|
|
||||||
title: "Adds Qdrant, a vector embeddings store",
|
|
||||||
description: "The Trustgraph core does not include a vector store by default. This configuration pattern adds a simple Qdrant store and integrates with embeddings handling.",
|
|
||||||
requires: ["pulsar", "trustgraph"],
|
|
||||||
features: ["qdrant", "vectordb"],
|
|
||||||
args: [
|
|
||||||
],
|
|
||||||
category: [ "vector-store" ],
|
|
||||||
},
|
|
||||||
module: "components/qdrant.jsonnet",
|
|
||||||
}
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
// For Cohere. Not currently overriding prompts
|
|
||||||
|
|
||||||
local prompts = import "default-prompts.jsonnet";
|
|
||||||
|
|
||||||
prompts + {
|
|
||||||
|
|
||||||
// "system-template":: "PROMPT GOES HERE.",
|
|
||||||
|
|
||||||
"templates" +:: {
|
|
||||||
|
|
||||||
"question" +:: {
|
|
||||||
// "prompt": "PROMPT GOES HERE",
|
|
||||||
},
|
|
||||||
|
|
||||||
"extract-definitions" +:: {
|
|
||||||
// "prompt": "PROMPT GOES HERE",
|
|
||||||
},
|
|
||||||
|
|
||||||
"extract-relationships" +:: {
|
|
||||||
// "prompt": "PROMPT GOES HERE",
|
|
||||||
},
|
|
||||||
|
|
||||||
"extract-topics" +:: {
|
|
||||||
// "prompt": "PROMPT GOES HERE",
|
|
||||||
},
|
|
||||||
|
|
||||||
"extract-rows" +:: {
|
|
||||||
// "prompt": "PROMPT GOES HERE",
|
|
||||||
},
|
|
||||||
|
|
||||||
"kg-prompt" +:: {
|
|
||||||
// "prompt": "PROMPT GOES HERE",
|
|
||||||
},
|
|
||||||
|
|
||||||
"document-prompt" +:: {
|
|
||||||
// "prompt": "PROMPT GOES HERE",
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,114 +0,0 @@
|
||||||
|
|
||||||
// Prompt templates. For tidy JSONNET use, don't change these templates
|
|
||||||
// here, but use over-rides in the prompt directory
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
"system-template":: "You are a helpful assistant.",
|
|
||||||
|
|
||||||
"templates":: {
|
|
||||||
|
|
||||||
"question":: {
|
|
||||||
"prompt": "{{question}}",
|
|
||||||
},
|
|
||||||
|
|
||||||
"extract-definitions":: {
|
|
||||||
"prompt": "<instructions>\nStudy the following text and derive definitions for any discovered entities.\nDo not provide definitions for entities whose definitions are incomplete\nor unknown.\nOutput relationships in JSON format as an arary of objects with fields:\n- entity: the name of the entity\n- definition: English text which defines the entity\n</instructions>\n\n<text>\n{{text}}\n</text>\n\n<requirements>\nYou will respond only with raw JSON format data. Do not provide\nexplanations. Do not use special characters in the abstract text. The\nabstract will be written as plain text. Do not add markdown formatting\nor headers or prefixes. Do not include null or unknown definitions.\n</requirements>",
|
|
||||||
"response-type": "json",
|
|
||||||
"schema": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"entity": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"definition": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"entity",
|
|
||||||
"definition"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"extract-relationships":: {
|
|
||||||
"prompt": "<instructions>\nStudy the following text and derive entity relationships. For each\nrelationship, derive the subject, predicate and object of the relationship.\nOutput relationships in JSON format as an arary of objects with fields:\n- subject: the subject of the relationship\n- predicate: the predicate\n- object: the object of the relationship\n- object-entity: false if the object is a simple data type: name, value or date. true if it is an entity.\n</instructions>\n\n<text>\n{{text}}\n</text>\n\n<requirements>\nYou will respond only with raw JSON format data. Do not provide\nexplanations. Do not use special characters in the abstract text. The\nabstract must be written as plain text. Do not add markdown formatting\nor headers or prefixes.\n</requirements>",
|
|
||||||
"response-type": "json",
|
|
||||||
"schema": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"subject": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"predicate": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"object": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"object-entity": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"subject",
|
|
||||||
"predicate",
|
|
||||||
"object",
|
|
||||||
"object-entity"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"extract-topics":: {
|
|
||||||
"prompt": "You are a helpful assistant that performs information extraction tasks for a provided text.\nRead the provided text. You will identify topics and their definitions in JSON.\n\nReading Instructions:\n- Ignore document formatting in the provided text.\n- Study the provided text carefully.\n\nHere is the text:\n{{text}}\n\nResponse Instructions: \n- Do not respond with special characters.\n- Return only topics that are concepts and unique to the provided text.\n- Respond only with well-formed JSON.\n- The JSON response shall be an array of objects with keys \"topic\" and \"definition\". \n- The JSON response shall use the following structure:\n\n```json\n[{\"topic\": string, \"definition\": string}]\n```\n\n- Do not write any additional text or explanations.",
|
|
||||||
"response-type": "json",
|
|
||||||
"schema": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"topic": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"definition": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"topic",
|
|
||||||
"definition"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"extract-rows":: {
|
|
||||||
"prompt": "<instructions>\nStudy the following text and derive objects which match the schema provided.\n\nYou must output an array of JSON objects for each object you discover\nwhich matches the schema. For each object, output a JSON object whose fields\ncarry the name field specified in the schema.\n</instructions>\n\n<schema>\n{{schema}}\n</schema>\n\n<text>\n{{text}}\n</text>\n\n<requirements>\nYou will respond only with raw JSON format data. Do not provide\nexplanations. Do not add markdown formatting or headers or prefixes.\n</requirements>",
|
|
||||||
"response-type": "json",
|
|
||||||
},
|
|
||||||
|
|
||||||
"kg-prompt":: {
|
|
||||||
"prompt": "Study the following set of knowledge statements. The statements are written in Cypher format that has been extracted from a knowledge graph. Use only the provided set of knowledge statements in your response. Do not speculate if the answer is not found in the provided set of knowledge statements.\n\nHere's the knowledge statements:\n{% for edge in knowledge %}({{edge.s}})-[{{edge.p}}]->({{edge.o}})\n{%endfor%}\n\nUse only the provided knowledge statements to respond to the following:\n{{query}}\n",
|
|
||||||
"response-type": "text",
|
|
||||||
},
|
|
||||||
|
|
||||||
"document-prompt":: {
|
|
||||||
"prompt": "Study the following context. Use only the information provided in the context in your response. Do not speculate if the answer is not found in the provided set of knowledge statements.\n\nHere is the context:\n{{documents}}\n\nUse only the provided knowledge statements to respond to the following:\n{{query}}\n",
|
|
||||||
"response-type": "text",
|
|
||||||
},
|
|
||||||
|
|
||||||
"agent-react":: {
|
|
||||||
"prompt": "Answer the following questions as best you can. You have\naccess to the following functions:\n\n{% for tool in tools %}{\n \"function\": \"{{ tool.name }}\",\n \"description\": \"{{ tool.description }}\",\n \"arguments\": [\n{% for arg in tool.arguments %} {\n \"name\": \"{{ arg.name }}\",\n \"type\": \"{{ arg.type }}\",\n \"description\": \"{{ arg.description }}\",\n }\n{% endfor %}\n ]\n}\n{% endfor %}\n\nYou can either choose to call a function to get more information, or\nreturn a final answer.\n \nTo call a function, respond with a JSON object of the following format:\n\n{\n \"thought\": \"your thought about what to do\",\n \"action\": \"the action to take, should be one of [{{tool_names}}]\",\n \"arguments\": {\n \"argument1\": \"argument_value\",\n \"argument2\": \"argument_value\"\n }\n}\n\nTo provide a final answer, response a JSON object of the following format:\n\n{\n \"thought\": \"I now know the final answer\",\n \"final-answer\": \"the final answer to the original input question\"\n}\n\nPrevious steps are included in the input. Each step has the following\nformat in your output:\n\n{\n \"thought\": \"your thought about what to do\",\n \"action\": \"the action taken\",\n \"arguments\": {\n \"argument1\": action argument,\n \"argument2\": action argument2\n },\n \"observation\": \"the result of the action\",\n}\n\nRespond by describing either one single thought/action/arguments or\nthe final-answer. Pause after providing one action or final-answer.\n\n{% if context %}Additional context has been provided:\n{{context}}{% endif %}\n\nQuestion: {{question}}\n\nInput:\n \n{% for h in history %}\n{\n \"action\": \"{{h.action}}\",\n \"arguments\": [\n{% for k, v in h.arguments.items() %} {\n \"{{k}}\": \"{{v}}\",\n{%endfor%} }\n ],\n \"observation\": \"{{h.observation}}\"\n}\n{% endfor %}",
|
|
||||||
"response-type": "json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue