mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-06 11:52:10 +02:00
Tweaks to rag prompt
This commit is contained in:
parent
ac359580ec
commit
fd7c215217
3 changed files with 33 additions and 14 deletions
|
|
@ -143,6 +143,10 @@ services:
|
||||||
- "chunker-recursive"
|
- "chunker-recursive"
|
||||||
- "-p"
|
- "-p"
|
||||||
- "pulsar://pulsar:6650"
|
- "pulsar://pulsar:6650"
|
||||||
|
- "--chunk-size"
|
||||||
|
- "4000"
|
||||||
|
- "--chunk-overlap"
|
||||||
|
- "120"
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
|
||||||
vectorize:
|
vectorize:
|
||||||
|
|
@ -207,23 +211,41 @@ services:
|
||||||
- "pulsar://pulsar:6650"
|
- "pulsar://pulsar:6650"
|
||||||
- "-k"
|
- "-k"
|
||||||
- ${COHERE_KEY}
|
- ${COHERE_KEY}
|
||||||
|
- "-m"
|
||||||
|
- "c4ai-aya-23-35b"
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
|
||||||
text-completion-rag:
|
text-completion-rag:
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.5.6
|
image: docker.io/trustgraph/trustgraph-flow:0.5.6
|
||||||
command:
|
command:
|
||||||
- "text-completion-ollama"
|
- "text-completion-cohere"
|
||||||
- "-p"
|
- "-p"
|
||||||
- "pulsar://pulsar:6650"
|
- "pulsar://pulsar:6650"
|
||||||
- "-r"
|
- "-k"
|
||||||
- "http://${OLLAMA_HOST}:11434/"
|
- ${COHERE_KEY}
|
||||||
|
- "-m"
|
||||||
|
- "c4ai-aya-23-8b"
|
||||||
- "-i"
|
- "-i"
|
||||||
- "non-persistent://tg/request/text-completion-rag"
|
- "non-persistent://tg/request/text-completion-rag"
|
||||||
- "-o"
|
- "-o"
|
||||||
- "non-persistent://tg/response/text-completion-rag-response"
|
- "non-persistent://tg/response/text-completion-rag-response"
|
||||||
- "-m"
|
|
||||||
- "qwen2:1.5b"
|
|
||||||
restart: on-failure:100
|
restart: on-failure:100
|
||||||
|
|
||||||
|
#text-completion-rag:
|
||||||
|
# image: docker.io/trustgraph/trustgraph-flow:0.5.6
|
||||||
|
# command:
|
||||||
|
# - "text-completion-ollama"
|
||||||
|
# - "-p"
|
||||||
|
# - "pulsar://pulsar:6650"
|
||||||
|
# - "-r"
|
||||||
|
# - "http://${OLLAMA_HOST}:11434/"
|
||||||
|
# - "-i"
|
||||||
|
# - "non-persistent://tg/request/text-completion-rag"
|
||||||
|
# - "-o"
|
||||||
|
# - "non-persistent://tg/response/text-completion-rag-response"
|
||||||
|
# - "-m"
|
||||||
|
# - "gemma2:2b"
|
||||||
|
# restart: on-failure:100
|
||||||
|
|
||||||
graph-rag:
|
graph-rag:
|
||||||
image: docker.io/trustgraph/trustgraph-flow:0.5.6
|
image: docker.io/trustgraph/trustgraph-flow:0.5.6
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ from trustgraph.graph_rag_client import GraphRagClient
|
||||||
|
|
||||||
rag = GraphRagClient(pulsar_host="pulsar://localhost:6650")
|
rag = GraphRagClient(pulsar_host="pulsar://localhost:6650")
|
||||||
|
|
||||||
query="""Write a blog post describing the key points desribing the researcher's methodology for finding Leo VI.
|
query="""List 20 key points to describe the research that led to the discovery of Leo VI.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
resp = rag.request(query)
|
resp = rag.request(query)
|
||||||
|
|
|
||||||
|
|
@ -228,16 +228,13 @@ class GraphRag:
|
||||||
|
|
||||||
kg = self.get_cypher(query)
|
kg = self.get_cypher(query)
|
||||||
|
|
||||||
prompt=f"""<instructions>Study the knowledge graph provided, and use
|
prompt=f"""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.
|
||||||
the information to answer the question. The question should be answered
|
|
||||||
in plain English only.
|
Here's the knowledge statements:
|
||||||
</instructions>
|
|
||||||
<knowledge-graph>
|
|
||||||
{kg}
|
{kg}
|
||||||
</knowledge-graph>
|
|
||||||
<question>
|
Use only the provided knowledge statements to respond to the following:
|
||||||
{query}
|
{query}
|
||||||
</question>
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return prompt
|
return prompt
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue