#2716·instructor

Gemini MD_JSON 会改变调用者的消息:没有系统消息的列表,以及带有一个系统字典的列表

作者: chrikrah创建于 2026年9月28日更新于 2026年9月29日

`GeminiJSONHandler.prepare_request` copies the kwargs dict and not the message dicts inside it. `patch.py:231` passes the incoming kwargs unchanged. With a system message first, `handle_gemini_json` appends the JSON instruction to a dict the caller owns, at `Gemini/utils.py:436`. A second call appends it again. Without a system message, `new_kwargs.setdefault("messages", []).insert(...)` at `:432` inserts into the list the caller passed.

内容来源: 567-labs/instructor