8000 new parser for json + thinking output + tests using deepseek r1 on groq by roodboi · Pull Request #195 · 567-labs/instructor-js · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

new parser for json + thinking output + tests using deepseek r1 on groq #195

< 8000 summary id="button-53efe7650cd6d6e9" class="btn btn-sm btn-primary m-0 ml-0 ml-md-2" > 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

Merged
merged 4 commits into from
Jan 27, 2025

Conversation

roodboi
Copy link
Collaborator
@roodboi roodboi commented Jan 27, 2025

Important

Adds THINKING_MD_JSON mode for parsing JSON with thinking blocks, updates dependencies, and includes tests for GROQ provider.

  • Behavior:
    • Adds THINKING_MD_JSON mode to parse thinking blocks from markdown JSON responses in providers.ts and instructor.ts.
    • Updates MODE_TO_RESPONSE_PARSER to include thinkingJsonParser for THINKING_MD_JSON mode.
    • Supports THINKING_MD_JSON mode for GROQ provider with model deepseek-r1-distill-llama-70b.
  • Tests:
    • Adds deepseek.test.ts to test THINKING_MD_JSON mode with GROQ provider.
    • Updates mode.test.ts to include THINKING_MD_JSON mode in test cases.
  • Dependencies:
    • Updates zod-stream to 3.0.0 in package.json.
  • Workflows:
    • Adds GROQ_API_KEY to test-pr.yml and test.yml.
  • Misc:
    • Adds Dimitri Kennedy to contributors in package.json.

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

Copy link
changeset-bot bot commented Jan 27, 2025

🦋 Changeset detected

Latest commit: e78b419

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@instructor-ai/instructor Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this 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.

👍 Looks good to me! Reviewed everything up to ffd8b76 in 1 minute and 37 seconds

More details
  • Looked at 275 lines of code in 7 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. src/constants/providers.ts:12
  • Draft comment:
    Consider adding a default parser to MODE_TO_RESPONSE_PARSER to handle modes that don't have a specific parser defined.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    While having a default parser might seem like a good practice, we don't have enough context to know if other modes need parsers or if they're handled differently elsewhere. The code specifically adds only thinkingJsonParser for THINKING_MD_JSON mode, which seems intentional. Adding a default parser could mask errors if a mode actually needs specific parsing.
    The comment might be identifying a legitimate architectural concern - what happens when other modes don't have parsers? There could be potential runtime errors.
    Without seeing how this code is used elsewhere, we can't be certain that a default parser is needed or even appropriate. The explicit mapping might be intentional to catch missing parser errors early.
    The comment should be deleted as it makes assumptions about the architecture without sufficient context and may suggest a change that goes against the intentional design.
2. src/instructor.ts:192
  • Draft comment:
    Ensure that the default parser used in chatCompletionStandard is appropriate for all modes or consider adding a warning if a mode-specific parser is not found.
  • Reason this comment was not posted:
    Confidence changes required: 70%
    The chatCompletionStandard method uses OAIResponseParser as a default parser, which might not be suitable for all modes. This could lead to incorrect parsing if a mode-specific parser is not defined.
3. src/types/index.ts:64
  • Draft comment:
    Ensure the thinking property in CompletionMeta is consistently used across the codebase.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The thinking property is added to CompletionMeta in multiple places. This should be consistent across the codebase to avoid potential issues.
4. tests/deepseek.test.ts:58
  • Draft comment:
    Consider using a configuration or environment variable for the model name to improve flexibility and maintainability.
  • Reason this comment was not posted:
    Confidence changes required: 60%
    The test case for GROQ provider in deepseek.test.ts uses a hardcoded model name. This could lead to issues if the model name changes or is not available.
5. tests/deepseek.test.ts:50
  • Draft comment:
    The logic for creating an Instructor instance and making a call to client.chat.completions.create is repeated here and in tests/mode.test.ts. Consider refactoring to avoid code duplication.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    While DRY is an important principle, I can't verify the duplication without seeing mode.test.ts. The setup code here seems like fairly standard test setup that might need to vary between tests. Test files often need similar but slightly different setups.
    I might be too quick to dismiss potential duplication. If the setup is exactly the same, having a shared test utility function could make the tests more maintainable.
    Without seeing the other file, I can't be confident enough that this is problematic duplication versus necessary test setup variation. The comment requires more context to be actionable.
    Delete the comment since we can't verify the duplication claim without seeing the other file, and test setup code often needs to vary between test cases.
6. tests/mode.test.ts:128
  • Draft comment:
    The logic for creating an Instructor instance and making a call to client.chat.completions.create is repeated here and in tests/deepseek.test.ts. Consider refactoring to avoid code duplication.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_ZMnFuo7QM9X6Nxgm


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
cloudflare-workers-and-pages bot commented Jan 27, 2025

Deploying instructor-js with  Cloudflare Pages  Cloudflare Pages

Latest commit: 718d093
Status: ✅  Deploy successful!
Preview URL: https://7b1946a7.instructor-js.pages.dev
Branch Preview URL: https://thinking-mode.instructor-js.pages.dev

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! Incremental review on 6e2de78 in 12 seconds

More details
  • Looked at 25 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. .github/workflows/test-pr.yml:26
  • Draft comment:
    Ensure that the GROQ_API_KEY is correctly set in the repository secrets to avoid runtime errors.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR adds a new environment variable GROQ_API_KEY to the GitHub Actions workflows. This is consistent across both test-pr.yml and test.yml. The change seems correct and necessary for the new functionality.
2. .github/workflows/test-pr.yml:26
  • Draft comment:
    Ensure that documentation and tests are updated to reflect the addition of GROQ_API_KEY.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_IlBl15huF80s6ZYi


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@roodboi roodboi changed the title adad parasing support for models with json + thinking output + tests using deepseek r1 on groq adad parsing support for models with json + thinking output + tests using deepseek r1 on groq Jan 27, 2025
@roodboi roodboi changed the title adad parsing support for models with json + thinking output + tests using deepseek r1 on groq new parser for json + thinking output + tests using deepseek r1 on groq Jan 27, 2025
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! Incremental review on 718d093 in 16 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. tests/deepseek.test.ts:43
  • Draft comment:
    If the library code or functionality has changed, ensure that the documentation and tests are updated accordingly.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_Ey3tgEL4eB9E7LWu


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

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! Incremental review on e78b419 in 20 seconds

More details
  • Looked at 11 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. .changeset/little-cougars-bow.md:5
  • Draft comment:
    Ensure the description is clear and concise, explaining the purpose of the new mode.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The changeset file is correctly formatted and provides a clear description of the change.
2. .changeset/little-cougars-bow.md:1
  • Draft comment:
    Ensure this new markdown file is added to mkdocs.yml.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_rcMJqHSSM3MYftRa


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@roodboi roodboi merged commit 3aac90e into main Jan 27, 2025
1 of 3 checks passed
@roodboi roodboi deleted the thinking-mode branch January 27, 2025 23:36
@roodboi roodboi mentioned this pull request Jan 27, 2025
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
0