update werewolf experience and add rag retrieve

This commit is contained in:
better629 2024-04-10 20:30:09 +08:00
parent 5caaea2aeb
commit a466bc9243
3 changed files with 44 additions and 29 deletions

View file

@ -161,6 +161,13 @@ class SimpleEngine(RetrieverQueryEngine):
"""Inplement tools.SearchInterface"""
return await self.aquery(content)
def retrieve(self, query: QueryType) -> list[NodeWithScore]:
query_bundle = QueryBundle(query) if isinstance(query, str) else query
nodes = super().retrieve(query_bundle)
self._try_reconstruct_obj(nodes)
return nodes
async def aretrieve(self, query: QueryType) -> list[NodeWithScore]:
"""Allow query to be str."""
query_bundle = QueryBundle(query) if isinstance(query, str) else query