Spaces:
Sleeping
Sleeping
Riley commited on
Commit ·
eaadb58
1
Parent(s): eb968a7
fix: Remove temperature parameter for GPT-5 compatibility (only supports default)
Browse files- analyzer/chat/demo_app.py +2 -2
- analyzer/llm_client.py +3 -2
- src/analyzer/chat/demo_app.py +2 -2
- src/analyzer/llm_client.py +3 -2
analyzer/chat/demo_app.py
CHANGED
|
@@ -438,8 +438,8 @@ class GrantAnalystDemo:
|
|
| 438 |
messages=self.messages,
|
| 439 |
tools=self.available_tools,
|
| 440 |
tool_choice="auto",
|
| 441 |
-
temperature=0.2, # Lower temperature for more consistent, thorough responses
|
| 442 |
max_completion_tokens=4096, # GPT-5 uses max_completion_tokens
|
|
|
|
| 443 |
)
|
| 444 |
timing_info["llm_call"] = time.time() - llm_start
|
| 445 |
|
|
@@ -481,8 +481,8 @@ class GrantAnalystDemo:
|
|
| 481 |
final_response = self.llm_client.client.chat.completions.create(
|
| 482 |
model=self.llm_client.model,
|
| 483 |
messages=self.messages,
|
| 484 |
-
temperature=0.2, # Lower temperature for more complete, consistent responses
|
| 485 |
max_completion_tokens=4096, # GPT-5 uses max_completion_tokens
|
|
|
|
| 486 |
)
|
| 487 |
timing_info["final_llm_call"] = time.time() - final_start
|
| 488 |
|
|
|
|
| 438 |
messages=self.messages,
|
| 439 |
tools=self.available_tools,
|
| 440 |
tool_choice="auto",
|
|
|
|
| 441 |
max_completion_tokens=4096, # GPT-5 uses max_completion_tokens
|
| 442 |
+
# Note: GPT-5 only supports temperature=1.0 (default), so we don't set it
|
| 443 |
)
|
| 444 |
timing_info["llm_call"] = time.time() - llm_start
|
| 445 |
|
|
|
|
| 481 |
final_response = self.llm_client.client.chat.completions.create(
|
| 482 |
model=self.llm_client.model,
|
| 483 |
messages=self.messages,
|
|
|
|
| 484 |
max_completion_tokens=4096, # GPT-5 uses max_completion_tokens
|
| 485 |
+
# Note: GPT-5 only supports temperature=1.0 (default), so we don't set it
|
| 486 |
)
|
| 487 |
timing_info["final_llm_call"] = time.time() - final_start
|
| 488 |
|
analyzer/llm_client.py
CHANGED
|
@@ -228,12 +228,13 @@ class LLMClient:
|
|
| 228 |
api_params = {
|
| 229 |
"model": model,
|
| 230 |
"messages": messages,
|
| 231 |
-
"temperature": temperature,
|
| 232 |
-
"top_p": top_p,
|
| 233 |
"max_completion_tokens": max_tokens, # GPT-5 uses max_completion_tokens
|
| 234 |
"stream": stream,
|
| 235 |
}
|
| 236 |
|
|
|
|
|
|
|
|
|
|
| 237 |
# Add GPT-5 specific parameters if provided
|
| 238 |
if verbosity is not None:
|
| 239 |
api_params["verbosity"] = verbosity
|
|
|
|
| 228 |
api_params = {
|
| 229 |
"model": model,
|
| 230 |
"messages": messages,
|
|
|
|
|
|
|
| 231 |
"max_completion_tokens": max_tokens, # GPT-5 uses max_completion_tokens
|
| 232 |
"stream": stream,
|
| 233 |
}
|
| 234 |
|
| 235 |
+
# GPT-5 only supports temperature=1.0 (default), so don't set it
|
| 236 |
+
# For other models, we could add temperature back if needed
|
| 237 |
+
|
| 238 |
# Add GPT-5 specific parameters if provided
|
| 239 |
if verbosity is not None:
|
| 240 |
api_params["verbosity"] = verbosity
|
src/analyzer/chat/demo_app.py
CHANGED
|
@@ -438,8 +438,8 @@ class GrantAnalystDemo:
|
|
| 438 |
messages=self.messages,
|
| 439 |
tools=self.available_tools,
|
| 440 |
tool_choice="auto",
|
| 441 |
-
temperature=0.2, # Lower temperature for more consistent, thorough responses
|
| 442 |
max_completion_tokens=4096, # GPT-5 uses max_completion_tokens
|
|
|
|
| 443 |
)
|
| 444 |
timing_info["llm_call"] = time.time() - llm_start
|
| 445 |
|
|
@@ -481,8 +481,8 @@ class GrantAnalystDemo:
|
|
| 481 |
final_response = self.llm_client.client.chat.completions.create(
|
| 482 |
model=self.llm_client.model,
|
| 483 |
messages=self.messages,
|
| 484 |
-
temperature=0.2, # Lower temperature for more complete, consistent responses
|
| 485 |
max_completion_tokens=4096, # GPT-5 uses max_completion_tokens
|
|
|
|
| 486 |
)
|
| 487 |
timing_info["final_llm_call"] = time.time() - final_start
|
| 488 |
|
|
|
|
| 438 |
messages=self.messages,
|
| 439 |
tools=self.available_tools,
|
| 440 |
tool_choice="auto",
|
|
|
|
| 441 |
max_completion_tokens=4096, # GPT-5 uses max_completion_tokens
|
| 442 |
+
# Note: GPT-5 only supports temperature=1.0 (default), so we don't set it
|
| 443 |
)
|
| 444 |
timing_info["llm_call"] = time.time() - llm_start
|
| 445 |
|
|
|
|
| 481 |
final_response = self.llm_client.client.chat.completions.create(
|
| 482 |
model=self.llm_client.model,
|
| 483 |
messages=self.messages,
|
|
|
|
| 484 |
max_completion_tokens=4096, # GPT-5 uses max_completion_tokens
|
| 485 |
+
# Note: GPT-5 only supports temperature=1.0 (default), so we don't set it
|
| 486 |
)
|
| 487 |
timing_info["final_llm_call"] = time.time() - final_start
|
| 488 |
|
src/analyzer/llm_client.py
CHANGED
|
@@ -228,12 +228,13 @@ class LLMClient:
|
|
| 228 |
api_params = {
|
| 229 |
"model": model,
|
| 230 |
"messages": messages,
|
| 231 |
-
"temperature": temperature,
|
| 232 |
-
"top_p": top_p,
|
| 233 |
"max_completion_tokens": max_tokens, # GPT-5 uses max_completion_tokens
|
| 234 |
"stream": stream,
|
| 235 |
}
|
| 236 |
|
|
|
|
|
|
|
|
|
|
| 237 |
# Add GPT-5 specific parameters if provided
|
| 238 |
if verbosity is not None:
|
| 239 |
api_params["verbosity"] = verbosity
|
|
|
|
| 228 |
api_params = {
|
| 229 |
"model": model,
|
| 230 |
"messages": messages,
|
|
|
|
|
|
|
| 231 |
"max_completion_tokens": max_tokens, # GPT-5 uses max_completion_tokens
|
| 232 |
"stream": stream,
|
| 233 |
}
|
| 234 |
|
| 235 |
+
# GPT-5 only supports temperature=1.0 (default), so don't set it
|
| 236 |
+
# For other models, we could add temperature back if needed
|
| 237 |
+
|
| 238 |
# Add GPT-5 specific parameters if provided
|
| 239 |
if verbosity is not None:
|
| 240 |
api_params["verbosity"] = verbosity
|