Spaces:
Runtime error
Runtime error
| import asyncio | |
| from llama_index.core.agent.workflow import AgentWorkflow | |
| from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI | |
| from retriever_tool import guest_info_tool | |
| async def test_both_queries(): | |
| # Initialize the Hugging Face model | |
| llm = HuggingFaceInferenceAPI(model="meta-llama/Llama-3.2-11B-Vision-Instruct") | |
| # Create Alfred, our gala agent, with the guest info tool | |
| alfred = AgentWorkflow.from_tools_or_functions( | |
| [guest_info_tool], | |
| llm=llm, | |
| ) | |
| # Test both queries | |
| query1 = "What is the email of the guest named 'Lady Ada Lovelace'?" | |
| query2 = "What is the email of guest named 'Lady Ada Lovelace'?" | |
| print("=== Query 1 (with 'the') ===") | |
| print(f"Query: {query1}") | |
| response1 = await alfred.run(query1) | |
| print("Response:") | |
| print(response1) | |
| print() | |
| print("=== Query 2 (without 'the') ===") | |
| print(f"Query: {query2}") | |
| response2 = await alfred.run(query2) | |
| print("Response:") | |
| print(response2) | |
| print() | |
| if __name__ == "__main__": | |
| asyncio.run(test_both_queries()) | |