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

fix(groq): Feature/groq response format improvements #6754

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

allohamora
Copy link

This PR updates the langchain groq response_format type by replacing it with one from the groq-sdk and adds the example from #6708 to the documentation.

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Sep 13, 2024
Copy link

vercel bot commented Sep 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-docs ✅ Ready (Inspect) Visit Preview Sep 18, 2024 7:48am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ⬜️ Ignored (Inspect) Sep 18, 2024 7:48am

@dosubot dosubot bot added auto:documentation Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder auto:improvement Medium size change to existing code to handle new use-cases labels Sep 13, 2024
@jacoblee93 jacoblee93 changed the title Feature/groq response format improvements fix(groq): Feature/groq response format improvements Sep 13, 2024
@jacoblee93
Copy link
Collaborator

jacoblee93 commented Sep 13, 2024

Thanks, this looks good!

BTW you should also be able to pass it in at runtime if you don't want to use .bind():

await model.invoke(messages, { response_format: "json_object" });

@dosubot dosubot bot added the lgtm PRs that are ready to be merged as-is label Sep 13, 2024
"})\n",
"\n",
"// if you need a response format other than the default\n",
"const llmWithResponseFormat = llm.bind({ response_format: \"json_object\" });"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Or wait, does this need to be response_format: { type: "json_object" }? I think that's what OpenAI does

Copy link
Author

@allohamora allohamora Sep 14, 2024

Choose a reason for hiding this comment

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

Oh, yes, fixed in 7c6250a
image

@jacoblee93 jacoblee93 added the question Further information is requested label Sep 13, 2024
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Sep 14, 2024
@allohamora allohamora force-pushed the feature/groq-response-format-improvements branch from 20cda2c to 5f0c6a7 Compare September 14, 2024 09:45
@allohamora
Copy link
Author

Thanks, this looks good!

BTW you should also be able to pass it in at runtime if you don't want to use .bind():

await model.invoke(messages, { response_format: "json_object" });

I have added a Json invocation block with 2 ways to pass response_format here 5f0c6a7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:documentation Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder auto:improvement Medium size change to existing code to handle new use-cases lgtm PRs that are ready to be merged as-is question Further information is requested size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants