-
-
Notifications
You must be signed in to change notification settings - Fork 23.1k
feat: Add image upload support to ChatOpenRouter node #5471
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,30 @@ | ||||||
| import { ChatOpenAI as LangchainChatOpenAI, ChatOpenAIFields } from '@langchain/openai' | ||||||
| import { IMultiModalOption, IVisionChatModal } from '../../../src' | ||||||
|
|
||||||
| export class ChatOpenRouter extends LangchainChatOpenAI implements IVisionChatModal { | ||||||
| configuredModel: string | ||||||
| configuredMaxToken?: number | ||||||
| multiModalOption: IMultiModalOption | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||
| id: string | ||||||
|
|
||||||
| constructor(id: string, fields?: ChatOpenAIFields) { | ||||||
| super(fields) | ||||||
| this.id = id | ||||||
| this.configuredModel = fields?.modelName ?? '' | ||||||
| this.configuredMaxToken = fields?.maxTokens | ||||||
| } | ||||||
|
|
||||||
| revertToOriginalModel(): void { | ||||||
| this.model = this.configuredModel | ||||||
| this.maxTokens = this.configuredMaxToken | ||||||
| } | ||||||
|
|
||||||
| setMultiModalOption(multiModalOption: IMultiModalOption): void { | ||||||
| this.multiModalOption = multiModalOption | ||||||
| } | ||||||
|
|
||||||
| setVisionModel(): void { | ||||||
| // pass - OpenRouter models don't need model switching | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
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.
Concatenating the exception object directly with a string can lead to unhelpful error messages like
[object Object]. It's better to use the exception'smessageproperty if it's anErrorinstance, or convert it to a string otherwise, to provide more informative error details.