mirror of
https://github.com/n8n-io/n8n.git
synced 2024-09-11 13:15:28 +03:00
fix(Anthropic Chat Model Node): Fix detection of chat models in docker build & add support Claude Haiku (#8953)
Signed-off-by: Oleg Ivaniv <me@olegivaniv.com> Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
parent
666867a236
commit
76041b8587
@ -26,6 +26,10 @@ const modelField: INodeProperties = {
|
||||
name: 'Claude 3 Sonnet(20240229)',
|
||||
value: 'claude-3-sonnet-20240229',
|
||||
},
|
||||
{
|
||||
name: 'Claude 3 Haiku(20240307)',
|
||||
value: 'claude-3-haiku-20240307',
|
||||
},
|
||||
{
|
||||
name: 'LEGACY: Claude 2',
|
||||
value: 'claude-2',
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { NodeConnectionType, NodeOperationError, jsonStringify } from 'n8n-workflow';
|
||||
import type { EventNamesAiNodesType, IDataObject, IExecuteFunctions } from 'n8n-workflow';
|
||||
import { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
||||
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
||||
import type { BaseOutputParser } from '@langchain/core/output_parsers';
|
||||
import type { BaseMessage } from '@langchain/core/messages';
|
||||
import { DynamicTool, type Tool } from '@langchain/core/tools';
|
||||
import type { BaseLLM } from '@langchain/core/language_models/llms';
|
||||
|
||||
export function getMetadataFiltersValues(
|
||||
ctx: IExecuteFunctions,
|
||||
@ -20,10 +21,10 @@ export function getMetadataFiltersValues(
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// TODO: Remove this function once langchain package is updated to 0.1.x
|
||||
// eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents
|
||||
export function isChatInstance(model: any): model is BaseChatModel {
|
||||
return model instanceof BaseChatModel;
|
||||
export function isChatInstance(model: unknown): model is BaseChatModel {
|
||||
const namespace = (model as BaseLLM | BaseChatModel).lc_namespace;
|
||||
|
||||
return namespace.includes('chat_models');
|
||||
}
|
||||
|
||||
export async function getOptionalOutputParsers(
|
||||
|
Loading…
Reference in New Issue
Block a user