mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-24 20:51:02 +02:00
Fix GraphRAG inconsistency
This commit is contained in:
parent
7135322811
commit
e6d7c003ab
3 changed files with 6 additions and 6 deletions
|
|
@ -159,12 +159,12 @@ class AsyncFlowInstance:
|
||||||
result = await self.request("text-completion", request_data)
|
result = await self.request("text-completion", request_data)
|
||||||
return result.get("response", "")
|
return result.get("response", "")
|
||||||
|
|
||||||
async def graph_rag(self, question: str, user: str, collection: str,
|
async def graph_rag(self, query: str, user: str, collection: str,
|
||||||
max_subgraph_size: int = 1000, max_subgraph_count: int = 5,
|
max_subgraph_size: int = 1000, max_subgraph_count: int = 5,
|
||||||
max_entity_distance: int = 3, **kwargs: Any) -> str:
|
max_entity_distance: int = 3, **kwargs: Any) -> str:
|
||||||
"""Graph RAG (non-streaming, use async_socket for streaming)"""
|
"""Graph RAG (non-streaming, use async_socket for streaming)"""
|
||||||
request_data = {
|
request_data = {
|
||||||
"question": question,
|
"query": query,
|
||||||
"user": user,
|
"user": user,
|
||||||
"collection": collection,
|
"collection": collection,
|
||||||
"max-subgraph-size": max_subgraph_size,
|
"max-subgraph-size": max_subgraph_size,
|
||||||
|
|
|
||||||
|
|
@ -208,12 +208,12 @@ class AsyncSocketFlowInstance:
|
||||||
if hasattr(chunk, 'content'):
|
if hasattr(chunk, 'content'):
|
||||||
yield chunk.content
|
yield chunk.content
|
||||||
|
|
||||||
async def graph_rag(self, question: str, user: str, collection: str,
|
async def graph_rag(self, query: str, user: str, collection: str,
|
||||||
max_subgraph_size: int = 1000, max_subgraph_count: int = 5,
|
max_subgraph_size: int = 1000, max_subgraph_count: int = 5,
|
||||||
max_entity_distance: int = 3, streaming: bool = False, **kwargs):
|
max_entity_distance: int = 3, streaming: bool = False, **kwargs):
|
||||||
"""Graph RAG with optional streaming"""
|
"""Graph RAG with optional streaming"""
|
||||||
request = {
|
request = {
|
||||||
"question": question,
|
"query": query,
|
||||||
"user": user,
|
"user": user,
|
||||||
"collection": collection,
|
"collection": collection,
|
||||||
"max-subgraph-size": max_subgraph_size,
|
"max-subgraph-size": max_subgraph_size,
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ def question(
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = flow.graph_rag(
|
response = flow.graph_rag(
|
||||||
question=question,
|
query=question,
|
||||||
user=user,
|
user=user,
|
||||||
collection=collection,
|
collection=collection,
|
||||||
entity_limit=entity_limit,
|
entity_limit=entity_limit,
|
||||||
|
|
@ -51,7 +51,7 @@ def question(
|
||||||
# Use REST API for non-streaming
|
# Use REST API for non-streaming
|
||||||
flow = api.flow().id(flow_id)
|
flow = api.flow().id(flow_id)
|
||||||
resp = flow.graph_rag(
|
resp = flow.graph_rag(
|
||||||
question=question,
|
query=question,
|
||||||
user=user,
|
user=user,
|
||||||
collection=collection,
|
collection=collection,
|
||||||
entity_limit=entity_limit,
|
entity_limit=entity_limit,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue