Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

anthropic force tool #681

Merged
merged 1 commit into from
May 19, 2024
Merged

Conversation

Cruppelt
Copy link
Contributor

@Cruppelt Cruppelt commented May 18, 2024

馃殌 This description was created by Ellipsis for commit 5a3bff4

Summary:

This PR introduces a new tool choice in the anthropic tools mode and updates the anthropic library version to 0.26.0.

Key points:

  • Updated handle_response_model in /instructor/process_response.py to add a new tool choice for anthropic tools mode.
  • Updated anthropic library version from 0.23.1 to 0.26.0 in pyproject.toml.
  • Ensured consistency of anthropic version across different sections in pyproject.toml.

Generated with 鉂わ笍 by ellipsis.dev

Copy link

sweep-ai bot commented May 18, 2024

Sweep: PR Review

instructor/process_response.py

A new line was added to set the tool_choice key in the new_kwargs dictionary when the mode is ANTHROPIC_TOOLS.

Potential Issues

Sweep isn't 100% sure if the following are issues or not but they may be worth taking a look at.

  • The new line assumes that response_model has an attribute __name__, which may not be true for all possible response_model types, potentially causing an AttributeError.
  • new_kwargs["tool_choice"] = {"type": "tool", "name": response_model.__name__}

    View Diff


The following files were not reviewed because our filter identified them as typically non-human-readable or less important files (e.g., dist files, package.json, images). If this is an error, please let us know.

  • poetry.lock
  • pyproject.toml

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

馃憤 Looks good to me! Reviewed everything up to 5a3bff4 in 1 minute and 11 seconds

More details
  • Looked at 45 lines of code in 2 files
  • Skipped 1 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. instructor/process_response.py:283
  • Draft comment:
    Using response_model.__name__ directly can lead to an AttributeError if response_model is not a class or does not have a __name__ attribute. Consider checking if response_model has the attribute __name__ before accessing it, or handle this potential issue gracefully.
            new_kwargs['tool_choice'] = {'type': 'tool', 'name': getattr(response_model, '__name__', str(response_model))}
  • Reason this comment was not posted:
    Confidence of 30% on close inspection, compared to threshold of 85%.

Workflow ID: wflow_JRyAz2b7oR3lK4Vk


You can customize Ellipsis with 馃憤 / 馃憥 feedback, review rules, user-specific overrides, quiet mode, and more.

@Cruppelt
Copy link
Contributor Author

Local testing seems fine. Followed the guide from https://github.com/anthropics/anthropic-cookbook/blob/main/tool_use/tool_choice.ipynb to force a too.

@jxnl jxnl merged commit 791384c into jxnl:main May 19, 2024
2 of 12 checks passed
@Cruppelt Cruppelt deleted the feature/anthropic-force-tool-1 branch May 20, 2024 13:49
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.

None yet

2 participants