mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-22 23:01:20 +03:00
bca4de0c63
* update build functions * sequential agents * update langchain to 0.2, added sequential agent nodes * add marketplace templates * update howto wordings * Merge branch 'main' into feature/Seq-Agents # Conflicts: # pnpm-lock.yaml * update deprecated functions and add new sequential nodes * add marketplace templates * update marketplace templates, add structured output to llm node * add multi agents template * update llm node with bindmodels * update cypress version * update templates sticky note wordings * update tool node to include human in loop action * update structured outputs error from models * update cohere package to resolve google genai pipeThrough bug * update mistral package version, added message reconstruction before invoke seq agent * add HITL to agent * update state messages restructuring * update load and split methods for s3 directory
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import type { ClientOptions } from 'openai'
|
|
import { ChatOpenAI as LangchainChatOpenAI, OpenAIChatInput, LegacyOpenAIInput, AzureOpenAIInput } from '@langchain/openai'
|
|
import { BaseChatModelParams } from '@langchain/core/language_models/chat_models'
|
|
import { IMultiModalOption, IVisionChatModal } from '../../../src'
|
|
|
|
export class ChatOpenAI extends LangchainChatOpenAI implements IVisionChatModal {
|
|
configuredModel: string
|
|
configuredMaxToken?: number
|
|
multiModalOption: IMultiModalOption
|
|
id: string
|
|
|
|
constructor(
|
|
id: string,
|
|
fields?: Partial<OpenAIChatInput> &
|
|
Partial<AzureOpenAIInput> &
|
|
BaseChatModelParams & { configuration?: ClientOptions & LegacyOpenAIInput },
|
|
/** @deprecated */
|
|
configuration?: ClientOptions & LegacyOpenAIInput
|
|
) {
|
|
super(fields, configuration)
|
|
this.id = id
|
|
this.configuredModel = fields?.modelName ?? ''
|
|
this.configuredMaxToken = fields?.maxTokens
|
|
}
|
|
|
|
revertToOriginalModel(): void {
|
|
this.modelName = this.configuredModel
|
|
this.maxTokens = this.configuredMaxToken
|
|
}
|
|
|
|
setMultiModalOption(multiModalOption: IMultiModalOption): void {
|
|
this.multiModalOption = multiModalOption
|
|
}
|
|
|
|
setVisionModel(): void {
|
|
if (this.modelName !== 'gpt-4-turbo' && !this.modelName.includes('vision')) {
|
|
this.modelName = 'gpt-4-turbo'
|
|
this.maxTokens = this.configuredMaxToken ? this.configuredMaxToken : 1024
|
|
}
|
|
}
|
|
}
|