-
Notifications
You must be signed in to change notification settings - Fork 2.5k
groq[patch]: Support generic messages in messageToGroqRole #8078
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Hi @grace0950. Thanks for the contribution. In order to merge this you'll need to fix the formatting issue by running I'm also wondering, are you using generic messages? if so, for what purpose? |
@benjamincburns Hi! Thanks for the review.
Regarding your question: Please let me know if there’s anything else I should update! |
message.role !== "user" && | ||
message.role !== "function" | ||
) { | ||
console.warn(`Unknown message role: ${message.role}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.warn(`Unknown message role: ${message.role}`); | |
throw new Error( | |
`Unsupported message role: ${message.role}. Expected "system", "assistant", "user", or "function"` | |
); |
Description
This PR adds support for handling
generic
message types in themessageToGroqRole
function withinlibs/langchain-groq/src/chat_models.ts
.Previously, the Groq integration did not properly handle messages of type
generic
, which could result in runtime errors.This update introduces a new helper function
extractGenericMessageCustomRole
to correctly map these messages.🛠️ Changes
extractGenericMessageCustomRole
function to handleChatMessage
withgeneric
type.messageToGroqRole
to properly supportgeneric
messages.📢 Notes
yarn.lock
or workspace configurations.