Skip to content

feat!(ContentToolResult): add a new model_format parameter #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 22, 2025

Conversation

cpsievert
Copy link
Collaborator

No description provided.

@cpsievert cpsievert force-pushed the feat/tool-result-format branch 3 times, most recently from e596a89 to 8fd958a Compare April 22, 2025 18:09
@cpsievert cpsievert force-pushed the feat/tool-result-format branch from 8fd958a to 7071503 Compare April 22, 2025 18:10
@cpsievert cpsievert requested a review from Copilot April 22, 2025 18:10
Copilot

This comment was marked as outdated.

@cpsievert cpsievert requested a review from Copilot April 22, 2025 20:52
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new model_format parameter to ContentToolResult to allow specifying how tool results should be formatted for the chat model, and it migrates JSON handling from the standard json library to orjson across the codebase.

  • Adds a new test (test_anthropic_image_tool) to validate tool result handling for images.
  • Updates ContentToolResult (and related functions) to support configurable formatting via model_format.
  • Replaces usage of json with orjson in several modules and adds orjson as a dependency.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_provider_anthropic.py Adds tests for a new image tool using ContentToolResult with the model_format parameter.
tests/conftest.py Introduces a fixture for test image directory references.
pyproject.toml Includes orjson as a dependency.
chatlas/_openai.py Migrates JSON serialization to orjson; serializes arguments in function messages.
chatlas/_ollama.py Updates JSON parsing to use orjson for model tag retrieval.
chatlas/_google.py Converts JSON handling for content to use orjson instead of json.
chatlas/_content.py Introduces custom formatting methods (_get_display_value and get_model_value) for tool results.
chatlas/_auto.py Updates environment variable parsing to use orjson.
chatlas/_anthropic.py Adjusts JSON parsing for streamed messages to use orjson and updates tool result formatting.
CHANGELOG.md Documents the new model_format parameter feature and the migration to orjson.

@cpsievert cpsievert marked this pull request as ready for review April 22, 2025 21:18
@cpsievert cpsievert merged commit b33422b into main Apr 22, 2025
6 checks passed
@cpsievert cpsievert deleted the feat/tool-result-format branch April 22, 2025 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant