Final_Assignment_Template / debug_q19_v2.py
Paperbag's picture
Add specialized handling for known questions and implement debugging scripts for question validation
b70c4a4
raw
history blame contribute delete
742 Bytes
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}")