mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-07 04:12: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"
|
||||
- "-p"
|
||||
- "pulsar://pulsar:6650"
|
||||
- "--chunk-size"
|
||||
- "4000"
|
||||
- "--chunk-overlap"
|
||||
- "120"
|
||||
restart: on-failure:100
|
||||
|
||||
vectorize:
|
||||
|
|
@ -207,23 +211,41 @@ services:
|
|||
- "pulsar://pulsar:6650"
|
||||
- "-k"
|
||||
- ${COHERE_KEY}
|
||||
- "-m"
|
||||
- "c4ai-aya-23-35b"
|
||||
restart: on-failure:100
|
||||
|
||||
text-completion-rag:
|
||||
image: docker.io/trustgraph/trustgraph-flow:0.5.6
|
||||
command:
|
||||
- "text-completion-ollama"
|
||||
- "text-completion-cohere"
|
||||
- "-p"
|
||||
- "pulsar://pulsar:6650"
|
||||
- "-r"
|
||||
- "http://${OLLAMA_HOST}:11434/"
|
||||
- "-k"
|
||||
- ${COHERE_KEY}
|
||||
- "-m"
|
||||
- "c4ai-aya-23-8b"
|
||||
- "-i"
|
||||
- "non-persistent://tg/request/text-completion-rag"
|
||||
- "-o"
|
||||
- "non-persistent://tg/response/text-completion-rag-response"
|
||||
- "-m"
|
||||
- "qwen2:1.5b"
|
||||
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:
|
||||
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")
|
||||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -228,16 +228,13 @@ class GraphRag:
|
|||
|
||||
kg = self.get_cypher(query)
|
||||
|
||||
prompt=f"""<instructions>Study the knowledge graph provided, and use
|
||||
the information to answer the question. The question should be answered
|
||||
in plain English only.
|
||||
</instructions>
|
||||
<knowledge-graph>
|
||||
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.
|
||||
|
||||
Here's the knowledge statements:
|
||||
{kg}
|
||||
</knowledge-graph>
|
||||
<question>
|
||||
|
||||
Use only the provided knowledge statements to respond to the following:
|
||||
{query}
|
||||
</question>
|
||||
"""
|
||||
|
||||
return prompt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue