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

Improve MD_JSON mode #490

Merged
merged 7 commits into from
Mar 6, 2024
Merged

Improve MD_JSON mode #490

merged 7 commits into from
Mar 6, 2024

Conversation

jxnl
Copy link
Collaborator

@jxnl jxnl commented Mar 6, 2024

Ellipsis 🚀 This PR description was created by Ellipsis for commit 3e44a6b.

Summary:

This PR improves the handling of MD_JSON mode by introducing utility functions to extract JSON from code blocks and streams, applying these functions across the codebase, updating the handling of response models, updating tests, and making changes in the documentation files.

Key points:

  • Introduced utility functions extract_json_from_codeblock, extract_json_from_stream, and extract_json_from_stream_async in utils.py.
  • Applied these utility functions in iterable.py, partial.py, and function_calls.py to improve handling of MD_JSON mode.
  • Updated handling of response models in patch.py.
  • Moved some utility functions from patch.py to utils.py.
  • Updated tests in util.py and added new tests in test_utils.py.
  • Made changes in the documentation files to reflect the updates made in the codebase.

Generated with ❤️ by ellipsis.dev

@jxnl jxnl marked this pull request as ready for review March 6, 2024 17:50
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 the entire pull request up to 85d584a
  • Looked at 468 lines of code in 7 files
  • Took 1 minute and 54 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_3C5li4I2DmYLhXjz


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

@@ -13,13 +14,21 @@ def from_streaming_response(
cls, completion: Iterable[Any], mode: Mode, **kwargs: Any
) -> Generator[BaseModel, None, None]: # noqa: ARG003
json_chunks = cls.extract_json(completion, mode)

if mode == Mode.MD_JSON:
json_chunks = extract_json_from_stream(json_chunks)
Copy link
Contributor

Choose a reason for hiding this comment

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

The new utility function extract_json_from_stream is used here to handle the MD_JSON mode. This change seems logical, but there are no updates to the documentation or tests to reflect this change. Please ensure that the documentation and tests are updated accordingly. This comment is also applicable to other places where similar changes are made.

@jxnl jxnl merged commit 3e44a6b into main Mar 6, 2024
10 of 11 checks passed
@jxnl jxnl deleted the better-json-mode branch March 6, 2024 17:57
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 8bc656f
  • Looked at 306 lines of code in 14 files
  • Took 2 minutes and 5 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_e0F0DWlkQ1YcZnLn


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 3e44a6b
  • Looked at 773 lines of code in 21 files
  • Took 1 minute and 59 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. docs/concepts/caching.md:33:
  • Assessed confidence : 50%
  • Comment:
    The PR modifies a lot of markdown files. Please ensure that if a new md file is created in docs, it's added to mkdocs.yml.
  • Reasoning:
    The PR introduces utility functions to handle MD_JSON mode and applies them across the codebase. The changes seem to be well implemented and the code is clean. The PR also includes updates to the documentation and tests, which is good. However, I noticed that the PR modifies a lot of files, including some markdown files in the docs directory. According to the rules, if a new md file is created in docs, it should be added to mkdocs.yml. I need to check if this rule has been followed.

Workflow ID: wflow_DKpzSOxxx2XeLkmN


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

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