Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,8 @@ from openai import OpenAI
|
|
| 9 |
# -------------------- CONFIG --------------------
|
| 10 |
|
| 11 |
CHAT_MODEL = "gpt-5" # main chat model
|
| 12 |
-
|
|
|
|
| 13 |
|
| 14 |
DEFAULT_SYSTEM_PROMPT = """You are a Retrieval-Augmented Generation (RAG) assistant.
|
| 15 |
|
|
@@ -327,13 +328,12 @@ def chat_with_rag(
|
|
| 327 |
# Current user message
|
| 328 |
messages.append({"role": "user", "content": user_message})
|
| 329 |
|
| 330 |
-
# Call OpenAI GPT-5 using max_completion_tokens
|
| 331 |
try:
|
| 332 |
resp = client.chat.completions.create(
|
| 333 |
model=CHAT_MODEL,
|
| 334 |
messages=messages,
|
| 335 |
-
|
| 336 |
-
max_completion_tokens=900, # correct param for GPT-5
|
| 337 |
)
|
| 338 |
answer = resp.choices[0].message.content
|
| 339 |
except Exception as e:
|
|
|
|
| 9 |
# -------------------- CONFIG --------------------
|
| 10 |
|
| 11 |
CHAT_MODEL = "gpt-5" # main chat model
|
| 12 |
+
# Use a model your project actually has access to
|
| 13 |
+
EMBED_MODEL = "text-embedding-3-small"
|
| 14 |
|
| 15 |
DEFAULT_SYSTEM_PROMPT = """You are a Retrieval-Augmented Generation (RAG) assistant.
|
| 16 |
|
|
|
|
| 328 |
# Current user message
|
| 329 |
messages.append({"role": "user", "content": user_message})
|
| 330 |
|
| 331 |
+
# Call OpenAI GPT-5 using max_completion_tokens ONLY (no temperature)
|
| 332 |
try:
|
| 333 |
resp = client.chat.completions.create(
|
| 334 |
model=CHAT_MODEL,
|
| 335 |
messages=messages,
|
| 336 |
+
max_completion_tokens=900, # GPT-5-compatible param
|
|
|
|
| 337 |
)
|
| 338 |
answer = resp.choices[0].message.content
|
| 339 |
except Exception as e:
|