instructor icon indicating copy to clipboard operation
instructor copied to clipboard

feat: add watsonx support

Open h0rv opened this issue 10 months ago • 3 comments

https://github.com/jxnl/instructor/issues/619


:rocket: This description was created by Ellipsis for commit 52131d0f3628e6050c93c9ca749f783dcf344177

Summary:

This PR adds support for IBM Watson AI in the instructor library, including a new example, updates to the instructor package and utils, and a new optional dependency in pyproject.toml.

Key points:

  • Added a new example file watsonx.py in the examples/watsonx directory.
  • Updated instructor package to include Watson AI support if ibm_watsonx_ai is installed.
  • Added a new file client_watsonx.py in the instructor package, which contains the function from_watsonx.
  • Updated the Provider enum in utils.py to include WATSONX.
  • Updated pyproject.toml to include ibm-watsonx-ai as an optional dependency.

Generated with :heart: by ellipsis.dev

h0rv avatar Apr 21 '24 23:04 h0rv

Yeah I think the easiest approach for this is to add LiteLLM support.

h0rv avatar Apr 22 '24 01:04 h0rv

Would be keen on the LiteLLM support. Then people who use Amazon Bedrock can get involved.

mattzcarey avatar Apr 22 '24 11:04 mattzcarey

LiteLLM PR draft

h0rv avatar Apr 23 '24 03:04 h0rv

LiteLLM support has been added, so I updated the docs to show how to use watsonx with via LiteLLM, so no new code changes.

Should I create a from_watsonx still and wrap that functionality for ease of use, or would that be redundant? If not, its ready for review!

h0rv avatar Apr 27 '24 15:04 h0rv

It sounds like you have made updates to the documentation to include information on how to use WatsonX with LiteLLM. Since there are no new code changes, we can focus on reviewing the existing code and documentation.

I can assist with various types of reviews on this pull request, such as:

  • Readability
  • Content
  • SEO
  • Vale

If you would like, I can review specific files or sections based on your preference. Just let me know which type of review you would like to prioritize or if you have any specific files in mind for review.

Regarding the decision to create a from_watsonx function for ease of use, I recommend considering the necessity and potential benefits it would bring to the users. If you believe it would enhance the usability and clarity of the code, it might be worth implementing. However, if it would be redundant or unnecessary, it could be omitted.

Please let me know your preferences for the review or if you have any specific files you would like me to focus on.

hyperlint-ai[bot] avatar Apr 27 '24 15:04 hyperlint-ai[bot]

Was waiting to test since my watsonx API key is on my work computer, but just tried it. I just updated LiteLLM to latest but it is still not out but it is on the docs. Likely will go out today so will bump the version when that happens

h0rv avatar Apr 27 '24 15:04 h0rv

Understood! It's great that you were able to test the WatsonX API key and that you have updated LiteLLM to the latest version. Since LiteLLM is not yet released but the documentation reflects the upcoming changes, it's a good idea to bump the version once LiteLLM is officially out.

If you need any assistance with updating the version or any other related tasks once LiteLLM is released, feel free to let me know. Additionally, if you would like to proceed with a review of the pull request before the version bump, just give me the go-ahead, and I can start the review process.

Feel free to reach out if you have any further questions or need assistance with anything else!

hyperlint-ai[bot] avatar Apr 27 '24 15:04 hyperlint-ai[bot]

Updated LiteLLM - examples tested and working

h0rv avatar Apr 28 '24 15:04 h0rv

Review of the Content in docs/examples/watsonx.md

Overall Feedback:

We classified the document as a tutorial and rated the content quality as 6/10. To enhance the quality to 8 or better, focus on improving clarity, conciseness, and the use of active voice. Ensure technical terms are clearly defined and provide a smoother transition between sections for better coherence.

Specific Feedback:

  1. Structured Outputs with IBM watsonx.ai:

    • Consider making the title more descriptive and engaging, such as Implementing Structured Outputs with IBM Watsonx.ai.
  2. watsonx.ai:

    • The heading could be more specific, like Setting Up Your Watsonx.ai Credentials.
  3. Example:

    • The heading could be more specific to reflect the content of the code example, like Python Example: Using Watsonx.ai for Model Inference.

Content Issues:

  1. watsonx.ai Section:

    • Clarify the sentence structure to specify obtaining API key and project ID.
    • Provide context or a brief description for the link to IBM product page.
  2. Example Section:

    • Explain the necessity of the code setting in the context of the example.
    • Correct a grammatical error in the code comment.

Based on the content review of docs/examples/watsonx.md, there are some areas that can be improved for better clarity and coherence. Consider addressing the highlighted issues to enhance the overall quality of the document.

If you would like further assistance with revising the content or have any specific areas you would like to focus on, feel free to let me know. Once the necessary adjustments are made, the document will be in better shape for users.

Let me know how you would like to proceed or if you need any additional support!

hyperlint-ai[bot] avatar Apr 28 '24 15:04 hyperlint-ai[bot]

Made those fixes

h0rv avatar Apr 28 '24 23:04 h0rv

Great job on making those fixes! It's important to ensure that the content is clear and accurate for users.

Since you have addressed the highlighted issues in the docs/examples/watsonx.md file, the document should now provide a better experience for readers.

If you would like, I can perform another content review to verify the changes and ensure that everything is in order. Just let me know if you would like to proceed with another review or if there are any specific areas you would like me to focus on.

Feel free to provide further instructions or requests for assistance!

hyperlint-ai[bot] avatar Apr 28 '24 23:04 hyperlint-ai[bot]