File size: 1,097 Bytes
e6ecedd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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())