Update search method to return EntityEdge objects (#48)

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/getzep/graphiti?shareId=XXXX-XXXX-XXXX-XXXX).
This commit is contained in:
Daniel Chalef 2024-08-26 17:24:35 -07:00 committed by GitHub
parent 598e9fd0c5
commit 7ca4f7fe5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 10 deletions

View file

@ -534,7 +534,7 @@ class Graphiti:
Returns
-------
list
A list of facts (strings) that are relevant to the search query.
A list of EntityEdge objects that are relevant to the search query.
Notes
-----
@ -564,9 +564,7 @@ class Graphiti:
)
).edges
facts = [edge.fact for edge in edges]
return facts
return edges
async def _search(
self,

View file

@ -76,17 +76,17 @@ async def test_graphiti_init():
logger = setup_logging()
graphiti = Graphiti(NEO4J_URI, NEO4j_USER, NEO4j_PASSWORD, None)
facts = await graphiti.search('Freakenomics guest')
edges = await graphiti.search('Freakenomics guest')
logger.info('\nQUERY: Freakenomics guest\n' + format_context(facts))
logger.info('\nQUERY: Freakenomics guest\n' + format_context([edge.fact for edge in edges]))
facts = await graphiti.search('tania tetlow\n')
edges = await graphiti.search('tania tetlow\n')
logger.info('\nQUERY: Tania Tetlow\n' + format_context(facts))
logger.info('\nQUERY: Tania Tetlow\n' + format_context([edge.fact for edge in edges]))
facts = await graphiti.search('issues with higher ed')
edges = await graphiti.search('issues with higher ed')
logger.info('\nQUERY: issues with higher ed\n' + format_context(facts))
logger.info('\nQUERY: issues with higher ed\n' + format_context([edge.fact for edge in edges]))
graphiti.close()