import requests
url = "https://api.sunbird.ai/tasks/chat/completions"
headers = {
"accept": "application/json",
"Authorization": "Bearer <your-access-token>",
"Content-Type": "application/json",
}
text = (
"John Doe, who lives in Kampala, reported that the water supply was cut off "
"yesterday at 2 PM. He called the utility company but got no response."
)
payload = {
"model": "sunflower-14b",
"messages": [
{
"role": "system",
"content": (
"You are a summarization assistant. Produce a concise summary of "
"the user's text. Anonymize any personal identifiable information "
"(names, exact locations, contact details)."
),
},
{"role": "user", "content": text},
],
"temperature": 0.3,
}
response = requests.post(url, headers=headers, json=payload)
print(response.json()["choices"][0]["message"]["content"])