mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-06-07 05:45:13 +02:00
Feature/rag metering (#75)
* Add metering-rag for RAG token metrics * Make metering executable * Add metering-rag to Prom metrics * Metricate the right queue * Update templates to include metering-rag
This commit is contained in:
parent
6d57b7a6f3
commit
90127dfecb
19 changed files with 305 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ scrape_configs:
|
||||||
- 'kg-extract-topics:8000'
|
- 'kg-extract-topics:8000'
|
||||||
- 'kg-extract-relationships:8000'
|
- 'kg-extract-relationships:8000'
|
||||||
- 'metering:8000'
|
- 'metering:8000'
|
||||||
|
- 'metering-rag:8000'
|
||||||
- 'store-graph-embeddings:8000'
|
- 'store-graph-embeddings:8000'
|
||||||
- 'store-triples:8000'
|
- 'store-triples:8000'
|
||||||
- 'text-completion:8000'
|
- 'text-completion:8000'
|
||||||
|
|
|
||||||
0
scripts/metering
Normal file → Executable file
0
scripts/metering
Normal file → Executable file
|
|
@ -132,5 +132,37 @@ local prompt = import "prompt-template.jsonnet";
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"metering-rag" +: {
|
||||||
|
|
||||||
|
create:: function(engine)
|
||||||
|
|
||||||
|
local container =
|
||||||
|
engine.container("metering-rag")
|
||||||
|
.with_image(images.trustgraph)
|
||||||
|
.with_command([
|
||||||
|
"metering",
|
||||||
|
"-p",
|
||||||
|
url.pulsar,
|
||||||
|
"-i",
|
||||||
|
"non-persistent://tg/response/text-completion-rag-response",
|
||||||
|
])
|
||||||
|
.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,
|
||||||
|
])
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
} + prompt
|
} + prompt
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,23 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
metering-rag:
|
||||||
|
command:
|
||||||
|
- metering
|
||||||
|
- -p
|
||||||
|
- pulsar://pulsar:6650
|
||||||
|
- -i
|
||||||
|
- non-persistent://tg/response/text-completion-rag-response
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 128M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.1'
|
||||||
|
memory: 128M
|
||||||
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
|
restart: on-failure:100
|
||||||
pdf-decoder:
|
pdf-decoder:
|
||||||
command:
|
command:
|
||||||
- pdf-decoder
|
- pdf-decoder
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,23 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
metering-rag:
|
||||||
|
command:
|
||||||
|
- metering
|
||||||
|
- -p
|
||||||
|
- pulsar://pulsar:6650
|
||||||
|
- -i
|
||||||
|
- non-persistent://tg/response/text-completion-rag-response
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 128M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.1'
|
||||||
|
memory: 128M
|
||||||
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
|
restart: on-failure:100
|
||||||
neo4j:
|
neo4j:
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,23 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
metering-rag:
|
||||||
|
command:
|
||||||
|
- metering
|
||||||
|
- -p
|
||||||
|
- pulsar://pulsar:6650
|
||||||
|
- -i
|
||||||
|
- non-persistent://tg/response/text-completion-rag-response
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 128M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.1'
|
||||||
|
memory: 128M
|
||||||
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
|
restart: on-failure:100
|
||||||
pdf-decoder:
|
pdf-decoder:
|
||||||
command:
|
command:
|
||||||
- pdf-decoder
|
- pdf-decoder
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,23 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
metering-rag:
|
||||||
|
command:
|
||||||
|
- metering
|
||||||
|
- -p
|
||||||
|
- pulsar://pulsar:6650
|
||||||
|
- -i
|
||||||
|
- non-persistent://tg/response/text-completion-rag-response
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 128M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.1'
|
||||||
|
memory: 128M
|
||||||
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
|
restart: on-failure:100
|
||||||
neo4j:
|
neo4j:
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,23 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
metering-rag:
|
||||||
|
command:
|
||||||
|
- metering
|
||||||
|
- -p
|
||||||
|
- pulsar://pulsar:6650
|
||||||
|
- -i
|
||||||
|
- non-persistent://tg/response/text-completion-rag-response
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 128M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.1'
|
||||||
|
memory: 128M
|
||||||
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
|
restart: on-failure:100
|
||||||
pdf-decoder:
|
pdf-decoder:
|
||||||
command:
|
command:
|
||||||
- pdf-decoder
|
- pdf-decoder
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,23 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
metering-rag:
|
||||||
|
command:
|
||||||
|
- metering
|
||||||
|
- -p
|
||||||
|
- pulsar://pulsar:6650
|
||||||
|
- -i
|
||||||
|
- non-persistent://tg/response/text-completion-rag-response
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 128M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.1'
|
||||||
|
memory: 128M
|
||||||
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
|
restart: on-failure:100
|
||||||
neo4j:
|
neo4j:
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,23 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
metering-rag:
|
||||||
|
command:
|
||||||
|
- metering
|
||||||
|
- -p
|
||||||
|
- pulsar://pulsar:6650
|
||||||
|
- -i
|
||||||
|
- non-persistent://tg/response/text-completion-rag-response
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 128M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.1'
|
||||||
|
memory: 128M
|
||||||
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
|
restart: on-failure:100
|
||||||
pdf-decoder:
|
pdf-decoder:
|
||||||
command:
|
command:
|
||||||
- pdf-decoder
|
- pdf-decoder
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,23 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
metering-rag:
|
||||||
|
command:
|
||||||
|
- metering
|
||||||
|
- -p
|
||||||
|
- pulsar://pulsar:6650
|
||||||
|
- -i
|
||||||
|
- non-persistent://tg/response/text-completion-rag-response
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 128M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.1'
|
||||||
|
memory: 128M
|
||||||
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
|
restart: on-failure:100
|
||||||
neo4j:
|
neo4j:
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,23 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
metering-rag:
|
||||||
|
command:
|
||||||
|
- metering
|
||||||
|
- -p
|
||||||
|
- pulsar://pulsar:6650
|
||||||
|
- -i
|
||||||
|
- non-persistent://tg/response/text-completion-rag-response
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 128M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.1'
|
||||||
|
memory: 128M
|
||||||
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
|
restart: on-failure:100
|
||||||
pdf-decoder:
|
pdf-decoder:
|
||||||
command:
|
command:
|
||||||
- pdf-decoder
|
- pdf-decoder
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,23 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
metering-rag:
|
||||||
|
command:
|
||||||
|
- metering
|
||||||
|
- -p
|
||||||
|
- pulsar://pulsar:6650
|
||||||
|
- -i
|
||||||
|
- non-persistent://tg/response/text-completion-rag-response
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 128M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.1'
|
||||||
|
memory: 128M
|
||||||
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
|
restart: on-failure:100
|
||||||
neo4j:
|
neo4j:
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,23 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
metering-rag:
|
||||||
|
command:
|
||||||
|
- metering
|
||||||
|
- -p
|
||||||
|
- pulsar://pulsar:6650
|
||||||
|
- -i
|
||||||
|
- non-persistent://tg/response/text-completion-rag-response
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 128M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.1'
|
||||||
|
memory: 128M
|
||||||
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
|
restart: on-failure:100
|
||||||
pdf-decoder:
|
pdf-decoder:
|
||||||
command:
|
command:
|
||||||
- pdf-decoder
|
- pdf-decoder
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,23 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
metering-rag:
|
||||||
|
command:
|
||||||
|
- metering
|
||||||
|
- -p
|
||||||
|
- pulsar://pulsar:6650
|
||||||
|
- -i
|
||||||
|
- non-persistent://tg/response/text-completion-rag-response
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 128M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.1'
|
||||||
|
memory: 128M
|
||||||
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
|
restart: on-failure:100
|
||||||
neo4j:
|
neo4j:
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,23 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
metering-rag:
|
||||||
|
command:
|
||||||
|
- metering
|
||||||
|
- -p
|
||||||
|
- pulsar://pulsar:6650
|
||||||
|
- -i
|
||||||
|
- non-persistent://tg/response/text-completion-rag-response
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 128M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.1'
|
||||||
|
memory: 128M
|
||||||
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
|
restart: on-failure:100
|
||||||
pdf-decoder:
|
pdf-decoder:
|
||||||
command:
|
command:
|
||||||
- pdf-decoder
|
- pdf-decoder
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,23 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
metering-rag:
|
||||||
|
command:
|
||||||
|
- metering
|
||||||
|
- -p
|
||||||
|
- pulsar://pulsar:6650
|
||||||
|
- -i
|
||||||
|
- non-persistent://tg/response/text-completion-rag-response
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 128M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.1'
|
||||||
|
memory: 128M
|
||||||
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
|
restart: on-failure:100
|
||||||
neo4j:
|
neo4j:
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,23 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
metering-rag:
|
||||||
|
command:
|
||||||
|
- metering
|
||||||
|
- -p
|
||||||
|
- pulsar://pulsar:6650
|
||||||
|
- -i
|
||||||
|
- non-persistent://tg/response/text-completion-rag-response
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 128M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.1'
|
||||||
|
memory: 128M
|
||||||
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
|
restart: on-failure:100
|
||||||
pdf-decoder:
|
pdf-decoder:
|
||||||
command:
|
command:
|
||||||
- pdf-decoder
|
- pdf-decoder
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,23 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
metering-rag:
|
||||||
|
command:
|
||||||
|
- metering
|
||||||
|
- -p
|
||||||
|
- pulsar://pulsar:6650
|
||||||
|
- -i
|
||||||
|
- non-persistent://tg/response/text-completion-rag-response
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: '0.5'
|
||||||
|
memory: 128M
|
||||||
|
reservations:
|
||||||
|
cpus: '0.1'
|
||||||
|
memory: 128M
|
||||||
|
image: docker.io/trustgraph/trustgraph-flow:0.11.1
|
||||||
|
restart: on-failure:100
|
||||||
neo4j:
|
neo4j:
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue