Skip to content

Releases: posit-dev/chatlas

v0.18.1

21 May 16:09
3c40bc4

Choose a tag to compare

Improvements

  • Content.tagify() implementations (ContentToolRequest, ContentToolResult, ContentThinking) now annotate their return type as htmltools.Tagified and fully tagify their output, complying with htmltools 0.7.0's tightened Tagifiable contract. Embedding these contents inside another .tagify() recursion no longer trips the new boundary check in htmltools 0.7.0. (#311)

Bug fixes

  • ContentPDF is now exported from chatlas.types, matching all other Content subclasses. (#312)

Full changelog: https://github.com/posit-dev/chatlas/blob/main/CHANGELOG.md

chatlas 0.18.0

12 May 20:05

Choose a tag to compare

New features

  • New StreamController class for cooperative stream cancellation. Pass a controller to .stream() or .stream_async() and call controller.cancel() to stop the stream cleanly (e.g., from a Shiny "stop generating" button). The partial response is preserved in conversation history. (#279)

Improvements

  • ChatAnthropic() and ChatBedrockAnthropic() now use Anthropic's native structured outputs API for Claude 4.5+ models, enabling streaming with data_model. Older models fall back to the tool-based approach. A new structured_output_mode parameter ("auto", "native", or "tool") lets you override the auto-detection. (#263)
  • When a stream is interrupted (closed early, cancelled, or errors), the accumulated content is now saved as a partial AssistantTurn so conversation state isn't lost. Partial turns display [interrupted] (or the cancellation reason) in the Chat repr and are excluded from token/cost accounting. (#279)
  • ChatBedrockAnthropic() now defaults to cache="5m", enabling prompt caching by default — matching ChatAnthropic()'s behavior. (#308)
  • ChatOpenAI() now warns when base_url points to a non-OpenAI host, guiding users to ChatOpenAICompletions() for third-party backends like vLLM, Ollama, and LiteLLM. (#285)

Bug fixes

  • Fixed thinking content being silently dropped during streaming for completions-based providers (DeepSeek, Groq, OpenRouter, etc.). The streaming path was returning finalized ContentThinking objects instead of ContentThinkingDelta fragments, which the TurnAccumulator didn't recognize. (#301)
  • Fixed model_dump(mode="json") failing on Turns containing bytes fields (e.g., ContentPDF.data, thought_signature in ContentToolRequest/ContentThinking extras). Bytes values are now base64-encoded during serialization and decoded on validation, so JSON round-trips work correctly.
  • batch_chat(), batch_chat_text(), and batch_chat_structured() now correctly return None when wait=False and the job is still incomplete. Previously they returned [], making it impossible to distinguish "all requests failed" from "job not done yet". (#306)
  • ChatDatabricks() (and other ChatOpenAICompletions() providers) no longer fail with HTTP 400 when the conversation history contains empty assistant content, which can occur during tool calling. (#305)

chatlas 0.17.0

11 May 16:15

Choose a tag to compare

New features

  • ChatOpenAICompletions() (and providers built on it like ChatDeepSeek, ChatOpenRouter, etc.) now extracts reasoning_content from model responses as ContentThinking objects. A new preserve_thinking parameter controls whether reasoning content is sent back to the API in multi-turn conversations; it defaults to False but is set to True for ChatDeepSeek (required for V4 tool-calling) and ChatOpenRouter (recommended for quality). (#295)

Improvements

  • .stream() and .stream_async() now handle thinking content differently by mode. With content="text", thinking is suppressed entirely. With content="all", thinking fragments are yielded as ContentThinkingDelta objects with a phase property ("start", "body", or "end") that communicates block boundaries to downstream consumers without injecting synthetic strings into the stream. (#299, #297, #294)
  • Updated default models across all providers to current generation. (#292)
  • Updated token pricing data from LiteLLM. (#292)
  • ChatBedrockAnthropic() gains a reasoning parameter for extended thinking, matching the existing parameter on ChatAnthropic(). (#286)

Full changelog: https://github.com/posit-dev/chatlas/blob/main/CHANGELOG.md

chatlas 0.16.0

16 Apr 21:18

Choose a tag to compare

New features

  • New ChatLMStudio() provider for chatting with local models via LM Studio. (#280)
  • The .stream() and .stream_async() methods now yield ContentThinking objects (instead of plain strings) for thinking/reasoning content when content="all". This allows downstream packages like shinychat to provide specific UI for thinking content. (#276)
  • Built-in tools (tool_web_search(), tool_web_fetch()) now include description and annotations properties, making their metadata consistent with user-defined tools created by Tool(). (#278)

Bug fixes

  • Fixed OpenAI streaming crash (AttributeError: 'NoneType' object has no attribute 'output') caused by a new response.rate_limits.updated event emitted after response.completed. (#282)
  • Fixed tool calling with Google thinking models (e.g., gemini-3-flash-preview) failing with a 400 INVALID_ARGUMENT error about a missing thought_signature. The signature is now preserved and forwarded in subsequent turns. (#274)
  • OpenAI's web_search_call no longer errors on non-search action types like open_page and find_in_page. (#277)

chatlas 0.15.2

27 Feb 15:15
f1b483e

Choose a tag to compare

Bug fixes

  • Fixed compatibility with rich >= 14.3.0 and Anthropic SDK v0.82+. (#269)
  • Updated generated OpenAI types for SDK v2.22+. (#270)

chatlas 0.15.1

22 Jan 22:51

Choose a tag to compare

New features

  • .stream() and .stream_async() now support a data_model parameter for structured data extraction while streaming. (#262)
  • .to_solver() now supports a data_model parameter for structured data extraction in evals. When provided, the solver uses .chat_structured() instead of .chat() and outputs JSON-serialized data. (#264)

Bug fixes

  • Fixed ContentToolResult with an error not being JSON serializable. When a tool call failed, calling .get_turns() followed by .model_dump_json() would raise a PydanticSerializationError. (#267)

chatlas 0.15.0

06 Jan 15:55

Choose a tag to compare

New features

  • ChatOpenAI(), ChatAnthropic(), and ChatGoogle() gain a new reasoning parameter to easily opt-into, and fully customize, reasoning capabilities. (#202, #260)
    • A new ContentThinking content type was added and captures the "thinking" portion of a reasoning model. (#192)
  • Added "built-in" web search and URL fetch tools tool_web_search() and tool_web_fetch():
    • tool_web_search() is supported by OpenAI, Claude (Anthropic), and Google (Gemini).
    • tool_web_fetch() is supported by Claude (requires beta header) and Google.
    • New content types ContentToolRequestSearch, ContentToolResponseSearch, ContentToolRequestFetch, and ContentToolResponseFetch capture web tool interactions.
  • Added ToolBuiltIn class to assist with specifying provider-specific built-in tools. This enables provider-specific functionality like OpenAI's image generation to be registered and used as tools. Built-in tools pass raw provider definitions directly to the API rather than wrapping Python functions. (#214)
  • ChatOpenAI() and ChatAzureOpenAI() gain a new service_tier parameter to request a specific service tier (e.g., "flex" for slower/cheaper or "priority" for faster/more expensive). (#204)
  • ChatAuto() now accepts "claude" as an alias for "anthropic", reflecting Anthropic's rebranding of developer tools under the Claude name. (#239)

Changes

  • repr() now generally gives the same result as str() for many classes (Chat, Turn, Content, etc). This leads to a more human-readable result (and is closer to the result that gets echoed by .chat()). (#245)
  • The Chat.get_cost() method's options parameter was renamed to include. (#244)
  • When supplying a model to .register_tool(tool_func, model=ToolModel), the defaults for the model must match the tool_func defaults. Previously, if tool_func had defaults, but ToolModel didn't, those defaults would get silently ignored. (#253)

Improvements

  • Chat and Turn now have a _repr_markdown_ method and an overall improved repr() experience. (#245)
  • ChatSnowflake() now sets the application config parameter for partner identification. Defaults to "py_chatlas" but can be overridden via the SF_PARTNER environment variable. (#209)

Bug fixes

  • Fixed structured data extraction with ChatAnthropic() failing for Pydantic models containing nested types (e.g., list[NestedModel]). The issue was that $defs (containing nested type definitions) was incorrectly placed inside the schema, breaking JSON $ref pointer references. (#100)
  • Fixed MCP tools failing with OpenAI providers due to strict mode schema validation. OpenAI's strict mode rejects standard JSON Schema features like format: "uri" and requires all properties in the required array. MCP tools now set strict=false to use standard JSON Schema conventions. (#255)
  • Fixed MCP tools not working with ChatGoogle(). (#257)
  • Tool functions parameters that are typing.Annotated with a pydantic.Field (e.g., def add(x: Annotated[int, Field(description="First number")])) are now handled correctly. (#251)

chatlas 0.14.0

09 Dec 15:53

Choose a tag to compare

  • ChatOpenAI() (and ChatAzureOpenAI()) gain access to latest models, built-in tools, etc. as a result of moving to the new Responses API. (#192)
  • Added new family of functions (parallel_chat(), parallel_chat_text(), and parallel_chat_structured()) for submitting multiple prompts at once with some basic rate limiting toggles. (#188)
  • Tools can now return image or PDF content types, with content_image_file() or content_pdf_file() (#231).
    • As a result, the experimental ContentToolResultImage and ContentToolResultResource were removed since this new support for generally supporting ContentImage and ContentPDF renders those content types redundant.
  • Added support for systematic evaluation via Inspect AI. This includes:
    • A new .export_eval() method for exporting conversation history as an Inspect eval dataset sample. This supports multi-turn conversations, tool calls, images, PDFs, and structured data.
    • A new .to_solver() method for translating chat instances into Inspect solvers that can be used with Inspect's evaluation framework.
    • A new Turn.to_inspect_messages() method for converting turns to Inspect's message format.
    • Comprehensive documentation in the Evals guide.
  • ChatAnthropic() and ChatBedrockAnthropic() gain new cache parameter to control caching. For ChatAnthropic(), it defaults to "5m", which should (on average) reduce the cost of your chats. For ChatBedrockAnthropic(), it defaults to "none", since caching isn't guaranteed to be widely supported (#215)
  • Added rudimentary support for a new ContentThinking type. (#192)

Changes

  • ChatOpenAI() (and ChatAzureOpenAI()) move from OpenAI's Completions API to Responses API. If this happens to break behavior, change ChatOpenAI() -> ChatOpenAICompletions() (or ChatAzureOpenAI() -> ChatAzureOpenAICompletions()). (#192)
  • The Turn class is now a base class with three specialized subclasses: UserTurn, AssistantTurn, and SystemTurn. Use these new classes to construct turns by hand. (#224)
  • The .set_model_params() method no longer accepts kwargs. Instead, use the new chat.kwargs_chat attribute to set chat input parameters that persist across the chat session. (#212)
  • Provider implementations now require an additional .value_tokens() method. Previously, it was assumed that token info was logged and attached to the Turn as part of the .value_turn() method. The logging and attaching is now handled automatically. (#194)

Improvements

  • ChatAnthropic() and ChatBedrockAnthropic() now default to Claude Sonnet 4.5.
  • ChatGroq() now defaults to llama-3.1-8b-instant.
  • Chat.chat(), Chat.stream(), and related methods now automatically complete dangling tool requests when a chat is interrupted during a tool call loop, allowing the conversation to be resumed without causing API errors (#230).
  • content_pdf_file() and content_pdf_url() now include relevant filename information. (#199)

Bug fixes

  • .set_model_params() now works correctly for .*_async() methods. (#198)
  • .chat_structured() results are now included correctly into the multi-turn conversation history. (#203)
  • ChatAnthropic() now drops empty assistant turns to avoid API errors when tools return side-effect only results. (#226)

chatlas 0.13.2

02 Oct 19:13

Choose a tag to compare

Improvements

  • ContentToolResult's .get_model_value() method now calls .to_json(orient="record") (instead of .to_json()) when relevant. As a result, if a tool call returns a Pandas DataFrame (or similar), the model now receives a less confusing (and smaller) JSON format. (#183)

Bug fixes

  • ChatAzureOpenAI() and ChatDatabricks() now work as expected when a OPENAI_API_KEY environment variable isn't present. (#185)

chatlas 0.13.1

18 Sep 18:08

Choose a tag to compare

Bug fixes

  • ChatGithub() once again uses the appropriate base_url when generating reponses (problem introduced in v0.11.0). (#182)