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: add markdown yaml input mode to optimize input tokens #674

Closed
wants to merge 2 commits into from

Conversation

ssonal
Copy link
Contributor

@ssonal ssonal commented May 17, 2024

Addresses #654


🚀 This description was created by Ellipsis for commit 7c668e0

Summary:

Introduces MD_YAML mode to parse YAML inputs within markdown, updating necessary files and tests to support this new functionality.

Key points:

  • Added MD_YAML mode to handle YAML inputs in markdown.
  • Updated instructor/client.py, instructor/function_calls.py, instructor/mode.py, instructor/process_response.py, and instructor/retry.py to support new mode.
  • Added new utility function extract_json_from_yaml_codeblock in instructor/utils.py.
  • Included tests for MD_YAML mode in tests/llm/test_openai/test_modes.py.

Generated with ❤️ by ellipsis.dev

Copy link

sweep-ai bot commented May 17, 2024

Sweep: PR Review

Sweep is currently reviewing your pr...

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 7c668e0 in 1 minute and 39 seconds

More details
  • Looked at 223 lines of code in 7 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_YXhckZ45Xh1hPqc8


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.

@@ -70,6 +71,16 @@ def extract_json_from_codeblock(content: str) -> str:
return content[first_paren : last_paren + 1]


def extract_json_from_yaml_codeblock(content: str) -> str:
Copy link
Contributor

Choose a reason for hiding this comment

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

The function name extract_json_from_yaml_codeblock is misleading as it performs YAML to JSON conversion. Consider renaming it to reflect its functionality more accurately, such as convert_yaml_to_json.

@jxnl
Copy link
Collaborator

jxnl commented May 19, 2024

please add documentation on YAML in patching

@jxnl
Copy link
Collaborator

jxnl commented May 20, 2024

can you add the docs in patch.md? @ellipsis-dev

ellipsis-dev bot added a commit that referenced this pull request May 20, 2024
Copy link
Contributor

ellipsis-dev bot commented May 20, 2024

@jxnl, I have addressed your comments in pull request #688

@jxnl jxnl changed the title Add markdown yaml input mode to optimize input tokens feat: add markdown yaml input mode to optimize input tokens Jun 16, 2024
@jxnl jxnl closed this Aug 25, 2024
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