File size: 701 Bytes
53ea537
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import json
from ollama import Client

# Load system prompt
with open('system_prompt.json', 'r') as f:
    config = json.load(f)
    SYSTEM_PROMPT = config['system_prompt']

# Initialize client
client = Client(
    host="https://ollama.com",
    headers={'Authorization': 'YOUR_OLLAMA_API_KEY'}
)

# Optimize a prompt
def optimize_prompt(input_text):
    response = client.chat(
        model="gpt-oss:20b",
        messages=[
            {'role': 'system', 'content': SYSTEM_PROMPT},
            {'role': 'user', 'content': input_text}
        ],
        options={'temperature': 0.7}
    )
    return response['message']['content']

# Example usage
print(optimize_prompt("como fazer uma aula boa?"))