MaximeRappaport/Agentic_Health_Model_70B
0
1# import json2from typing import Any3import requests4 5# Ref: https://medium.com/@shrinath.suresh/deploying-tgi-in-runpod-a84738263e2c6 7RUNPOD_POD_ID = "q39au00uendckb"8 9def predict(query: str) -> Any:10 url = f"https://{RUNPOD_POD_ID}-8080.proxy.runpod.net/v1/chat/completions"11 headers = {12 'Content-Type': 'application/json'13 }14 data = {15 "model": "tgi",16 "messages": [17 {18 "role": "system",19 "content": "You are a helpful medical expert. Answer the user's medical question as accurately as possible."20 },21 {22 "role": "user",23 "content": query24 }25 ],26 "stream": False,27 "max_tokens": 5000,28 }29 30 response = requests.post(url, headers=headers, json=data)31 result = response.json()['choices'][0]['message']['content']32 return result33 34response = predict("What are common treatments for sepsis?")35print(response)