mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
@@ -5,15 +5,15 @@ import { IVisionChatModal, IMultiModalOption } from '../../../src'
|
|||||||
|
|
||||||
export class BedrockChat extends LCBedrockChat implements IVisionChatModal {
|
export class BedrockChat extends LCBedrockChat implements IVisionChatModal {
|
||||||
configuredModel: string
|
configuredModel: string
|
||||||
configuredMaxToken: number
|
configuredMaxToken?: number
|
||||||
multiModalOption: IMultiModalOption
|
multiModalOption: IMultiModalOption
|
||||||
id: string
|
id: string
|
||||||
|
|
||||||
constructor(id: string, fields: BaseBedrockInput & BaseChatModelParams) {
|
constructor(id: string, fields: BaseBedrockInput & BaseChatModelParams) {
|
||||||
super(fields)
|
super(fields)
|
||||||
this.id = id
|
this.id = id
|
||||||
this.configuredModel = fields?.model || 'anthropic.claude-3-haiku-20240307-v1:0'
|
this.configuredModel = fields?.model || ''
|
||||||
this.configuredMaxToken = fields?.maxTokens ?? 256
|
this.configuredMaxToken = fields?.maxTokens
|
||||||
}
|
}
|
||||||
|
|
||||||
revertToOriginalModel(): void {
|
revertToOriginalModel(): void {
|
||||||
@@ -28,7 +28,7 @@ export class BedrockChat extends LCBedrockChat implements IVisionChatModal {
|
|||||||
setVisionModel(): void {
|
setVisionModel(): void {
|
||||||
if (!this.model.startsWith('claude-3')) {
|
if (!this.model.startsWith('claude-3')) {
|
||||||
super.model = 'anthropic.claude-3-haiku-20240307-v1:0'
|
super.model = 'anthropic.claude-3-haiku-20240307-v1:0'
|
||||||
super.maxTokens = 1024
|
super.maxTokens = this.configuredMaxToken ? this.configuredMaxToken : 1024
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ class ChatAnthropic_ChatModels implements INode {
|
|||||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||||
const temperature = nodeData.inputs?.temperature as string
|
const temperature = nodeData.inputs?.temperature as string
|
||||||
const modelName = nodeData.inputs?.modelName as string
|
const modelName = nodeData.inputs?.modelName as string
|
||||||
const maxTokensToSample = nodeData.inputs?.maxTokensToSample as string
|
const maxTokens = nodeData.inputs?.maxTokensToSample as string
|
||||||
const topP = nodeData.inputs?.topP as string
|
const topP = nodeData.inputs?.topP as string
|
||||||
const topK = nodeData.inputs?.topK as string
|
const topK = nodeData.inputs?.topK as string
|
||||||
const streaming = nodeData.inputs?.streaming as boolean
|
const streaming = nodeData.inputs?.streaming as boolean
|
||||||
@@ -143,7 +143,7 @@ class ChatAnthropic_ChatModels implements INode {
|
|||||||
streaming: streaming ?? true
|
streaming: streaming ?? true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxTokensToSample) obj.maxTokensToSample = parseInt(maxTokensToSample, 10)
|
if (maxTokens) obj.maxTokens = parseInt(maxTokens, 10)
|
||||||
if (topP) obj.topP = parseFloat(topP)
|
if (topP) obj.topP = parseFloat(topP)
|
||||||
if (topK) obj.topK = parseFloat(topK)
|
if (topK) obj.topK = parseFloat(topK)
|
||||||
if (cache) obj.cache = cache
|
if (cache) obj.cache = cache
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ export class ChatAnthropic extends LangchainChatAnthropic implements IVisionChat
|
|||||||
constructor(id: string, fields: Partial<AnthropicInput> & BaseLLMParams & { anthropicApiKey?: string }) {
|
constructor(id: string, fields: Partial<AnthropicInput> & BaseLLMParams & { anthropicApiKey?: string }) {
|
||||||
super(fields)
|
super(fields)
|
||||||
this.id = id
|
this.id = id
|
||||||
this.configuredModel = fields?.modelName || 'claude-3-haiku-20240307'
|
this.configuredModel = fields?.modelName || ''
|
||||||
this.configuredMaxToken = fields?.maxTokens ?? 256
|
this.configuredMaxToken = fields?.maxTokens ?? 2048
|
||||||
}
|
}
|
||||||
|
|
||||||
revertToOriginalModel(): void {
|
revertToOriginalModel(): void {
|
||||||
@@ -27,7 +27,7 @@ export class ChatAnthropic extends LangchainChatAnthropic implements IVisionChat
|
|||||||
setVisionModel(): void {
|
setVisionModel(): void {
|
||||||
if (!this.modelName.startsWith('claude-3')) {
|
if (!this.modelName.startsWith('claude-3')) {
|
||||||
super.modelName = 'claude-3-haiku-20240307'
|
super.modelName = 'claude-3-haiku-20240307'
|
||||||
super.maxTokens = 1024
|
super.maxTokens = this.configuredMaxToken ? this.configuredMaxToken : 2048
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { IMultiModalOption, IVisionChatModal } from '../../../src'
|
|||||||
|
|
||||||
export class ChatOpenAI extends LangchainChatOpenAI implements IVisionChatModal {
|
export class ChatOpenAI extends LangchainChatOpenAI implements IVisionChatModal {
|
||||||
configuredModel: string
|
configuredModel: string
|
||||||
configuredMaxToken: number
|
configuredMaxToken?: number
|
||||||
multiModalOption: IMultiModalOption
|
multiModalOption: IMultiModalOption
|
||||||
id: string
|
id: string
|
||||||
|
|
||||||
@@ -19,8 +19,8 @@ export class ChatOpenAI extends LangchainChatOpenAI implements IVisionChatModal
|
|||||||
) {
|
) {
|
||||||
super(fields, configuration)
|
super(fields, configuration)
|
||||||
this.id = id
|
this.id = id
|
||||||
this.configuredModel = fields?.modelName ?? 'gpt-3.5-turbo'
|
this.configuredModel = fields?.modelName ?? ''
|
||||||
this.configuredMaxToken = fields?.maxTokens ?? 256
|
this.configuredMaxToken = fields?.maxTokens
|
||||||
}
|
}
|
||||||
|
|
||||||
revertToOriginalModel(): void {
|
revertToOriginalModel(): void {
|
||||||
@@ -34,6 +34,6 @@ export class ChatOpenAI extends LangchainChatOpenAI implements IVisionChatModal
|
|||||||
|
|
||||||
setVisionModel(): void {
|
setVisionModel(): void {
|
||||||
super.modelName = 'gpt-4-vision-preview'
|
super.modelName = 'gpt-4-vision-preview'
|
||||||
super.maxTokens = 1024
|
super.maxTokens = this.configuredMaxToken ? this.configuredMaxToken : 1024
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -274,9 +274,8 @@ export abstract class FlowiseSummaryMemory extends ConversationSummaryMemory imp
|
|||||||
export interface IVisionChatModal {
|
export interface IVisionChatModal {
|
||||||
id: string
|
id: string
|
||||||
configuredModel: string
|
configuredModel: string
|
||||||
configuredMaxToken: number
|
|
||||||
multiModalOption: IMultiModalOption
|
multiModalOption: IMultiModalOption
|
||||||
|
configuredMaxToken?: number
|
||||||
setVisionModel(): void
|
setVisionModel(): void
|
||||||
revertToOriginalModel(): void
|
revertToOriginalModel(): void
|
||||||
setMultiModalOption(multiModalOption: IMultiModalOption): void
|
setMultiModalOption(multiModalOption: IMultiModalOption): void
|
||||||
|
|||||||
Reference in New Issue
Block a user