Skip to content

Commit 5ba4930

Browse files
committed
docs(vertexai): document non-finite tool call coercion
1 parent bc226f7 commit 5ba4930

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

libs/vertexai/langchain_google_vertexai/chat_models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,8 @@ def _append_to_content(
622622

623623

624624
def _json_safe_number(value: float) -> Union[str, float]:
625+
# Gemini tool calls sometimes surface +/-inf or NaN; JSON forbids those, so
626+
# coerce them to string markers before we hand them to json.dumps.
625627
if math.isnan(value):
626628
return "NaN"
627629
if math.isinf(value):

0 commit comments

Comments
 (0)