AI_Chat_With_Tools / back /reproduce_tool.py
muhammad1707's picture
Move master code to main
8421ec4
Raw
History Blame Contribute Delete
654 Bytes
import requests
import sys
# Create a dummy chat first
try:
chat_res = requests.post("http://localhost:4000/chats", json={"title": "Debug Tool Chat"})
chat_id = chat_res.json()["id"]
print(f"Created chat: {chat_id}")
except Exception as e:
print(f"Failed to create chat: {e}")
sys.exit(1)
# Send tool request
url = f"http://localhost:4000/chats/{chat_id}/messages"
payload = {"content": "Calculate 15% of 8550"}
print(f"Sending request to {url}...")
try:
res = requests.post(url, json=payload)
print(f"Status: {res.status_code}")
print(f"Response: {res.text}")
except Exception as e:
print(f"Request failed: {e}")