Spaces:
Sleeping
Sleeping
yc1838 commited on
Commit ·
90d071c
1
Parent(s): 8a34f60
fix: stop stripping function_call from additional_kwargs to preserve gemini thought_signatures
Browse files- src/lilith_agent/app.py +4 -4
src/lilith_agent/app.py
CHANGED
|
@@ -535,11 +535,11 @@ def build_react_agent(cfg: Config):
|
|
| 535 |
response = model.invoke(prompt_msgs)
|
| 536 |
|
| 537 |
# Clean up Gemini signatures and unhelpful metadata to reduce log noise and context bloat
|
| 538 |
-
# Note:
|
| 539 |
-
#
|
|
|
|
| 540 |
if hasattr(response, "additional_kwargs"):
|
| 541 |
-
#
|
| 542 |
-
response.additional_kwargs.pop("function_call", None)
|
| 543 |
|
| 544 |
if hasattr(response, "response_metadata"):
|
| 545 |
response.response_metadata = _strip_response_metadata_noise(response.response_metadata)
|
|
|
|
| 535 |
response = model.invoke(prompt_msgs)
|
| 536 |
|
| 537 |
# Clean up Gemini signatures and unhelpful metadata to reduce log noise and context bloat
|
| 538 |
+
# Note: We must preserve additional_kwargs EXACTLY as returned by Gemini.
|
| 539 |
+
# Popping 'function_call' or signatures will cause 400 errors in subsequent turns
|
| 540 |
+
# because Gemini requires these tokens/signatures to be echoed back in the history.
|
| 541 |
if hasattr(response, "additional_kwargs"):
|
| 542 |
+
pass # Keep everything including function_call and signatures
|
|
|
|
| 543 |
|
| 544 |
if hasattr(response, "response_metadata"):
|
| 545 |
response.response_metadata = _strip_response_metadata_noise(response.response_metadata)
|