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: Writer integration #1167

Merged
merged 32 commits into from
Nov 21, 2024
Merged

Conversation

yanomaly
Copy link
Contributor

@yanomaly yanomaly commented Nov 11, 2024

Describe your changes

Add implementation of Writer AI provider

Issue ticket number and link

Issue #1165

Checklist before requesting a review

  • I have performed a self-review of my code
  • If it is a core feature, I have added thorough tests.
  • If it is a core feature, I have added documentation.

Important

Add integration with Writer AI provider, including new modes, functions, and tests for structured outputs and enterprise AI workflows.

  • Integration:
    • Add from_writer() function in client_writer.py to initialize Writer client with Writer and AsyncWriter.
    • Update __init__.py to include from_writer if writerai is available.
    • Add WRITER_TOOLS mode in mode.py.
  • Functionality:
    • Implement parse_writer_tools() in function_calls.py to handle Writer tool calls.
    • Update process_response.py to handle WRITER_TOOLS mode.
    • Add handle_writer_tools() in process_response.py for processing Writer tool responses.
    • Update reask.py to include reask_writer_tools() for handling re-asks in Writer mode.
  • Documentation:
    • Add writer-support.md in docs/blog/posts to announce Writer integration.
  • Testing:
    • Add tests in tests/llm/test_writer/ for various functionalities including format handling, retries, and streaming.
    • Add conftest.py to configure Writer API key for tests.
  • Dependencies:
    • Add writer-sdk to pyproject.toml as an optional dependency.

This description was created by Ellipsis for f28b4a4. It will automatically update as commits are pushed.

@ivanleomk ivanleomk marked this pull request as ready for review November 17, 2024 13:29
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. Reviewed everything up to f28b4a4 in 46 seconds

More details
  • Looked at 1073 lines of code in 18 files
  • Skipped 1 files when reviewing.
  • Skipped posting 7 drafted comments based on config settings.
1. docs/blog/posts/writer-support.md:80
  • Draft comment:
    There's a typo in the word 'meetingis'. It should be 'meeting is'.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The blog post contains a minor typo in the word 'meetingis'.
2. instructor/client_writer.py:30
  • Draft comment:
    The return type annotation should include instructor.AsyncInstructor for the case when the client is an instance of AsyncWriter.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The from_writer function in instructor/client_writer.py should return instructor.AsyncInstructor when the client is an instance of AsyncWriter. The return type annotation should reflect this possibility.
3. instructor/dsl/iterable.py:112
  • Draft comment:
    Consider refactoring the extract_json and extract_json_async methods to avoid code duplication, as they have similar logic for handling different modes.
  • Reason this comment was not posted:
    Confidence changes required: 30%
    The extract_json and extract_json_async methods in instructor/dsl/iterable.py and instructor/dsl/partial.py have similar logic for handling different modes. This could be refactored to avoid code duplication.
4. instructor/dsl/partial.py:246
  • Draft comment:
    Consider refactoring the extract_json and extract_json_async methods to avoid code duplication, as they have similar logic for handling different modes.
  • Reason this comment was not posted:
    Confidence changes required: 30%
    The extract_json and extract_json_async methods in instructor/dsl/iterable.py and instructor/dsl/partial.py have similar logic for handling different modes. This could be refactored to avoid code duplication.
5. instructor/function_calls.py:316
  • Draft comment:
    Ensure tool_calls is not empty before accessing its elements to avoid potential assertion errors.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The parse_writer_tools method in instructor/function_calls.py should handle cases where tool_calls might be empty to avoid assertion errors.
6. docs/blog/posts/writer-support.md:1
  • Draft comment:
    Please ensure this new markdown file is added to the mkdocs.yml to be included in the documentation.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The new markdown file should be added to the mkdocs.yml for documentation purposes.
7. instructor/dsl/partial.py:154
  • Draft comment:
    The method writer_model_from_chunks_async is functionally similar to model_from_chunks_async. Consider extending model_from_chunks_async to handle any specific variations needed.

  • method model_from_chunks_async (partial.py)

  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_NeZ1fYCYeyiKTdDa


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

instructor/dsl/partial.py Show resolved Hide resolved
@ivanleomk ivanleomk merged commit 7fa8bb0 into instructor-ai:main Nov 21, 2024
35 of 42 checks passed
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.

2 participants