WIP: tunning

This commit is contained in:
2025-05-03 19:21:12 +01:00
parent 302dd7e965
commit afeaeba313
3 changed files with 17 additions and 9 deletions

View File

@@ -32,12 +32,15 @@ async def message(
# Build prompt (very simple example)
prompt = f"User {payload.userId} said: {payload.content}\nBot:"
resp = openai.Completion.create(
model="text-davinci-003",
prompt=prompt,
max_tokens=150
chat_response = opeai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "-"},
{"role": "user", "content": prompt}
]
temperature=0.7,
)
reply = resp.choices[0].text.strip()
reply = chat_response.choices[0].text.strip()
# Cache reply for idempotency
r.set(payload.eventId, reply, ex=3600)