Repository navigation
Make 0.2.0 run on Pixeltable 0.7.17 - #27
Conversation
A changed model updates the chat pipeline, max_tokens reaches every provider, and the OpenAI tool follow-up no longer re-sends tools. Co-authored-by: Cursor <cursoragent@cursor.com>
| if "max_tokens" not in merged and "max_completion_tokens" not in merged: | ||
| merged["max_tokens"] = max_tokens |
There was a problem hiding this comment.
🔴 Reasoning-model chats reject the token cap
For an OpenAI reasoning model such as o3, openai_model_kwargs injects unsupported max_tokens by default. The provider rejects the request, so chats that previously worked fail.
Learn more
The OpenAI agent accepts a caller-selected model, while openai_model_kwargs inserts max_tokens for every model lacking a token option. Reasoning models such as o3 require max_completion_tokens instead. This makes a default-configured chat fail even though its model and prompt are valid. The selected model is available when the provider call builds the arguments, but is not passed into the helper.
Example: Construct an OpenAI agent with model="o3" and call chat("Hello") without chat_kwargs. The helper supplies max_tokens=4096; the API rejects that parameter rather than returning a reply.
Recommended fix: Pass the model to openai_model_kwargs and select the supported cap key for that model, preserving an explicitly supplied max_completion_tokens or max_tokens. Add a test for a reasoning-model request without caller-supplied options.
Was this helpful? React with 👍 or 👎 to provide feedback.
| buf = io.BytesIO() | ||
| image.save(buf, format="JPEG") |
There was a problem hiding this comment.
🔴 Transparent Gemini images abort chats
When chat() receives an RGBA image, create_content saves it as JPEG without converting its mode. Pillow rejects the image before Gemini receives the request.
Learn more
The chat API accepts PIL images, including RGBA images commonly loaded from PNG files. Gemini's new image path saves every image directly as JPEG. Pillow cannot encode an RGBA image as JPEG, so the turn fails during prompt construction and never reaches the provider.
Example: Pass Image.new("RGBA", (8, 8), (255, 0, 0, 128)) to a Gemini agent's chat("Describe this", image=image). The save raises an error rather than returning a description.
Recommended fix: Convert unsupported modes before JPEG encoding, deciding how to composite transparency, or use PNG and its matching MIME type for images with transparency. Extend the image test to cover an RGBA image.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
SchemaConflictstays for editsupdate_all()refuses.max_tokenson OpenAI, Anthropic, Gemini, and Bedrock. Replace retired Anthropic and Gemini model ids, send Bedrock images in Converse blocks, and pass Gemini images as inline parts.Agent(), and add provider extras.Test plan
uv run pytest tests/ -m "not live"on locked Pixeltable 0.7.17 (93 passed)pip install -e . --no-deps,tests/test_smoke.py(53 passed)pytest tests/test_openai.py -m live(basic chat and tool calling)release.ymldry run, then tagv0.2.0after the checks are greenMade with Cursor