Skip to content

chatlas 0.9.0

Choose a tag to compare

@cpsievert cpsievert released this 02 Jul 21:34
· 124 commits to main since this release

New features

  • Chat gains a handful of new methods:
    • .register_mcp_tools_http_stream_async() and .register_mcp_tools_stdio_async(): for registering tools from a MCP server. (#39)
    • .get_tools() and .set_tools(): for fine-grained control over registered tools. (#39)
    • .set_model_params(): for setting common LLM parameters in a model-agnostic fashion. (#127)
    • .get_cost(): to get the estimated cost of the chat. Only popular models are supported, but you can also supply your own token prices. (#106)
    • .add_turn(): to add Turn(s) to the current chat history. (#126)
  • Tool functions passed to .register_tool() can now yield numerous results. (#39)
  • A ContentToolResultImage content class was added for returning images from tools. It is currently only works with ChatAnthropic. (#39)
  • A Tool can now be constructed from a pre-existing tool schema (via a new __init__ method). (#39)
  • The Chat.app() method gains a host parameter. (#122)
  • ChatGithub() now supports the more standard GITHUB_TOKEN environment variable for storing the API key. (#123)

Changes

Breaking Changes

  • Chat constructors (ChatOpenAI(), ChatAnthropic(), etc) no longer have a turns keyword parameter. Use the .set_turns() method instead to set the (initial) chat history. (#126)
  • Chat's .tokens() methods have been removed in favor of .get_tokens() which returns both cumulative tokens in the turn and discrete tokens. (#106)

Other Changes

  • Tool's constructor no longer takes a function as input. Use the new .from_func() method instead to create a Tool from a function. (#39)
  • .register_tool() now throws an exception when the tool has the same name as an already registered tool. Set the new force parameter to True to force the registration. (#39)

Improvements

  • ChatGoogle() and ChatVertex() now default to Gemini 2.5 (instead of 2.0). (#125)
  • ChatOpenAI() and ChatGithub() now default to GPT 4.1 (instead of 4o). (#115)
  • ChatAnthropic() now supports content_image_url(). (#112)
  • HTML styling improvements for ContentToolResult and ContentToolRequest. (#39)
  • Chat's representation now includes cost information if it can be calculated. (#106)
  • token_usage() includes cost if it can be calculated. (#106)

Bug fixes

  • Fixed an issue where httpx client customization (e.g., ChatOpenAI(kwargs = {"http_client": httpx.Client()})) wasn't working as expected (#108)

Developer APIs

  • The base Provider class now includes a name and model property. In order for them to work properly, provider implementations should pass a name and model along to the __init__() method. (#106)
  • Provider implementations must implement two new abstract methods: translate_model_params() and supported_model_params().