import os import requests # Environment variable for the token token = "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" endpoint = "https://models.github.ai/inference" model = "openai/gpt-4.1" def API_call(report): headers = { "Authorization": f"Bearer {token}", "Content-Type": "application/json" } body = { "messages": [ {"role": "system", "content": ""}, {"role": "user", "content": f"please structure this report into findings and impressions. Please be precise and just output the findings and impressions with no other text.Please keep the same length of the original report. Report:{report}"} ], "temperature": 1, "top_p": 1, "model": model } response = requests.post(f"{endpoint}/chat/completions", headers=headers, json=body) if not response.ok: raise Exception(response.json().get("error", "Unknown error")) data = response.json() return(data["choices"][0]["message"]["content"])