File size: 742 Bytes
b70c4a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import requests
from langchain_core.messages import HumanMessage
from agent import build_graph
from huggingface_hub import hf_hub_download
import pyarrow.parquet as pq
from dotenv import load_dotenv

load_dotenv(override=True)

graph = build_graph()
resp = requests.get("https://agents-course-unit4-scoring.hf.space/questions")
questions = resp.json()

# Q19
q = questions[18]
question = q['question']
print(f"Q19: {question}")
print(f"Contains 'excel': {'excel' in question.lower()}")
print(f"Contains 'food': {'food' in question.lower()}")
print(f"Contains 'drinks': {'drinks' in question.lower()}")
print()

result = graph.invoke({"messages": [HumanMessage(content=question)]})
print(f"Answer: {result['messages'][-1].content}")