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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support anthropic tools #569

Merged
merged 9 commits into from
Apr 5, 2024
Merged

feat: support anthropic tools #569

merged 9 commits into from
Apr 5, 2024

Conversation

jxnl
Copy link
Owner

@jxnl jxnl commented Apr 4, 2024

Ellipsis 🚀 This PR description was created by Ellipsis for commit 1bbd8db.

Summary:

This PR introduces support for anthropic tools in the instructor library, updates several functions and classes, adds and updates tests, includes a new dependency, updates the poetry.lock file, and updates documentation files.

Key points:

  • Updated from_anthropic function in client_anthropic.py to support ANTHROPIC_TOOLS mode.
  • Updated OpenAISchema class in function_calls.py to handle anthropic schema.
  • Updated process_response function in process_response.py to handle responses in the anthropic tools mode.
  • Added a new test file test.py and updated test_simple.py.
  • Updated pyproject.toml to include anthropic dependency.
  • Updated poetry.lock file, changing the optional status of several dependencies to false.
  • Updated documentation files in docs directory and added a new md file docs/hub/anthropic.md.
  • Updated README.md file.

Generated with ❤️ by ellipsis.dev

@jxnl jxnl marked this pull request as ready for review April 4, 2024 20:54
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Apr 4, 2024
Copy link

cloudflare-pages bot commented Apr 4, 2024

Deploying instructor with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1bbd8db
Status:⚡️  Build in progress...

View logs

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 the entire pull request up to 3dc0958
  • Looked at 405 lines of code in 8 files
  • Took 2 minutes and 10 seconds to review
More info
  • Skipped 0 files when reviewing.
  • Skipped posting 4 additional comments because they didn't meet confidence threshold of 85%.
1. instructor/client_anthropic.py:37:
  • Assessed confidence : 50%
  • Comment:
    The changes in this file seem to be logically correct. However, it would be beneficial to update the tests to ensure the correct functioning of these changes.
  • Reasoning:
    The PR is about supporting anthropic tools. The changes include modifications in the existing files and deletion of a file. The changes seem to be logically correct. However, there are no updates in the documentation or tests to reflect these changes.
2. instructor/function_calls.py:19:
  • Assessed confidence : 50%
  • Comment:
    The changes in this file seem to be logically correct. However, it would be beneficial to update the tests to ensure the correct functioning of these changes.
  • Reasoning:
    The PR includes changes in the 'function_calls.py' file. The changes seem to be logically correct. However, it would be beneficial to update the tests to ensure the correct functioning of these changes.
3. instructor/test.py:1:
  • Assessed confidence : 50%
  • Comment:
    This file seems to be a test file. Please ensure that this file is added to the test suite.
  • Reasoning:
    The PR includes a new file 'test.py'. This file seems to be a test file. However, it is not clear if this file is added to the test suite.
4. tests/llm/test_anthropic/evals/test_simple.py:7:
  • Assessed confidence : 50%
  • Comment:
    The changes in this file seem to be logically correct. However, it would be beneficial to run the tests to ensure the correct functioning of these changes.
  • Reasoning:
    The PR includes changes in the 'test_simple.py' file. The changes seem to be logically correct. However, it would be beneficial to run the tests to ensure the correct functioning of these changes.

Workflow ID: wflow_lOO6Khiub3d7gpFw


Not what you expected? You can customize the content of the reviews using rules. Learn more here.

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.

❌ Changes requested.

  • Performed an incremental review on 11aa65e
  • Looked at 16 lines of code in 1 files
  • Took 1 minute and 41 seconds to review
More info
  • Skipped 0 files when reviewing.
  • Skipped posting 0 additional comments because they didn't meet confidence threshold of 85%.

Workflow ID: wflow_kiQfh9ZEWT6L9CzK


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. We'll respond in a few minutes. Learn more here.

@@ -56,6 +56,9 @@ mkdocs-rss-plugin = "^1.12.0"
mkdocs-minify-plugin = "^0.8.0"
mkdocs-redirects = "^1.2.1"

[tool.poetry.group.anthropic.dependencies]
anthropic = "^0.23.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

The anthropic dependency is declared twice in this file. It's already declared as an optional dependency on line 30. Please remove this redundant declaration.

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!

  • Performed an incremental review on 75a3598
  • Looked at 31 lines of code in 1 files
  • Took 2 minutes and 12 seconds to review
More info
  • Skipped 0 files when reviewing.
  • Skipped posting 1 additional comments because they didn't meet confidence threshold of 85%.
1. pyproject.toml:70:
  • Assessed confidence : 100%
  • Grade: 0%
  • Comment:
    The PR introduces a new dependency 'anthropic'. Please ensure that the documentation is updated to reflect this new dependency.
  • Reasoning:
    The PR introduces a new dependency 'anthropic' in the pyproject.toml file. However, the PR description does not mention any changes in the documentation to reflect this new dependency. As per the best practices, any change in the library code, especially the addition of a new dependency, should be accompanied by corresponding updates in the documentation.

Workflow ID: wflow_buu45pbA8ToOGUhQ


Not what you expected? You can customize the content of the reviews using rules. Learn more here.

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!

  • Performed an incremental review on b3853c2
  • Looked at 16 lines of code in 1 files
  • Took 2 minutes and 4 seconds to review
More info
  • Skipped 0 files when reviewing.
  • Skipped posting 1 additional comments because they didn't meet confidence threshold of 85%.
1. pyproject.toml:71:
  • Assessed confidence : 100%
  • Grade: 0%
  • Comment:
    The PR diff suggests that the [tool.poetry.extras] section was removed, but the provided file content still includes it. Please double-check the changes made in the pyproject.toml file.
  • Reasoning:
    The PR diff shows that the [tool.poetry.extras] section was removed from the pyproject.toml file. However, the file content provided does not reflect this change. It seems like there might be a mistake in the diff. I need to comment on this discrepancy and suggest the author to double-check the changes made in the pyproject.toml file.

Workflow ID: wflow_DfEUIXM4pP8FsPjI


Not what you expected? You can customize the content of the reviews using rules. Learn more here.

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!

  • Performed an incremental review on ad36fa6
  • Looked at 86 lines of code in 2 files
  • Took 1 minute and 41 seconds to review
More info
  • Skipped 0 files when reviewing.
  • Skipped posting 2 additional comments because they didn't meet confidence threshold of 85%.
1. instructor/function_calls.py:65:
  • Assessed confidence : 80%
  • Comment:
    The anthropic_schema method is now directly accessing the openai_schema method after the removal of the model_schema method. This could potentially lead to incorrect behavior as the anthropic_schema method might not be expecting the same output as the openai_schema method. Please ensure that this change is intended and that it does not introduce any bugs.
  • Reasoning:
    The changes in the OpenAISchema class in function_calls.py seem to be a bit confusing. The model_schema method has been removed and its logic has been moved to the openai_schema method. However, the model_schema method was also being called in the anthropic_schema method, which now directly accesses the openai_schema method. This could potentially lead to incorrect behavior as the anthropic_schema method might not be expecting the same output as the openai_schema method.
2. instructor/dsl/partial.py:131:
  • Assessed confidence : 50%
  • Comment:
    The model_from_chunks and model_from_chunks_async methods have been updated to handle cases where potential_object is None. Please ensure that this change doesn't introduce any unexpected behavior in other parts of the code that use these methods.
  • Reasoning:
    In the partial.py file, the model_from_chunks and model_from_chunks_async methods have been updated to handle cases where potential_object is None. This is a good change as it prevents potential NoneType errors. However, it's important to ensure that this change doesn't introduce any unexpected behavior in other parts of the code that use these methods.

Workflow ID: wflow_DaLtnUKTn7raMrNj


Not what you expected? You can customize the content of the reviews using rules. Learn more here.

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!

  • Performed an incremental review on 7a01c07
  • Looked at 199 lines of code in 1 files
  • Took 2 minutes and 48 seconds to review
More info
  • Skipped 0 files when reviewing.
  • Skipped posting 1 additional comments because they didn't meet confidence threshold of 85%.
1. poetry.lock:125:
  • Assessed confidence : 80%
  • Comment:
    It seems like the 'optional' field for all dependencies has been changed from 'true' to 'false'. Could you please clarify why this change was necessary? If these dependencies are not required for all installations, it might be better to keep them as optional.
  • Reasoning:
    The PR description mentions that a new dependency has been added, and the diff confirms this. However, it's not clear why the 'optional' field for all dependencies in the poetry.lock file has been changed from 'true' to 'false'. This could potentially cause issues if these dependencies are not actually required for all installations of the project.

Workflow ID: wflow_bGZpnsQs6gaz2sXm


Not what you expected? You can customize the content of the reviews using rules. Learn more here.

@jxnl jxnl merged commit 2076079 into main Apr 5, 2024
6 of 12 checks passed
@jxnl jxnl deleted the anthro-tools branch April 5, 2024 03:42
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!

  • Performed an incremental review on 1bbd8db
  • Looked at 346 lines of code in 12 files
  • Took 1 minute and 40 seconds to review
More info
  • Skipped 1 files when reviewing.
  • Skipped posting 0 additional comments because they didn't meet confidence threshold of 85%.

Workflow ID: wflow_eTkFb8v1i5TyBbL0


Not what you expected? You can customize the content of the reviews using rules. Learn more here.

"role": "assistant",
"content": f"Validation Errors found:\n{exception}\nRecall the function correctly, fix the errors",
"role": "user",
"content": f"Validation Errors found:\n{exception}\nReca ll the function correctly, fix the errors from\n{response.content}",

Choose a reason for hiding this comment

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

Small typo: Rec all

"role": "assistant",
"content": f"Validation Errors found:\n{exception}\nRecall the function correctly, fix the errors",
"role": "user",
"content": f"Validation Errors found:\n{exception}\nReca ll the function correctly, fix the errors from\n{response.content}",
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be better to use the following format from official documentation to indicate an error?

{
  "role": "user",
  "content": [
    {
      "type": "tool_result",
      "tool_use_id": "toolu_01A09q90qw90lq917835lq9",
      "content": "ConnectionError: the weather service API is not available (HTTP 500)",
      "is_error": true
    }
  ]
}

Copy link
Owner Author

Choose a reason for hiding this comment

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

oh this is great are you able to kick of a PR

Copy link
Contributor

@lazyhope lazyhope Apr 7, 2024

Choose a reason for hiding this comment

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

Ok I will take a look at it tomorrow

PrathamSoni pushed a commit to EndexAI/instructor that referenced this pull request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants