mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-06-07 13:55:14 +02:00
Configurable RAG query
This commit is contained in:
parent
5c4a1ce092
commit
7c191bd38c
2 changed files with 38 additions and 5 deletions
|
|
@ -15,7 +15,10 @@ class GraphRag:
|
||||||
graph_hosts=None,
|
graph_hosts=None,
|
||||||
pulsar_host="pulsar://pulsar:6650",
|
pulsar_host="pulsar://pulsar:6650",
|
||||||
vector_store="http://milvus:19530",
|
vector_store="http://milvus:19530",
|
||||||
verbose=False
|
verbose=False,
|
||||||
|
entity_limit=50,
|
||||||
|
triple_limit=30,
|
||||||
|
max_sg_size=3000,
|
||||||
):
|
):
|
||||||
|
|
||||||
self.verbose=verbose
|
self.verbose=verbose
|
||||||
|
|
@ -32,9 +35,9 @@ class GraphRag:
|
||||||
|
|
||||||
self.vecstore = TripleVectors(vector_store)
|
self.vecstore = TripleVectors(vector_store)
|
||||||
|
|
||||||
self.entity_limit=50
|
self.entity_limit=entity_limit
|
||||||
self.query_limit=30
|
self.query_limit=triple_limit
|
||||||
self.max_sg_size=3000
|
self.max_sg_size=max_sg_size
|
||||||
|
|
||||||
self.label_cache = {}
|
self.label_cache = {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,9 @@ class Processor:
|
||||||
log_level=LogLevel.INFO,
|
log_level=LogLevel.INFO,
|
||||||
graph_hosts=default_graph_hosts,
|
graph_hosts=default_graph_hosts,
|
||||||
vector_store=default_vector_store,
|
vector_store=default_vector_store,
|
||||||
|
entity_limit=50,
|
||||||
|
triple_limit=30,
|
||||||
|
max_sg_size=3000,
|
||||||
):
|
):
|
||||||
|
|
||||||
self.client = None
|
self.client = None
|
||||||
|
|
@ -58,6 +61,9 @@ class Processor:
|
||||||
graph_hosts=graph_hosts,
|
graph_hosts=graph_hosts,
|
||||||
vector_store=vector_store,
|
vector_store=vector_store,
|
||||||
verbose=True,
|
verbose=True,
|
||||||
|
entity_limit=entity_limit,
|
||||||
|
triple_limit=triple_limit,
|
||||||
|
max_sg_size=max_sg_size,
|
||||||
)
|
)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
@ -102,7 +108,7 @@ class Processor:
|
||||||
def run():
|
def run():
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog='llm-ollama-text',
|
prog='graph-rag',
|
||||||
description=__doc__,
|
description=__doc__,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -150,6 +156,27 @@ def run():
|
||||||
help=f'Vector host (default: http://milvus:19530)'
|
help=f'Vector host (default: http://milvus:19530)'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'-e', '--entity-limit',
|
||||||
|
type=int,
|
||||||
|
default=50,
|
||||||
|
help=f'Entity vector fetch limit (default: 50)'
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'-t', '--triple-limit',
|
||||||
|
type=int,
|
||||||
|
default=30,
|
||||||
|
help=f'Triple query limit, per query (default: 30)'
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'-u', '--max-subgraph-size',
|
||||||
|
type=int,
|
||||||
|
default=3000,
|
||||||
|
help=f'Max subgraph size (default: 3000)'
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
@ -164,6 +191,9 @@ def run():
|
||||||
log_level=args.log_level,
|
log_level=args.log_level,
|
||||||
graph_hosts=args.graph_hosts.split(","),
|
graph_hosts=args.graph_hosts.split(","),
|
||||||
vector_store=args.vector_store,
|
vector_store=args.vector_store,
|
||||||
|
entity_limit=args.entity_limit,
|
||||||
|
triple_limit=args.triple_limit,
|
||||||
|
max_sg_size=args.max_subgraph_size,
|
||||||
)
|
)
|
||||||
|
|
||||||
p.run()
|
p.run()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue