Created
June 23, 2025 19:47
-
-
Save ilosamart/a92508c6fe810214683682af53208f62 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import requests | |
OLLAMA_ENDPOINT = "https://mpgpt.lab.mp.rs.gov.br/ollama" | |
API_KEY = os.getenv("API_KEY") | |
headers = { | |
"Authorization": f"Bearer {API_KEY}", | |
"Content-Type": "application/json", | |
} | |
payload = { | |
"model": "gemma3:12b", | |
"prompt": """Why is the sky blue?" | |
"The output should have this JSON format: | |
{ "question": [THE QUESTION], "response": [THE RESPONSE]} | |
""", | |
"format": "json", | |
"stream": False, | |
"raw": False, | |
"options": { | |
"num_ctx": 8000, | |
"seed": 0, | |
"temperature": 1.0, | |
}, | |
} | |
resposta = requests.post( | |
f"{OLLAMA_ENDPOINT}/api/generate", headers=headers, json=payload, | |
) | |
print(resposta.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment