{"version":3,"file":"types.cjs","names":["BaseOutputParser"],"sources":["../../src/agents/types.ts"],"sourcesContent":["import type { Runnable } from \"@langchain/core/runnables\";\nimport { BaseOutputParser } from \"@langchain/core/output_parsers\";\nimport type { AgentAction, AgentFinish } from \"@langchain/core/agents\";\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport type { ChainValues } from \"@langchain/core/utils/types\";\nimport { SerializedLLMChain } from \"../chains/serde.js\";\nimport { LLMChain } from \"../chains/llm_chain.js\";\n\n/**\n * Interface defining the input for creating an agent. It includes the\n * LLMChain instance, an optional output parser, and an optional list of\n * allowed tools.\n */\nexport interface AgentInput {\n  llmChain: LLMChain;\n  outputParser: AgentActionOutputParser | undefined;\n  allowedTools?: string[];\n}\n\n/**\n * Interface defining the input for creating a single action agent\n * that uses runnables.\n */\nexport interface RunnableSingleActionAgentInput {\n  runnable: Runnable<\n    ChainValues & {\n      agent_scratchpad?: string | BaseMessage[];\n      stop?: string[];\n    },\n    AgentAction | AgentFinish\n  >;\n  streamRunnable?: boolean;\n  defaultRunName?: string;\n}\n\n/**\n * Interface defining the input for creating a multi-action agent that uses\n * runnables. It includes the Runnable instance, and an optional list of\n * stop strings.\n */\nexport interface RunnableMultiActionAgentInput {\n  runnable: Runnable<\n    ChainValues & {\n      agent_scratchpad?: string | BaseMessage[];\n      stop?: string[];\n    },\n    AgentAction[] | AgentAction | AgentFinish\n  >;\n  streamRunnable?: boolean;\n  defaultRunName?: string;\n  stop?: string[];\n}\n\n/** @deprecated Renamed to RunnableMultiActionAgentInput. */\nexport interface RunnableAgentInput extends RunnableMultiActionAgentInput {}\n\n/**\n * Abstract class representing an output parser specifically for agent\n * actions and finishes in LangChain. It extends the `BaseOutputParser`\n * class.\n */\nexport abstract class AgentActionOutputParser extends BaseOutputParser<\n  AgentAction | AgentFinish\n> {}\n\n/**\n * Abstract class representing an output parser specifically for agents\n * that return multiple actions.\n */\nexport abstract class AgentMultiActionOutputParser extends BaseOutputParser<\n  AgentAction[] | AgentFinish\n> {}\n\n/**\n * Type representing the stopping method for an agent. It can be either\n * 'force' or 'generate'.\n */\nexport type StoppingMethod = \"force\" | \"generate\";\n\n/**\n * Generic type representing a serialized agent in LangChain. It includes\n * the type of the agent, the serialized form of the LLMChain, and\n * additional properties specific to the agent type.\n */\nexport type SerializedAgentT<\n  TType extends string = string,\n  FromLLMInput extends Record<string, unknown> = Record<string, unknown>,\n  ConstructorInput extends AgentInput = AgentInput,\n> = {\n  _type: TType;\n  llm_chain?: SerializedLLMChain;\n} & (\n  | ({ load_from_llm_and_tools: true } & FromLLMInput)\n  | ({ load_from_llm_and_tools?: false } & ConstructorInput)\n);\n\nexport type SerializedFromLLMAndTools = {\n  suffix?: string;\n  prefix?: string;\n  input_variables?: string[];\n};\n\n/**\n * Type representing a serialized ZeroShotAgent in LangChain. It extends\n * the `SerializedAgentT` type and includes additional properties specific\n * to the ZeroShotAgent.\n */\nexport type SerializedZeroShotAgent = SerializedAgentT<\n  \"zero-shot-react-description\",\n  SerializedFromLLMAndTools,\n  AgentInput\n>;\n\n/**\n * Type representing a serialized agent in LangChain. It is currently\n * synonymous with `SerializedZeroShotAgent`.\n */\nexport type SerializedAgent = SerializedZeroShotAgent;\n"],"mappings":";;;;;;;;AA6DA,IAAsB,0BAAtB,cAAsDA,+BAAAA,iBAEpD;;;;;AAMF,IAAsB,+BAAtB,cAA2DA,+BAAAA,iBAEzD"}