Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node Distance Reranker: Limit max hops (and cleanup prints) #72

Merged
merged 2 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion graphiti_core/llm_client/openai_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,5 @@ async def _generate_response(self, messages: list[Message]) -> dict[str, typing.
result = response.choices[0].message.content or ''
return json.loads(result)
except Exception as e:
print(openai_messages)
logger.error(f'Error in generating LLM response: {e}')
raise
2 changes: 1 addition & 1 deletion graphiti_core/search/search_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ async def node_distance_reranker(
records, _, _ = await driver.execute_query(
"""
MATCH (source:Entity)-[r:RELATES_TO {uuid: $edge_uuid}]->(target:Entity)
MATCH p = SHORTEST 1 (center:Entity)-[:RELATES_TO]-+(n:Entity)
MATCH p = SHORTEST 1 (center:Entity)-[:RELATES_TO*1..10]->(n:Entity)
WHERE center.uuid = $center_uuid AND n.uuid IN [source.uuid, target.uuid]
RETURN min(length(p)) AS score, source.uuid AS source_uuid, target.uuid AS target_uuid
""",
Expand Down
1 change: 0 additions & 1 deletion graphiti_core/utils/maintenance/edge_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ async def extract_edges(
}

llm_response = await llm_client.generate_response(prompt_library.extract_edges.v2(context))
print(llm_response)
edges_data = llm_response.get('edges', [])

end = time()
Expand Down