malepati/custom_template_working
0
1import requests2import json3 4# Test payload5payload = {6 "language": "English",7 "list_of_queries": [8 "4d143989-19fe-4d33-a4f3-7a1c63662ddd",9 "83d4af3b-99ae-4a1b-bffc-8e1a82f02bdd",10 "59c9ee36-d9b6-4dcb-afa5-9605d8d695dd",11 "6195937b-4a31-4ce1-bf00-741f3a2743dd"12 ],13 "org_id": "f9209852-7de2-49b3-9190-2a52b3250428",14 "presenter_name": "Venkat",15 "report_name": "report on HU Dataset",16 "user_id": "eb4193aa-1f25-422c-9b33-2a5f41989891"17}18 19# Convert to JSON string (as the API expects content as a string)20content_string = json.dumps(payload)21 22# Request body23request_body = {24 "content": content_string,25 "language": "English",26 "file_paths": [],27 "tone": "default",28 "verbosity": "standard",29 "instructions": None,30 "include_table_of_contents": False,31 "include_title_slide": False,32 "web_search": False33}34 35print("Sending request to http://127.0.0.1:8000/api/v1/ppt/presentation/create")36print(f"Payload has {len(payload['list_of_queries'])} queries")37print("-" * 60)38 39try:40 response = requests.post(41 "http://127.0.0.1:8000/api/v1/ppt/presentation/create",42 json=request_body,43 timeout=120 # 2 minutes timeout for LLM processing44 )45 46 print(f"Status Code: {response.status_code}")47 print("-" * 60)48 49 if response.status_code == 200:50 result = response.json()51 print("✅ SUCCESS!")52 print(f"Presentation ID: {result.get('id')}")53 print(f"Total Slides: {result.get('n_slides')}")54 print(f"Language: {result.get('language')}")55 print(f"Title: {result.get('title')}")56 print(f"Report Name: {result.get('title')}")57 else:58 print("❌ ERROR!")59 print(f"Response: {response.text}")60 61except requests.exceptions.ConnectionError:62 print("❌ CONNECTION ERROR!")63 print("Backend server is not running or not accessible at http://127.0.0.1:8000")64except requests.exceptions.Timeout:65 print("❌ TIMEOUT!")66 print("Request took too long (>2 minutes)")67except Exception as e:68 print(f"❌ EXCEPTION: {e}")69 