Spaces:
Sleeping
Sleeping
File size: 582 Bytes
eb87615 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
from llama_index.core.tools import FunctionTool
from llama_index.retrievers.bm25 import BM25Retriever
bm25_retriever = BM25Retriever.from_defaults(nodes=docs)
def get_guest_info_retriever(query: str) -> str:
"""Retrieves detailed information about gala guests based on their name or relation."""
results = bm25_retriever.retrieve(query)
if results:
return "\n\n".join([doc.text for doc in results[:3]])
else:
return "No matching guest information found."
# Initialize the tool
guest_info_tool = FunctionTool.from_defaults(get_guest_info_retriever) |