langchain 0.0.92 → 0.0.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/agent.cjs +10 -3
- package/dist/agents/agent.d.ts +3 -1
- package/dist/agents/agent.js +10 -3
- package/dist/agents/chat/index.cjs +6 -0
- package/dist/agents/chat/index.d.ts +1 -0
- package/dist/agents/chat/index.js +6 -0
- package/dist/agents/chat/outputParser.cjs +9 -0
- package/dist/agents/chat/outputParser.d.ts +1 -0
- package/dist/agents/chat/outputParser.js +9 -0
- package/dist/agents/chat_convo/index.cjs +6 -0
- package/dist/agents/chat_convo/index.d.ts +1 -0
- package/dist/agents/chat_convo/index.js +6 -0
- package/dist/agents/chat_convo/outputParser.cjs +21 -6
- package/dist/agents/chat_convo/outputParser.d.ts +5 -1
- package/dist/agents/chat_convo/outputParser.js +21 -6
- package/dist/agents/executor.cjs +4 -1
- package/dist/agents/executor.d.ts +1 -0
- package/dist/agents/executor.js +4 -1
- package/dist/agents/index.cjs +2 -1
- package/dist/agents/index.d.ts +2 -2
- package/dist/agents/index.js +1 -1
- package/dist/agents/mrkl/index.cjs +6 -0
- package/dist/agents/mrkl/index.d.ts +1 -0
- package/dist/agents/mrkl/index.js +6 -0
- package/dist/agents/mrkl/outputParser.cjs +7 -1
- package/dist/agents/mrkl/outputParser.d.ts +1 -0
- package/dist/agents/mrkl/outputParser.js +7 -1
- package/dist/agents/structured_chat/index.cjs +6 -0
- package/dist/agents/structured_chat/index.d.ts +1 -0
- package/dist/agents/structured_chat/index.js +6 -0
- package/dist/agents/structured_chat/outputParser.cjs +20 -6
- package/dist/agents/structured_chat/outputParser.d.ts +5 -1
- package/dist/agents/structured_chat/outputParser.js +20 -6
- package/dist/base_language/index.cjs +21 -4
- package/dist/base_language/index.d.ts +14 -2
- package/dist/base_language/index.js +21 -4
- package/dist/callbacks/base.cjs +41 -0
- package/dist/callbacks/base.d.ts +41 -25
- package/dist/callbacks/base.js +41 -0
- package/dist/callbacks/handlers/tracer.cjs +91 -16
- package/dist/callbacks/handlers/tracer.d.ts +17 -29
- package/dist/callbacks/handlers/tracer.js +91 -16
- package/dist/callbacks/handlers/tracer_langchain.cjs +17 -77
- package/dist/callbacks/handlers/tracer_langchain.d.ts +13 -20
- package/dist/callbacks/handlers/tracer_langchain.js +17 -77
- package/dist/callbacks/index.cjs +6 -1
- package/dist/callbacks/index.d.ts +3 -2
- package/dist/callbacks/index.js +2 -1
- package/dist/callbacks/manager.cjs +157 -42
- package/dist/callbacks/manager.d.ts +31 -16
- package/dist/callbacks/manager.js +154 -41
- package/dist/callbacks/promises.cjs +36 -0
- package/dist/callbacks/promises.d.ts +7 -0
- package/dist/callbacks/promises.js +28 -0
- package/dist/chains/analyze_documents_chain.cjs +1 -1
- package/dist/chains/analyze_documents_chain.js +1 -1
- package/dist/chains/api/api_chain.cjs +2 -2
- package/dist/chains/api/api_chain.js +2 -2
- package/dist/chains/base.cjs +6 -3
- package/dist/chains/base.d.ts +3 -2
- package/dist/chains/base.js +6 -3
- package/dist/chains/chat_vector_db_chain.cjs +2 -2
- package/dist/chains/chat_vector_db_chain.js +2 -2
- package/dist/chains/combine_docs_chain.cjs +32 -18
- package/dist/chains/combine_docs_chain.js +32 -18
- package/dist/chains/constitutional_ai/constitutional_chain.cjs +4 -4
- package/dist/chains/constitutional_ai/constitutional_chain.js +4 -4
- package/dist/chains/conversational_retrieval_chain.cjs +2 -2
- package/dist/chains/conversational_retrieval_chain.js +2 -2
- package/dist/chains/llm_chain.cjs +9 -2
- package/dist/chains/llm_chain.d.ts +3 -1
- package/dist/chains/llm_chain.js +9 -2
- package/dist/chains/openai_moderation.cjs +5 -0
- package/dist/chains/openai_moderation.d.ts +3 -0
- package/dist/chains/openai_moderation.js +5 -0
- package/dist/chains/query_constructor/index.cjs +27 -19
- package/dist/chains/query_constructor/index.d.ts +7 -3
- package/dist/chains/query_constructor/index.js +27 -19
- package/dist/chains/retrieval_qa.cjs +1 -1
- package/dist/chains/retrieval_qa.js +1 -1
- package/dist/chains/sequential_chain.cjs +7 -3
- package/dist/chains/sequential_chain.js +7 -3
- package/dist/chains/sql_db/sql_db_chain.cjs +2 -2
- package/dist/chains/sql_db/sql_db_chain.js +2 -2
- package/dist/chains/vector_db_qa.cjs +1 -1
- package/dist/chains/vector_db_qa.js +1 -1
- package/dist/chat_models/anthropic.cjs +16 -0
- package/dist/chat_models/anthropic.d.ts +11 -6
- package/dist/chat_models/anthropic.js +16 -0
- package/dist/chat_models/base.cjs +12 -3
- package/dist/chat_models/base.d.ts +1 -0
- package/dist/chat_models/base.js +12 -3
- package/dist/chat_models/openai.cjs +26 -1
- package/dist/chat_models/openai.d.ts +9 -1
- package/dist/chat_models/openai.js +26 -1
- package/dist/client/index.cjs +2 -2
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/langchainplus.cjs +79 -406
- package/dist/client/langchainplus.d.ts +7 -119
- package/dist/client/langchainplus.js +77 -404
- package/dist/embeddings/googlevertexai.cjs +7 -5
- package/dist/embeddings/googlevertexai.js +7 -5
- package/dist/embeddings/openai.cjs +1 -1
- package/dist/embeddings/openai.js +1 -1
- package/dist/experimental/autogpt/output_parser.cjs +9 -0
- package/dist/experimental/autogpt/output_parser.d.ts +1 -0
- package/dist/experimental/autogpt/output_parser.js +9 -0
- package/dist/experimental/plan_and_execute/outputParser.cjs +7 -1
- package/dist/experimental/plan_and_execute/outputParser.d.ts +1 -1
- package/dist/experimental/plan_and_execute/outputParser.js +7 -1
- package/dist/llms/aleph_alpha.cjs +366 -0
- package/dist/llms/aleph_alpha.d.ts +148 -0
- package/dist/llms/aleph_alpha.js +362 -0
- package/dist/llms/base.cjs +9 -3
- package/dist/llms/base.d.ts +1 -0
- package/dist/llms/base.js +9 -3
- package/dist/llms/cohere.cjs +16 -0
- package/dist/llms/cohere.d.ts +7 -0
- package/dist/llms/cohere.js +16 -0
- package/dist/llms/googlevertexai.cjs +47 -1
- package/dist/llms/googlevertexai.d.ts +26 -1
- package/dist/llms/googlevertexai.js +45 -0
- package/dist/llms/hf.cjs +6 -1
- package/dist/llms/hf.d.ts +3 -0
- package/dist/llms/hf.js +6 -1
- package/dist/llms/openai-chat.cjs +37 -1
- package/dist/llms/openai-chat.d.ts +13 -1
- package/dist/llms/openai-chat.js +37 -1
- package/dist/llms/openai.cjs +37 -1
- package/dist/llms/openai.d.ts +13 -1
- package/dist/llms/openai.js +37 -1
- package/dist/llms/replicate.cjs +5 -0
- package/dist/llms/replicate.d.ts +3 -0
- package/dist/llms/replicate.js +5 -0
- package/dist/llms/sagemaker_endpoint.cjs +7 -0
- package/dist/llms/sagemaker_endpoint.d.ts +3 -0
- package/dist/llms/sagemaker_endpoint.js +7 -0
- package/dist/load/import_constants.cjs +85 -0
- package/dist/load/import_constants.d.ts +1 -0
- package/dist/load/import_constants.js +82 -0
- package/dist/load/import_map.cjs +72 -0
- package/dist/load/import_map.d.ts +45 -0
- package/dist/load/import_map.js +46 -0
- package/dist/load/index.cjs +160 -0
- package/dist/load/index.d.ts +2 -0
- package/dist/load/index.js +133 -0
- package/dist/load/map_keys.cjs +26 -0
- package/dist/load/map_keys.d.ts +9 -0
- package/dist/load/map_keys.js +17 -0
- package/dist/load/serializable.cjs +115 -0
- package/dist/load/serializable.d.ts +50 -0
- package/dist/load/serializable.js +111 -0
- package/dist/memory/stores/entity/in_memory.cjs +6 -0
- package/dist/memory/stores/entity/in_memory.d.ts +1 -0
- package/dist/memory/stores/entity/in_memory.js +6 -0
- package/dist/output_parsers/combining.cjs +7 -1
- package/dist/output_parsers/combining.d.ts +1 -0
- package/dist/output_parsers/combining.js +7 -1
- package/dist/output_parsers/expression.cjs +6 -0
- package/dist/output_parsers/expression.d.ts +1 -0
- package/dist/output_parsers/expression.js +6 -0
- package/dist/output_parsers/fix.cjs +7 -1
- package/dist/output_parsers/fix.d.ts +1 -0
- package/dist/output_parsers/fix.js +7 -1
- package/dist/output_parsers/list.cjs +16 -1
- package/dist/output_parsers/list.d.ts +2 -0
- package/dist/output_parsers/list.js +16 -1
- package/dist/output_parsers/regex.cjs +7 -1
- package/dist/output_parsers/regex.d.ts +1 -0
- package/dist/output_parsers/regex.js +7 -1
- package/dist/output_parsers/structured.cjs +12 -9
- package/dist/output_parsers/structured.d.ts +6 -2
- package/dist/output_parsers/structured.js +12 -9
- package/dist/prompts/base.cjs +46 -4
- package/dist/prompts/base.d.ts +14 -5
- package/dist/prompts/base.js +46 -4
- package/dist/prompts/chat.cjs +61 -36
- package/dist/prompts/chat.d.ts +26 -8
- package/dist/prompts/chat.js +61 -36
- package/dist/prompts/few_shot.cjs +6 -0
- package/dist/prompts/few_shot.d.ts +1 -0
- package/dist/prompts/few_shot.js +6 -0
- package/dist/prompts/index.d.ts +1 -1
- package/dist/prompts/selectors/LengthBasedExampleSelector.cjs +3 -1
- package/dist/prompts/selectors/LengthBasedExampleSelector.d.ts +2 -2
- package/dist/prompts/selectors/LengthBasedExampleSelector.js +3 -1
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.cjs +3 -1
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.d.ts +2 -2
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.js +3 -1
- package/dist/prompts/serde.d.ts +1 -13
- package/dist/retrievers/document_compressors/chain_extract.cjs +11 -0
- package/dist/retrievers/document_compressors/chain_extract.js +11 -0
- package/dist/retrievers/self_query/weaviate.cjs +100 -0
- package/dist/retrievers/self_query/weaviate.d.ts +40 -0
- package/dist/retrievers/self_query/weaviate.js +96 -0
- package/dist/schema/index.cjs +10 -6
- package/dist/schema/index.d.ts +10 -7
- package/dist/schema/index.js +8 -5
- package/dist/schema/output_parser.cjs +2 -1
- package/dist/schema/output_parser.d.ts +2 -1
- package/dist/schema/output_parser.js +2 -1
- package/dist/sql_db.cjs +12 -1
- package/dist/sql_db.d.ts +4 -1
- package/dist/sql_db.js +12 -1
- package/dist/stores/doc/gcs.cjs +58 -0
- package/dist/stores/doc/gcs.d.ts +22 -0
- package/dist/stores/doc/gcs.js +54 -0
- package/dist/stores/doc/in_memory.cjs +67 -0
- package/dist/stores/doc/in_memory.d.ts +14 -0
- package/dist/stores/doc/in_memory.js +62 -0
- package/dist/stores/file/in_memory.cjs +6 -0
- package/dist/stores/file/in_memory.d.ts +1 -0
- package/dist/stores/file/in_memory.js +6 -0
- package/dist/stores/file/node.cjs +6 -0
- package/dist/stores/file/node.d.ts +1 -0
- package/dist/stores/file/node.js +6 -0
- package/dist/stores/message/dynamodb.cjs +13 -0
- package/dist/stores/message/dynamodb.d.ts +4 -0
- package/dist/stores/message/dynamodb.js +13 -0
- package/dist/stores/message/in_memory.cjs +7 -1
- package/dist/stores/message/in_memory.d.ts +1 -0
- package/dist/stores/message/in_memory.js +7 -1
- package/dist/stores/message/momento.cjs +6 -0
- package/dist/stores/message/momento.d.ts +1 -0
- package/dist/stores/message/momento.js +6 -0
- package/dist/stores/message/redis.cjs +15 -2
- package/dist/stores/message/redis.d.ts +6 -0
- package/dist/stores/message/redis.js +15 -2
- package/dist/stores/message/upstash_redis.cjs +14 -2
- package/dist/stores/message/upstash_redis.d.ts +5 -0
- package/dist/stores/message/upstash_redis.js +14 -2
- package/dist/text_splitter.cjs +32 -0
- package/dist/text_splitter.d.ts +1 -1
- package/dist/text_splitter.js +32 -0
- package/dist/tools/IFTTTWebhook.cjs +1 -1
- package/dist/tools/IFTTTWebhook.js +1 -1
- package/dist/tools/aiplugin.cjs +1 -1
- package/dist/tools/aiplugin.d.ts +2 -2
- package/dist/tools/aiplugin.js +1 -1
- package/dist/tools/aws_lambda.cjs +9 -0
- package/dist/tools/aws_lambda.d.ts +4 -0
- package/dist/tools/aws_lambda.js +9 -0
- package/dist/tools/base.cjs +8 -5
- package/dist/tools/base.d.ts +3 -2
- package/dist/tools/base.js +8 -5
- package/dist/tools/bingserpapi.cjs +4 -1
- package/dist/tools/bingserpapi.d.ts +1 -0
- package/dist/tools/bingserpapi.js +4 -1
- package/dist/tools/calculator.cjs +3 -0
- package/dist/tools/calculator.d.ts +1 -0
- package/dist/tools/calculator.js +3 -0
- package/dist/tools/dadjokeapi.cjs +3 -6
- package/dist/tools/dadjokeapi.d.ts +0 -1
- package/dist/tools/dadjokeapi.js +3 -6
- package/dist/tools/dynamic.cjs +1 -1
- package/dist/tools/dynamic.d.ts +3 -5
- package/dist/tools/dynamic.js +1 -1
- package/dist/tools/fs.cjs +2 -2
- package/dist/tools/fs.d.ts +1 -1
- package/dist/tools/fs.js +2 -2
- package/dist/tools/google_custom_search.cjs +6 -1
- package/dist/tools/google_custom_search.d.ts +3 -0
- package/dist/tools/google_custom_search.js +6 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/json.cjs +20 -7
- package/dist/tools/json.d.ts +9 -3
- package/dist/tools/json.js +20 -7
- package/dist/tools/requests.cjs +2 -2
- package/dist/tools/requests.js +2 -2
- package/dist/tools/serpapi.cjs +4 -1
- package/dist/tools/serpapi.d.ts +1 -0
- package/dist/tools/serpapi.js +4 -1
- package/dist/tools/serper.cjs +3 -0
- package/dist/tools/serper.d.ts +1 -0
- package/dist/tools/serper.js +3 -0
- package/dist/tools/sql.cjs +1 -1
- package/dist/tools/sql.js +1 -1
- package/dist/tools/vectorstore.cjs +1 -1
- package/dist/tools/vectorstore.js +1 -1
- package/dist/tools/webbrowser.cjs +5 -2
- package/dist/tools/webbrowser.d.ts +2 -1
- package/dist/tools/webbrowser.js +5 -2
- package/dist/tools/zapier.cjs +15 -2
- package/dist/tools/zapier.d.ts +8 -3
- package/dist/tools/zapier.js +15 -2
- package/dist/vectorstores/faiss.cjs +5 -5
- package/dist/vectorstores/faiss.d.ts +5 -5
- package/dist/vectorstores/faiss.js +5 -5
- package/dist/vectorstores/hnswlib.cjs +7 -5
- package/dist/vectorstores/hnswlib.d.ts +5 -5
- package/dist/vectorstores/hnswlib.js +7 -5
- package/dist/vectorstores/weaviate.cjs +14 -1
- package/dist/vectorstores/weaviate.js +14 -1
- package/llms/aleph_alpha.cjs +1 -0
- package/llms/aleph_alpha.d.ts +1 -0
- package/llms/aleph_alpha.js +1 -0
- package/load/serializable.cjs +1 -0
- package/load/serializable.d.ts +1 -0
- package/load/serializable.js +1 -0
- package/load.cjs +1 -0
- package/load.d.ts +1 -0
- package/load.js +1 -0
- package/package.json +69 -12
- package/retrievers/self_query/weaviate.cjs +1 -0
- package/retrievers/self_query/weaviate.d.ts +1 -0
- package/retrievers/self_query/weaviate.js +1 -0
- package/stores/doc/gcs.cjs +1 -0
- package/stores/doc/gcs.d.ts +1 -0
- package/stores/doc/gcs.js +1 -0
- package/stores/doc/in_memory.cjs +1 -0
- package/stores/doc/in_memory.d.ts +1 -0
- package/stores/doc/in_memory.js +1 -0
- package/stores/message/in_memory.cjs +1 -0
- package/stores/message/in_memory.d.ts +1 -0
- package/stores/message/in_memory.js +1 -0
- package/dist/docstore/base.cjs +0 -6
- package/dist/docstore/base.d.ts +0 -5
- package/dist/docstore/base.js +0 -2
- package/dist/docstore/in_memory.cjs +0 -34
- package/dist/docstore/in_memory.d.ts +0 -10
- package/dist/docstore/in_memory.js +0 -30
- package/dist/docstore/index.cjs +0 -9
- package/dist/docstore/index.d.ts +0 -3
- package/dist/docstore/index.js +0 -3
- package/docstore.cjs +0 -1
- package/docstore.d.ts +0 -1
- package/docstore.js +0 -1
package/dist/agents/agent.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Agent = exports.LLMSingleActionAgent = exports.BaseMultiActionAgent = exports.BaseSingleActionAgent = exports.BaseAgent = void 0;
|
|
4
|
+
const serializable_js_1 = require("../load/serializable.cjs");
|
|
4
5
|
class ParseError extends Error {
|
|
5
6
|
constructor(msg, output) {
|
|
6
7
|
super(msg);
|
|
@@ -13,7 +14,7 @@ class ParseError extends Error {
|
|
|
13
14
|
this.output = output;
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
|
-
class BaseAgent {
|
|
17
|
+
class BaseAgent extends serializable_js_1.Serializable {
|
|
17
18
|
get returnValues() {
|
|
18
19
|
return ["output"];
|
|
19
20
|
}
|
|
@@ -60,7 +61,13 @@ class BaseMultiActionAgent extends BaseAgent {
|
|
|
60
61
|
exports.BaseMultiActionAgent = BaseMultiActionAgent;
|
|
61
62
|
class LLMSingleActionAgent extends BaseSingleActionAgent {
|
|
62
63
|
constructor(input) {
|
|
63
|
-
super();
|
|
64
|
+
super(input);
|
|
65
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
configurable: true,
|
|
68
|
+
writable: true,
|
|
69
|
+
value: ["langchain", "agents"]
|
|
70
|
+
});
|
|
64
71
|
Object.defineProperty(this, "llmChain", {
|
|
65
72
|
enumerable: true,
|
|
66
73
|
configurable: true,
|
|
@@ -120,7 +127,7 @@ class Agent extends BaseSingleActionAgent {
|
|
|
120
127
|
return this.llmChain.inputKeys.filter((k) => k !== "agent_scratchpad");
|
|
121
128
|
}
|
|
122
129
|
constructor(input) {
|
|
123
|
-
super();
|
|
130
|
+
super(input);
|
|
124
131
|
Object.defineProperty(this, "llmChain", {
|
|
125
132
|
enumerable: true,
|
|
126
133
|
configurable: true,
|
package/dist/agents/agent.d.ts
CHANGED
|
@@ -3,10 +3,11 @@ import { CallbackManager, Callbacks } from "../callbacks/manager.js";
|
|
|
3
3
|
import { LLMChain } from "../chains/llm_chain.js";
|
|
4
4
|
import { BasePromptTemplate } from "../prompts/base.js";
|
|
5
5
|
import { AgentAction, AgentFinish, AgentStep, BaseChatMessage, ChainValues } from "../schema/index.js";
|
|
6
|
+
import { Serializable } from "../load/serializable.js";
|
|
6
7
|
import { StructuredTool, Tool } from "../tools/base.js";
|
|
7
8
|
import { AgentActionOutputParser, AgentInput, SerializedAgent, StoppingMethod } from "./types.js";
|
|
8
9
|
export type OutputParserArgs = Record<string, any>;
|
|
9
|
-
export declare abstract class BaseAgent {
|
|
10
|
+
export declare abstract class BaseAgent extends Serializable {
|
|
10
11
|
ToolType: StructuredTool;
|
|
11
12
|
abstract get inputKeys(): string[];
|
|
12
13
|
get returnValues(): string[];
|
|
@@ -60,6 +61,7 @@ export interface LLMSingleActionAgentInput {
|
|
|
60
61
|
stop?: string[];
|
|
61
62
|
}
|
|
62
63
|
export declare class LLMSingleActionAgent extends BaseSingleActionAgent {
|
|
64
|
+
lc_namespace: string[];
|
|
63
65
|
llmChain: LLMChain;
|
|
64
66
|
outputParser: AgentActionOutputParser;
|
|
65
67
|
stop?: string[];
|
package/dist/agents/agent.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Serializable } from "../load/serializable.js";
|
|
1
2
|
class ParseError extends Error {
|
|
2
3
|
constructor(msg, output) {
|
|
3
4
|
super(msg);
|
|
@@ -10,7 +11,7 @@ class ParseError extends Error {
|
|
|
10
11
|
this.output = output;
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
|
-
export class BaseAgent {
|
|
14
|
+
export class BaseAgent extends Serializable {
|
|
14
15
|
get returnValues() {
|
|
15
16
|
return ["output"];
|
|
16
17
|
}
|
|
@@ -54,7 +55,13 @@ export class BaseMultiActionAgent extends BaseAgent {
|
|
|
54
55
|
}
|
|
55
56
|
export class LLMSingleActionAgent extends BaseSingleActionAgent {
|
|
56
57
|
constructor(input) {
|
|
57
|
-
super();
|
|
58
|
+
super(input);
|
|
59
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true,
|
|
62
|
+
writable: true,
|
|
63
|
+
value: ["langchain", "agents"]
|
|
64
|
+
});
|
|
58
65
|
Object.defineProperty(this, "llmChain", {
|
|
59
66
|
enumerable: true,
|
|
60
67
|
configurable: true,
|
|
@@ -113,7 +120,7 @@ export class Agent extends BaseSingleActionAgent {
|
|
|
113
120
|
return this.llmChain.inputKeys.filter((k) => k !== "agent_scratchpad");
|
|
114
121
|
}
|
|
115
122
|
constructor(input) {
|
|
116
|
-
super();
|
|
123
|
+
super(input);
|
|
117
124
|
Object.defineProperty(this, "llmChain", {
|
|
118
125
|
enumerable: true,
|
|
119
126
|
configurable: true,
|
|
@@ -15,6 +15,12 @@ class ChatAgent extends agent_js_1.Agent {
|
|
|
15
15
|
constructor(input) {
|
|
16
16
|
const outputParser = input?.outputParser ?? ChatAgent.getDefaultOutputParser();
|
|
17
17
|
super({ ...input, outputParser });
|
|
18
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: ["langchain", "agents", "chat"]
|
|
23
|
+
});
|
|
18
24
|
}
|
|
19
25
|
_agentType() {
|
|
20
26
|
return "chat-zero-shot-react-description";
|
|
@@ -22,6 +22,7 @@ export type ChatAgentInput = Optional<AgentInput, "outputParser">;
|
|
|
22
22
|
* @augments Agent
|
|
23
23
|
*/
|
|
24
24
|
export declare class ChatAgent extends Agent {
|
|
25
|
+
lc_namespace: string[];
|
|
25
26
|
ToolType: Tool;
|
|
26
27
|
constructor(input: ChatAgentInput);
|
|
27
28
|
_agentType(): "chat-zero-shot-react-description";
|
|
@@ -12,6 +12,12 @@ export class ChatAgent extends Agent {
|
|
|
12
12
|
constructor(input) {
|
|
13
13
|
const outputParser = input?.outputParser ?? ChatAgent.getDefaultOutputParser();
|
|
14
14
|
super({ ...input, outputParser });
|
|
15
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true,
|
|
19
|
+
value: ["langchain", "agents", "chat"]
|
|
20
|
+
});
|
|
15
21
|
}
|
|
16
22
|
_agentType() {
|
|
17
23
|
return "chat-zero-shot-react-description";
|
|
@@ -5,6 +5,15 @@ const types_js_1 = require("../types.cjs");
|
|
|
5
5
|
const prompt_js_1 = require("./prompt.cjs");
|
|
6
6
|
exports.FINAL_ANSWER_ACTION = "Final Answer:";
|
|
7
7
|
class ChatAgentOutputParser extends types_js_1.AgentActionOutputParser {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: ["langchain", "agents", "chat"]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
8
17
|
async parse(text) {
|
|
9
18
|
if (text.includes(exports.FINAL_ANSWER_ACTION) || !text.includes(`"action":`)) {
|
|
10
19
|
const parts = text.split(exports.FINAL_ANSWER_ACTION);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AgentActionOutputParser } from "../types.js";
|
|
2
2
|
export declare const FINAL_ANSWER_ACTION = "Final Answer:";
|
|
3
3
|
export declare class ChatAgentOutputParser extends AgentActionOutputParser {
|
|
4
|
+
lc_namespace: string[];
|
|
4
5
|
parse(text: string): Promise<{
|
|
5
6
|
returnValues: {
|
|
6
7
|
output: string;
|
|
@@ -2,6 +2,15 @@ import { AgentActionOutputParser } from "../types.js";
|
|
|
2
2
|
import { FORMAT_INSTRUCTIONS } from "./prompt.js";
|
|
3
3
|
export const FINAL_ANSWER_ACTION = "Final Answer:";
|
|
4
4
|
export class ChatAgentOutputParser extends AgentActionOutputParser {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
configurable: true,
|
|
10
|
+
writable: true,
|
|
11
|
+
value: ["langchain", "agents", "chat"]
|
|
12
|
+
});
|
|
13
|
+
}
|
|
5
14
|
async parse(text) {
|
|
6
15
|
if (text.includes(FINAL_ANSWER_ACTION) || !text.includes(`"action":`)) {
|
|
7
16
|
const parts = text.split(FINAL_ANSWER_ACTION);
|
|
@@ -16,6 +16,12 @@ class ChatConversationalAgent extends agent_js_1.Agent {
|
|
|
16
16
|
constructor(input) {
|
|
17
17
|
const outputParser = input.outputParser ?? ChatConversationalAgent.getDefaultOutputParser();
|
|
18
18
|
super({ ...input, outputParser });
|
|
19
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: ["langchain", "agents", "chat_convo"]
|
|
24
|
+
});
|
|
19
25
|
}
|
|
20
26
|
_agentType() {
|
|
21
27
|
return "chat-conversational-react-description";
|
|
@@ -21,6 +21,7 @@ export type ChatConversationalAgentInput = Optional<AgentInput, "outputParser">;
|
|
|
21
21
|
* @augments Agent
|
|
22
22
|
*/
|
|
23
23
|
export declare class ChatConversationalAgent extends Agent {
|
|
24
|
+
lc_namespace: string[];
|
|
24
25
|
ToolType: Tool;
|
|
25
26
|
constructor(input: ChatConversationalAgentInput);
|
|
26
27
|
_agentType(): "chat-conversational-react-description";
|
|
@@ -13,6 +13,12 @@ export class ChatConversationalAgent extends Agent {
|
|
|
13
13
|
constructor(input) {
|
|
14
14
|
const outputParser = input.outputParser ?? ChatConversationalAgent.getDefaultOutputParser();
|
|
15
15
|
super({ ...input, outputParser });
|
|
16
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: ["langchain", "agents", "chat_convo"]
|
|
21
|
+
});
|
|
16
22
|
}
|
|
17
23
|
_agentType() {
|
|
18
24
|
return "chat-conversational-react-description";
|
|
@@ -7,14 +7,21 @@ const types_js_1 = require("../types.cjs");
|
|
|
7
7
|
const prompt_js_1 = require("./prompt.cjs");
|
|
8
8
|
const fix_js_1 = require("../../output_parsers/fix.cjs");
|
|
9
9
|
class ChatConversationalAgentOutputParser extends types_js_1.AgentActionOutputParser {
|
|
10
|
-
constructor(
|
|
11
|
-
super();
|
|
10
|
+
constructor(fields) {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: ["langchain", "agents", "chat_convo"]
|
|
17
|
+
});
|
|
12
18
|
Object.defineProperty(this, "toolNames", {
|
|
13
19
|
enumerable: true,
|
|
14
20
|
configurable: true,
|
|
15
21
|
writable: true,
|
|
16
|
-
value:
|
|
22
|
+
value: void 0
|
|
17
23
|
});
|
|
24
|
+
this.toolNames = fields.toolNames;
|
|
18
25
|
}
|
|
19
26
|
async parse(text) {
|
|
20
27
|
let jsonOutput = text.trim();
|
|
@@ -50,7 +57,13 @@ class ChatConversationalAgentOutputParser extends types_js_1.AgentActionOutputPa
|
|
|
50
57
|
exports.ChatConversationalAgentOutputParser = ChatConversationalAgentOutputParser;
|
|
51
58
|
class ChatConversationalAgentOutputParserWithRetries extends types_js_1.AgentActionOutputParser {
|
|
52
59
|
constructor(fields) {
|
|
53
|
-
super();
|
|
60
|
+
super(fields);
|
|
61
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
configurable: true,
|
|
64
|
+
writable: true,
|
|
65
|
+
value: ["langchain", "agents", "chat_convo"]
|
|
66
|
+
});
|
|
54
67
|
Object.defineProperty(this, "baseParser", {
|
|
55
68
|
enumerable: true,
|
|
56
69
|
configurable: true,
|
|
@@ -72,7 +85,7 @@ class ChatConversationalAgentOutputParserWithRetries extends types_js_1.AgentAct
|
|
|
72
85
|
this.toolNames = fields.toolNames ?? this.toolNames;
|
|
73
86
|
this.baseParser =
|
|
74
87
|
fields?.baseParser ??
|
|
75
|
-
new ChatConversationalAgentOutputParser(this.toolNames);
|
|
88
|
+
new ChatConversationalAgentOutputParser({ toolNames: this.toolNames });
|
|
76
89
|
this.outputFixingParser = fields?.outputFixingParser;
|
|
77
90
|
}
|
|
78
91
|
getFormatInstructions(options) {
|
|
@@ -91,7 +104,9 @@ class ChatConversationalAgentOutputParserWithRetries extends types_js_1.AgentAct
|
|
|
91
104
|
}
|
|
92
105
|
static fromLLM(llm, options) {
|
|
93
106
|
const baseParser = options.baseParser ??
|
|
94
|
-
new ChatConversationalAgentOutputParser(
|
|
107
|
+
new ChatConversationalAgentOutputParser({
|
|
108
|
+
toolNames: options.toolNames ?? [],
|
|
109
|
+
});
|
|
95
110
|
const outputFixingParser = fix_js_1.OutputFixingParser.fromLLM(llm, baseParser);
|
|
96
111
|
return new ChatConversationalAgentOutputParserWithRetries({
|
|
97
112
|
baseParser,
|
|
@@ -8,8 +8,11 @@ export type ChatConversationalAgentOutputParserFormatInstructionsOptions = Forma
|
|
|
8
8
|
raw?: boolean;
|
|
9
9
|
};
|
|
10
10
|
export declare class ChatConversationalAgentOutputParser extends AgentActionOutputParser {
|
|
11
|
+
lc_namespace: string[];
|
|
11
12
|
private toolNames;
|
|
12
|
-
constructor(
|
|
13
|
+
constructor(fields: {
|
|
14
|
+
toolNames: string[];
|
|
15
|
+
});
|
|
13
16
|
parse(text: string): Promise<AgentAction | AgentFinish>;
|
|
14
17
|
getFormatInstructions(): string;
|
|
15
18
|
}
|
|
@@ -19,6 +22,7 @@ export type ChatConversationalAgentOutputParserArgs = {
|
|
|
19
22
|
toolNames?: string[];
|
|
20
23
|
};
|
|
21
24
|
export declare class ChatConversationalAgentOutputParserWithRetries extends AgentActionOutputParser {
|
|
25
|
+
lc_namespace: string[];
|
|
22
26
|
private baseParser;
|
|
23
27
|
private outputFixingParser?;
|
|
24
28
|
private toolNames;
|
|
@@ -4,14 +4,21 @@ import { AgentActionOutputParser } from "../types.js";
|
|
|
4
4
|
import { FORMAT_INSTRUCTIONS } from "./prompt.js";
|
|
5
5
|
import { OutputFixingParser } from "../../output_parsers/fix.js";
|
|
6
6
|
export class ChatConversationalAgentOutputParser extends AgentActionOutputParser {
|
|
7
|
-
constructor(
|
|
8
|
-
super();
|
|
7
|
+
constructor(fields) {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true,
|
|
13
|
+
value: ["langchain", "agents", "chat_convo"]
|
|
14
|
+
});
|
|
9
15
|
Object.defineProperty(this, "toolNames", {
|
|
10
16
|
enumerable: true,
|
|
11
17
|
configurable: true,
|
|
12
18
|
writable: true,
|
|
13
|
-
value:
|
|
19
|
+
value: void 0
|
|
14
20
|
});
|
|
21
|
+
this.toolNames = fields.toolNames;
|
|
15
22
|
}
|
|
16
23
|
async parse(text) {
|
|
17
24
|
let jsonOutput = text.trim();
|
|
@@ -46,7 +53,13 @@ export class ChatConversationalAgentOutputParser extends AgentActionOutputParser
|
|
|
46
53
|
}
|
|
47
54
|
export class ChatConversationalAgentOutputParserWithRetries extends AgentActionOutputParser {
|
|
48
55
|
constructor(fields) {
|
|
49
|
-
super();
|
|
56
|
+
super(fields);
|
|
57
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
configurable: true,
|
|
60
|
+
writable: true,
|
|
61
|
+
value: ["langchain", "agents", "chat_convo"]
|
|
62
|
+
});
|
|
50
63
|
Object.defineProperty(this, "baseParser", {
|
|
51
64
|
enumerable: true,
|
|
52
65
|
configurable: true,
|
|
@@ -68,7 +81,7 @@ export class ChatConversationalAgentOutputParserWithRetries extends AgentActionO
|
|
|
68
81
|
this.toolNames = fields.toolNames ?? this.toolNames;
|
|
69
82
|
this.baseParser =
|
|
70
83
|
fields?.baseParser ??
|
|
71
|
-
new ChatConversationalAgentOutputParser(this.toolNames);
|
|
84
|
+
new ChatConversationalAgentOutputParser({ toolNames: this.toolNames });
|
|
72
85
|
this.outputFixingParser = fields?.outputFixingParser;
|
|
73
86
|
}
|
|
74
87
|
getFormatInstructions(options) {
|
|
@@ -87,7 +100,9 @@ export class ChatConversationalAgentOutputParserWithRetries extends AgentActionO
|
|
|
87
100
|
}
|
|
88
101
|
static fromLLM(llm, options) {
|
|
89
102
|
const baseParser = options.baseParser ??
|
|
90
|
-
new ChatConversationalAgentOutputParser(
|
|
103
|
+
new ChatConversationalAgentOutputParser({
|
|
104
|
+
toolNames: options.toolNames ?? [],
|
|
105
|
+
});
|
|
91
106
|
const outputFixingParser = OutputFixingParser.fromLLM(llm, baseParser);
|
|
92
107
|
return new ChatConversationalAgentOutputParserWithRetries({
|
|
93
108
|
baseParser,
|
package/dist/agents/executor.cjs
CHANGED
|
@@ -7,6 +7,9 @@ const base_js_1 = require("../chains/base.cjs");
|
|
|
7
7
|
* @augments BaseChain
|
|
8
8
|
*/
|
|
9
9
|
class AgentExecutor extends base_js_1.BaseChain {
|
|
10
|
+
get lc_namespace() {
|
|
11
|
+
return ["langchain", "agents", "executor"];
|
|
12
|
+
}
|
|
10
13
|
get inputKeys() {
|
|
11
14
|
return this.agent.inputKeys;
|
|
12
15
|
}
|
|
@@ -14,7 +17,7 @@ class AgentExecutor extends base_js_1.BaseChain {
|
|
|
14
17
|
return this.agent.returnValues;
|
|
15
18
|
}
|
|
16
19
|
constructor(input) {
|
|
17
|
-
super(input
|
|
20
|
+
super(input);
|
|
18
21
|
Object.defineProperty(this, "agent", {
|
|
19
22
|
enumerable: true,
|
|
20
23
|
configurable: true,
|
|
@@ -16,6 +16,7 @@ export interface AgentExecutorInput extends ChainInputs {
|
|
|
16
16
|
* @augments BaseChain
|
|
17
17
|
*/
|
|
18
18
|
export declare class AgentExecutor extends BaseChain {
|
|
19
|
+
get lc_namespace(): string[];
|
|
19
20
|
agent: BaseSingleActionAgent | BaseMultiActionAgent;
|
|
20
21
|
tools: this["agent"]["ToolType"][];
|
|
21
22
|
returnIntermediateSteps: boolean;
|
package/dist/agents/executor.js
CHANGED
|
@@ -4,6 +4,9 @@ import { BaseChain } from "../chains/base.js";
|
|
|
4
4
|
* @augments BaseChain
|
|
5
5
|
*/
|
|
6
6
|
export class AgentExecutor extends BaseChain {
|
|
7
|
+
get lc_namespace() {
|
|
8
|
+
return ["langchain", "agents", "executor"];
|
|
9
|
+
}
|
|
7
10
|
get inputKeys() {
|
|
8
11
|
return this.agent.inputKeys;
|
|
9
12
|
}
|
|
@@ -11,7 +14,7 @@ export class AgentExecutor extends BaseChain {
|
|
|
11
14
|
return this.agent.returnValues;
|
|
12
15
|
}
|
|
13
16
|
constructor(input) {
|
|
14
|
-
super(input
|
|
17
|
+
super(input);
|
|
15
18
|
Object.defineProperty(this, "agent", {
|
|
16
19
|
enumerable: true,
|
|
17
20
|
configurable: true,
|
package/dist/agents/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StructuredChatOutputParserWithRetries = exports.StructuredChatOutputParser = exports.StructuredChatAgent = exports.AgentActionOutputParser = exports.ZeroShotAgentOutputParser = exports.ZeroShotAgent = exports.initializeAgentExecutorWithOptions = exports.initializeAgentExecutor = exports.AgentExecutor = exports.ChatConversationalAgentOutputParser = exports.ChatConversationalAgent = exports.ChatAgentOutputParser = exports.ChatAgent = exports.Toolkit = exports.createVectorStoreRouterAgent = exports.createVectorStoreAgent = exports.createSqlAgent = exports.createOpenApiAgent = exports.createJsonAgent = exports.ZapierToolKit = exports.VectorStoreToolkit = exports.VectorStoreRouterToolkit = exports.SqlToolkit = exports.RequestsToolkit = exports.OpenApiToolkit = exports.JsonToolkit = exports.LLMSingleActionAgent = exports.BaseSingleActionAgent = exports.Agent = void 0;
|
|
3
|
+
exports.StructuredChatOutputParserWithRetries = exports.StructuredChatOutputParser = exports.StructuredChatAgent = exports.AgentActionOutputParser = exports.ZeroShotAgentOutputParser = exports.ZeroShotAgent = exports.initializeAgentExecutorWithOptions = exports.initializeAgentExecutor = exports.AgentExecutor = exports.ChatConversationalAgentOutputParserWithRetries = exports.ChatConversationalAgentOutputParser = exports.ChatConversationalAgent = exports.ChatAgentOutputParser = exports.ChatAgent = exports.Toolkit = exports.createVectorStoreRouterAgent = exports.createVectorStoreAgent = exports.createSqlAgent = exports.createOpenApiAgent = exports.createJsonAgent = exports.ZapierToolKit = exports.VectorStoreToolkit = exports.VectorStoreRouterToolkit = exports.SqlToolkit = exports.RequestsToolkit = exports.OpenApiToolkit = exports.JsonToolkit = exports.LLMSingleActionAgent = exports.BaseSingleActionAgent = exports.Agent = void 0;
|
|
4
4
|
var agent_js_1 = require("./agent.cjs");
|
|
5
5
|
Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return agent_js_1.Agent; } });
|
|
6
6
|
Object.defineProperty(exports, "BaseSingleActionAgent", { enumerable: true, get: function () { return agent_js_1.BaseSingleActionAgent; } });
|
|
@@ -28,6 +28,7 @@ var index_js_3 = require("./chat_convo/index.cjs");
|
|
|
28
28
|
Object.defineProperty(exports, "ChatConversationalAgent", { enumerable: true, get: function () { return index_js_3.ChatConversationalAgent; } });
|
|
29
29
|
var outputParser_js_2 = require("./chat_convo/outputParser.cjs");
|
|
30
30
|
Object.defineProperty(exports, "ChatConversationalAgentOutputParser", { enumerable: true, get: function () { return outputParser_js_2.ChatConversationalAgentOutputParser; } });
|
|
31
|
+
Object.defineProperty(exports, "ChatConversationalAgentOutputParserWithRetries", { enumerable: true, get: function () { return outputParser_js_2.ChatConversationalAgentOutputParserWithRetries; } });
|
|
31
32
|
var executor_js_1 = require("./executor.cjs");
|
|
32
33
|
Object.defineProperty(exports, "AgentExecutor", { enumerable: true, get: function () { return executor_js_1.AgentExecutor; } });
|
|
33
34
|
var initialize_js_1 = require("./initialize.cjs");
|
package/dist/agents/index.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ export { Toolkit } from "./agent_toolkits/base.js";
|
|
|
4
4
|
export { ChatAgent, ChatAgentInput, ChatCreatePromptArgs, } from "./chat/index.js";
|
|
5
5
|
export { ChatAgentOutputParser } from "./chat/outputParser.js";
|
|
6
6
|
export { ChatConversationalAgent, ChatConversationalAgentInput, ChatConversationalCreatePromptArgs, } from "./chat_convo/index.js";
|
|
7
|
-
export { ChatConversationalAgentOutputParser } from "./chat_convo/outputParser.js";
|
|
7
|
+
export { ChatConversationalAgentOutputParser, ChatConversationalAgentOutputParserArgs, ChatConversationalAgentOutputParserWithRetries, ChatConversationalAgentOutputParserFormatInstructionsOptions, } from "./chat_convo/outputParser.js";
|
|
8
8
|
export { AgentExecutor, AgentExecutorInput } from "./executor.js";
|
|
9
9
|
export { initializeAgentExecutor, initializeAgentExecutorWithOptions, InitializeAgentExecutorOptions, } from "./initialize.js";
|
|
10
10
|
export { ZeroShotAgent, ZeroShotAgentInput, ZeroShotCreatePromptArgs, } from "./mrkl/index.js";
|
|
11
11
|
export { ZeroShotAgentOutputParser } from "./mrkl/outputParser.js";
|
|
12
12
|
export { AgentActionOutputParser, AgentInput, SerializedAgent, SerializedAgentT, SerializedZeroShotAgent, StoppingMethod, } from "./types.js";
|
|
13
13
|
export { StructuredChatAgent, StructuredChatAgentInput, StructuredChatCreatePromptArgs, } from "./structured_chat/index.js";
|
|
14
|
-
export { StructuredChatOutputParser, StructuredChatOutputParserWithRetries, } from "./structured_chat/outputParser.js";
|
|
14
|
+
export { StructuredChatOutputParser, StructuredChatOutputParserArgs, StructuredChatOutputParserWithRetries, } from "./structured_chat/outputParser.js";
|
package/dist/agents/index.js
CHANGED
|
@@ -4,7 +4,7 @@ export { Toolkit } from "./agent_toolkits/base.js";
|
|
|
4
4
|
export { ChatAgent, } from "./chat/index.js";
|
|
5
5
|
export { ChatAgentOutputParser } from "./chat/outputParser.js";
|
|
6
6
|
export { ChatConversationalAgent, } from "./chat_convo/index.js";
|
|
7
|
-
export { ChatConversationalAgentOutputParser } from "./chat_convo/outputParser.js";
|
|
7
|
+
export { ChatConversationalAgentOutputParser, ChatConversationalAgentOutputParserWithRetries, } from "./chat_convo/outputParser.js";
|
|
8
8
|
export { AgentExecutor } from "./executor.js";
|
|
9
9
|
export { initializeAgentExecutor, initializeAgentExecutorWithOptions, } from "./initialize.js";
|
|
10
10
|
export { ZeroShotAgent, } from "./mrkl/index.js";
|
|
@@ -16,6 +16,12 @@ class ZeroShotAgent extends agent_js_1.Agent {
|
|
|
16
16
|
constructor(input) {
|
|
17
17
|
const outputParser = input?.outputParser ?? ZeroShotAgent.getDefaultOutputParser();
|
|
18
18
|
super({ ...input, outputParser });
|
|
19
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: ["langchain", "agents", "mrkl"]
|
|
24
|
+
});
|
|
19
25
|
}
|
|
20
26
|
_agentType() {
|
|
21
27
|
return "zero-shot-react-description";
|
|
@@ -19,6 +19,7 @@ export type ZeroShotAgentInput = Optional<AgentInput, "outputParser">;
|
|
|
19
19
|
* @augments Agent
|
|
20
20
|
*/
|
|
21
21
|
export declare class ZeroShotAgent extends Agent {
|
|
22
|
+
lc_namespace: string[];
|
|
22
23
|
ToolType: Tool;
|
|
23
24
|
constructor(input: ZeroShotAgentInput);
|
|
24
25
|
_agentType(): "zero-shot-react-description";
|
|
@@ -13,6 +13,12 @@ export class ZeroShotAgent extends Agent {
|
|
|
13
13
|
constructor(input) {
|
|
14
14
|
const outputParser = input?.outputParser ?? ZeroShotAgent.getDefaultOutputParser();
|
|
15
15
|
super({ ...input, outputParser });
|
|
16
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: ["langchain", "agents", "mrkl"]
|
|
21
|
+
});
|
|
16
22
|
}
|
|
17
23
|
_agentType() {
|
|
18
24
|
return "zero-shot-react-description";
|
|
@@ -6,7 +6,13 @@ const prompt_js_1 = require("./prompt.cjs");
|
|
|
6
6
|
exports.FINAL_ANSWER_ACTION = "Final Answer:";
|
|
7
7
|
class ZeroShotAgentOutputParser extends types_js_1.AgentActionOutputParser {
|
|
8
8
|
constructor(fields) {
|
|
9
|
-
super();
|
|
9
|
+
super(fields);
|
|
10
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: ["langchain", "agents", "mrkl"]
|
|
15
|
+
});
|
|
10
16
|
Object.defineProperty(this, "finishToolName", {
|
|
11
17
|
enumerable: true,
|
|
12
18
|
configurable: true,
|
|
@@ -2,6 +2,7 @@ import { OutputParserArgs } from "../agent.js";
|
|
|
2
2
|
import { AgentActionOutputParser } from "../types.js";
|
|
3
3
|
export declare const FINAL_ANSWER_ACTION = "Final Answer:";
|
|
4
4
|
export declare class ZeroShotAgentOutputParser extends AgentActionOutputParser {
|
|
5
|
+
lc_namespace: string[];
|
|
5
6
|
finishToolName: string;
|
|
6
7
|
constructor(fields?: OutputParserArgs);
|
|
7
8
|
parse(text: string): Promise<{
|
|
@@ -3,7 +3,13 @@ import { FORMAT_INSTRUCTIONS } from "./prompt.js";
|
|
|
3
3
|
export const FINAL_ANSWER_ACTION = "Final Answer:";
|
|
4
4
|
export class ZeroShotAgentOutputParser extends AgentActionOutputParser {
|
|
5
5
|
constructor(fields) {
|
|
6
|
-
super();
|
|
6
|
+
super(fields);
|
|
7
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
configurable: true,
|
|
10
|
+
writable: true,
|
|
11
|
+
value: ["langchain", "agents", "mrkl"]
|
|
12
|
+
});
|
|
7
13
|
Object.defineProperty(this, "finishToolName", {
|
|
8
14
|
enumerable: true,
|
|
9
15
|
configurable: true,
|
|
@@ -16,6 +16,12 @@ class StructuredChatAgent extends agent_js_1.Agent {
|
|
|
16
16
|
constructor(input) {
|
|
17
17
|
const outputParser = input?.outputParser ?? StructuredChatAgent.getDefaultOutputParser();
|
|
18
18
|
super({ ...input, outputParser });
|
|
19
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: ["langchain", "agents", "structured_chat"]
|
|
24
|
+
});
|
|
19
25
|
}
|
|
20
26
|
_agentType() {
|
|
21
27
|
return "structured-chat-zero-shot-react-description";
|
|
@@ -22,6 +22,7 @@ export type StructuredChatAgentInput = Optional<AgentInput, "outputParser">;
|
|
|
22
22
|
* @augments Agent
|
|
23
23
|
*/
|
|
24
24
|
export declare class StructuredChatAgent extends Agent {
|
|
25
|
+
lc_namespace: string[];
|
|
25
26
|
constructor(input: StructuredChatAgentInput);
|
|
26
27
|
_agentType(): "structured-chat-zero-shot-react-description";
|
|
27
28
|
observationPrefix(): string;
|
|
@@ -13,6 +13,12 @@ export class StructuredChatAgent extends Agent {
|
|
|
13
13
|
constructor(input) {
|
|
14
14
|
const outputParser = input?.outputParser ?? StructuredChatAgent.getDefaultOutputParser();
|
|
15
15
|
super({ ...input, outputParser });
|
|
16
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: ["langchain", "agents", "structured_chat"]
|
|
21
|
+
});
|
|
16
22
|
}
|
|
17
23
|
_agentType() {
|
|
18
24
|
return "structured-chat-zero-shot-react-description";
|
|
@@ -7,14 +7,21 @@ const fix_js_1 = require("../../output_parsers/fix.cjs");
|
|
|
7
7
|
const output_parser_js_1 = require("../../schema/output_parser.cjs");
|
|
8
8
|
const index_js_1 = require("../../prompts/index.cjs");
|
|
9
9
|
class StructuredChatOutputParser extends types_js_1.AgentActionOutputParser {
|
|
10
|
-
constructor(
|
|
11
|
-
super();
|
|
10
|
+
constructor(fields) {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: ["langchain", "agents", "structured_chat"]
|
|
17
|
+
});
|
|
12
18
|
Object.defineProperty(this, "toolNames", {
|
|
13
19
|
enumerable: true,
|
|
14
20
|
configurable: true,
|
|
15
21
|
writable: true,
|
|
16
|
-
value:
|
|
22
|
+
value: void 0
|
|
17
23
|
});
|
|
24
|
+
this.toolNames = fields.toolNames;
|
|
18
25
|
}
|
|
19
26
|
async parse(text) {
|
|
20
27
|
try {
|
|
@@ -43,7 +50,13 @@ class StructuredChatOutputParser extends types_js_1.AgentActionOutputParser {
|
|
|
43
50
|
exports.StructuredChatOutputParser = StructuredChatOutputParser;
|
|
44
51
|
class StructuredChatOutputParserWithRetries extends types_js_1.AgentActionOutputParser {
|
|
45
52
|
constructor(fields) {
|
|
46
|
-
super();
|
|
53
|
+
super(fields);
|
|
54
|
+
Object.defineProperty(this, "lc_namespace", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
configurable: true,
|
|
57
|
+
writable: true,
|
|
58
|
+
value: ["langchain", "agents", "structured_chat"]
|
|
59
|
+
});
|
|
47
60
|
Object.defineProperty(this, "baseParser", {
|
|
48
61
|
enumerable: true,
|
|
49
62
|
configurable: true,
|
|
@@ -64,7 +77,8 @@ class StructuredChatOutputParserWithRetries extends types_js_1.AgentActionOutput
|
|
|
64
77
|
});
|
|
65
78
|
this.toolNames = fields.toolNames ?? this.toolNames;
|
|
66
79
|
this.baseParser =
|
|
67
|
-
fields?.baseParser ??
|
|
80
|
+
fields?.baseParser ??
|
|
81
|
+
new StructuredChatOutputParser({ toolNames: this.toolNames });
|
|
68
82
|
this.outputFixingParser = fields?.outputFixingParser;
|
|
69
83
|
}
|
|
70
84
|
async parse(text, callbacks) {
|
|
@@ -80,7 +94,7 @@ class StructuredChatOutputParserWithRetries extends types_js_1.AgentActionOutput
|
|
|
80
94
|
}
|
|
81
95
|
static fromLLM(llm, options) {
|
|
82
96
|
const baseParser = options.baseParser ??
|
|
83
|
-
new StructuredChatOutputParser(options.toolNames ?? []);
|
|
97
|
+
new StructuredChatOutputParser({ toolNames: options.toolNames ?? [] });
|
|
84
98
|
const outputFixingParser = fix_js_1.OutputFixingParser.fromLLM(llm, baseParser);
|
|
85
99
|
return new StructuredChatOutputParserWithRetries({
|
|
86
100
|
baseParser,
|
|
@@ -4,8 +4,11 @@ import { BaseLanguageModel } from "../../base_language/index.js";
|
|
|
4
4
|
import { AgentAction, AgentFinish } from "../../schema/index.js";
|
|
5
5
|
import { Callbacks } from "../../callbacks/manager.js";
|
|
6
6
|
export declare class StructuredChatOutputParser extends AgentActionOutputParser {
|
|
7
|
+
lc_namespace: string[];
|
|
7
8
|
private toolNames;
|
|
8
|
-
constructor(
|
|
9
|
+
constructor(fields: {
|
|
10
|
+
toolNames: string[];
|
|
11
|
+
});
|
|
9
12
|
parse(text: string): Promise<AgentAction | AgentFinish>;
|
|
10
13
|
getFormatInstructions(): string;
|
|
11
14
|
}
|
|
@@ -15,6 +18,7 @@ export interface StructuredChatOutputParserArgs {
|
|
|
15
18
|
toolNames?: string[];
|
|
16
19
|
}
|
|
17
20
|
export declare class StructuredChatOutputParserWithRetries extends AgentActionOutputParser {
|
|
21
|
+
lc_namespace: string[];
|
|
18
22
|
private baseParser;
|
|
19
23
|
private outputFixingParser?;
|
|
20
24
|
private toolNames;
|