mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
use the forked AgentExecutor for all our agents
This commit is contained in:
parent
45470b9e55
commit
b81286c889
|
@ -2,7 +2,7 @@ import type { BaseOutputParser } from '@langchain/core/output_parsers';
|
|||
import { PromptTemplate } from '@langchain/core/prompts';
|
||||
import { ChatOpenAI } from '@langchain/openai';
|
||||
import type { AgentExecutorInput } from 'langchain/agents';
|
||||
import { AgentExecutor, OpenAIAgent } from 'langchain/agents';
|
||||
import { OpenAIAgent } from 'langchain/agents';
|
||||
import { BufferMemory, type BaseChatMemory } from 'langchain/memory';
|
||||
import { CombiningOutputParser } from 'langchain/output_parsers';
|
||||
import {
|
||||
|
@ -16,6 +16,7 @@ import { getConnectedTools, getPromptInputByType } from '@utils/helpers';
|
|||
import { getOptionalOutputParsers } from '@utils/output_parsers/N8nOutputParser';
|
||||
import { getTracingConfig } from '@utils/tracing';
|
||||
|
||||
import { AgentExecutor } from '../../AgentExecutor';
|
||||
import { extractParsedOutput } from '../utils';
|
||||
|
||||
export async function openAiFunctionsAgentExecute(
|
||||
|
|
|
@ -2,7 +2,7 @@ import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
|||
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
||||
import type { BaseOutputParser } from '@langchain/core/output_parsers';
|
||||
import { PromptTemplate } from '@langchain/core/prompts';
|
||||
import { AgentExecutor, ChatAgent, ZeroShotAgent } from 'langchain/agents';
|
||||
import { ChatAgent, ZeroShotAgent } from 'langchain/agents';
|
||||
import { CombiningOutputParser } from 'langchain/output_parsers';
|
||||
import {
|
||||
type IExecuteFunctions,
|
||||
|
@ -16,6 +16,7 @@ import { getOptionalOutputParsers } from '@utils/output_parsers/N8nOutputParser'
|
|||
import { throwIfToolSchema } from '@utils/schemaParsing';
|
||||
import { getTracingConfig } from '@utils/tracing';
|
||||
|
||||
import { AgentExecutor } from '../../AgentExecutor';
|
||||
import { checkForStructuredTools, extractParsedOutput } from '../utils';
|
||||
|
||||
export async function reActAgentAgentExecute(
|
||||
|
|
|
@ -7,7 +7,7 @@ import { RunnableSequence } from '@langchain/core/runnables';
|
|||
import type { Tool } from '@langchain/core/tools';
|
||||
import { DynamicStructuredTool } from '@langchain/core/tools';
|
||||
import type { AgentAction, AgentFinish } from 'langchain/agents';
|
||||
import { AgentExecutor, createToolCallingAgent } from 'langchain/agents';
|
||||
import { createToolCallingAgent } from 'langchain/agents';
|
||||
import { omit } from 'lodash';
|
||||
import { BINARY_ENCODING, jsonParse, NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
|
@ -21,6 +21,7 @@ import {
|
|||
} from '@utils/output_parsers/N8nOutputParser';
|
||||
|
||||
import { SYSTEM_MESSAGE } from './prompt';
|
||||
import { AgentExecutor } from '../../AgentExecutor';
|
||||
|
||||
function getOutputParserSchema(outputParser: N8nOutputParser): ZodObject<any, any, any, any> {
|
||||
const schema =
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { AgentExecutor } from 'langchain/agents';
|
||||
import type { OpenAIToolType } from 'langchain/dist/experimental/openai_assistant/schema';
|
||||
import { OpenAIAssistantRunnable } from 'langchain/experimental/openai_assistant';
|
||||
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
|
@ -14,6 +13,7 @@ import { getConnectedTools } from '@utils/helpers';
|
|||
import { getTracingConfig } from '@utils/tracing';
|
||||
|
||||
import { formatToOpenAIAssistantTool } from './utils';
|
||||
import { AgentExecutor } from '../Agent/AgentExecutor';
|
||||
|
||||
export class OpenAiAssistant implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import type { BaseMessage } from '@langchain/core/messages';
|
||||
import { AgentExecutor } from 'langchain/agents';
|
||||
import type { OpenAIToolType } from 'langchain/dist/experimental/openai_assistant/schema';
|
||||
import { OpenAIAssistantRunnable } from 'langchain/experimental/openai_assistant';
|
||||
import type { BufferWindowMemory } from 'langchain/memory';
|
||||
|
@ -22,6 +21,7 @@ import { promptTypeOptions } from '@utils/descriptions';
|
|||
import { getConnectedTools } from '@utils/helpers';
|
||||
import { getTracingConfig } from '@utils/tracing';
|
||||
|
||||
import { AgentExecutor } from '../../../../agents/Agent/AgentExecutor';
|
||||
import { formatToOpenAIAssistantTool } from '../../helpers/utils';
|
||||
import { assistantRLC } from '../descriptions';
|
||||
|
||||
|
|
Loading…
Reference in a new issue