Download Latest Version 0.65.10 source code.zip (59.2 MB)
Email in envelope

Get an email when there's a new version of Langroid

Home / 0.65.10
Name Modified Size InfoDownloads / Week
Parent folder
langroid-0.65.10-py3-none-any.whl 2026-07-23 454.2 kB
langroid-0.65.10.tar.gz 2026-07-23 403.7 kB
0.65.10 source code.tar.gz 2026-07-23 58.8 MB
0.65.10 source code.zip 2026-07-23 59.2 MB
README.md 2026-07-23 2.5 kB
Totals: 5 Items   118.9 MB 0

0.65.10 — Faithful "no content" for LLM messages (fixes Gemini 3.x tool calls)

This release fixes tool calls with Gemini 3.x models (e.g. gemini-3.5-flash-lite, gemini-3.6-flash) on Vertex AI, originally diagnosed and fixed by @alexagr. Langroid now carries an assistant turn's "no content" faithfully as None instead of padding it to a single space, so tool-call turns no longer trip Gemini's 400 INVALID_ARGUMENT.

:::bash
pip install -U langroid

The bug — a padded space breaks Gemini 3.x tool calls (#1062)

An assistant turn that is only a tool/function call has no text content. ChatDocument.to_LLMMessage padded such empty content with a single space (" ") "because some LLM APIs don't like an empty msg", so every stored tool-call turn carried content=" ".

Gemini 3.x rejects an assistant turn that has both a tool/function call and non-empty text content with 400 INVALID_ARGUMENT — breaking every conversation on the turn that sends a tool result back to the model.

The fix — carry the response shape faithfully, don't fabricate content

Langroid now distinguishes "missing" (None, omitted on the wire) from "present-but-empty" ("") end to end:

  • LLMResponse.message is now Optional[str]; a tool-only response keeps message=None rather than being coerced to "".
  • ChatDocument gains an explicit content_is_none flag (the content field itself stays a mandatory str), which is authoritative when reconstructing the message — a serialized/round-tripped tool-call turn cannot resurrect stale text alongside its calls.
  • ChatDocument.to_LLMMessage reproduces "no content" as LLMMessage.content=None (now Optional[str]) instead of " ".
  • LLMMessage.api_dict drops None content from the payload, and pads a lone space only when a message would otherwise be entirely empty (no content and no tool/function call) — the case older Gemini models reject.

None-safety guards were added for the consumers of the now-optional fields (token counting, truncation, display callbacks, cached-response replay), with regression tests across the LLMResponse → ChatDocument → LLMMessage pipeline for both the tool_calls and legacy function_call shapes.

No action needed for existing code — this is a transparent fix. If you use Gemini 3.x models on Vertex AI with tools, they now work.

Full Changelog: https://github.com/langroid/langroid/compare/0.65.9...0.65.10

Source: README.md, updated 2026-07-23