langchain 0.3.28 → 0.3.30
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/README.md +15 -12
- package/dist/agents/agent.cjs +37 -4
- package/dist/agents/agent.d.ts +1 -1
- package/dist/agents/agent.js +1 -1
- package/dist/agents/format_scratchpad/log.cjs +1 -2
- package/dist/agents/format_scratchpad/log_to_message.cjs +1 -2
- package/dist/agents/format_scratchpad/openai_functions.cjs +2 -3
- package/dist/agents/format_scratchpad/tool_calling.cjs +2 -3
- package/dist/agents/format_scratchpad/xml.cjs +1 -2
- package/dist/agents/initialize.cjs +2 -2
- package/dist/agents/mrkl/index.cjs +1 -1
- package/dist/agents/mrkl/index.d.ts +1 -1
- package/dist/agents/mrkl/index.js +1 -1
- package/dist/agents/openai_functions/index.cjs +4 -3
- package/dist/agents/openai_functions/index.d.ts +1 -0
- package/dist/agents/openai_functions/index.js +1 -0
- package/dist/agents/openai_functions/output_parser.cjs +1 -1
- package/dist/agents/openai_functions/output_parser.d.ts +1 -1
- package/dist/agents/openai_functions/output_parser.js +1 -1
- package/dist/agents/openai_tools/index.cjs +3 -3
- package/dist/agents/openai_tools/index.d.ts +1 -1
- package/dist/agents/openai_tools/index.js +1 -1
- package/dist/agents/openai_tools/output_parser.cjs +1 -1
- package/dist/agents/openai_tools/output_parser.d.ts +1 -1
- package/dist/agents/openai_tools/output_parser.js +1 -1
- package/dist/agents/react/index.cjs +1 -2
- package/dist/agents/structured_chat/index.cjs +3 -3
- package/dist/agents/structured_chat/index.d.ts +1 -1
- package/dist/agents/structured_chat/index.js +1 -1
- package/dist/agents/structured_chat/outputParser.cjs +1 -1
- package/dist/agents/structured_chat/outputParser.d.ts +1 -1
- package/dist/agents/structured_chat/outputParser.js +1 -1
- package/dist/agents/structured_chat/prompt.d.ts +1 -1
- package/dist/agents/tool_calling/index.cjs +1 -2
- package/dist/agents/tool_calling/output_parser.cjs +2 -2
- package/dist/agents/toolkits/conversational_retrieval/openai_functions.cjs +1 -2
- package/dist/agents/toolkits/conversational_retrieval/tool.cjs +1 -2
- package/dist/agents/toolkits/json/json.cjs +2 -2
- package/dist/agents/toolkits/openapi/openapi.cjs +3 -3
- package/dist/agents/toolkits/openapi/openapi.d.ts +1 -1
- package/dist/agents/toolkits/openapi/openapi.js +1 -1
- package/dist/agents/toolkits/sql/sql.cjs +3 -3
- package/dist/agents/toolkits/sql/sql.d.ts +1 -1
- package/dist/agents/toolkits/sql/sql.js +1 -1
- package/dist/agents/toolkits/vectorstore/vectorstore.cjs +4 -4
- package/dist/agents/toolkits/vectorstore/vectorstore.d.ts +1 -1
- package/dist/agents/toolkits/vectorstore/vectorstore.js +1 -1
- package/dist/agents/xml/index.cjs +2 -2
- package/dist/chains/analyze_documents_chain.cjs +1 -1
- package/dist/chains/analyze_documents_chain.d.ts +1 -1
- package/dist/chains/analyze_documents_chain.js +1 -1
- package/dist/chains/api/prompts.d.ts +1 -1
- package/dist/chains/base.cjs +42 -9
- package/dist/chains/base.d.ts +2 -2
- package/dist/chains/base.js +1 -1
- package/dist/chains/combine_documents/base.cjs +2 -2
- package/dist/chains/combine_documents/reduce.cjs +2 -3
- package/dist/chains/combine_documents/stuff.cjs +1 -2
- package/dist/chains/constitutional_ai/constitutional_principle.cjs +2 -2
- package/dist/chains/constitutional_ai/constitutional_principle.d.ts +2 -2
- package/dist/chains/constitutional_ai/constitutional_principle.js +2 -2
- package/dist/chains/conversation.cjs +1 -1
- package/dist/chains/conversation.d.ts +1 -1
- package/dist/chains/conversation.js +1 -1
- package/dist/chains/graph_qa/cypher.cjs +1 -1
- package/dist/chains/graph_qa/cypher.d.ts +1 -1
- package/dist/chains/graph_qa/cypher.js +1 -1
- package/dist/chains/history_aware_retriever.cjs +2 -3
- package/dist/chains/history_aware_retriever.d.ts +1 -1
- package/dist/chains/history_aware_retriever.js +1 -1
- package/dist/chains/llm_chain.cjs +1 -1
- package/dist/chains/llm_chain.d.ts +1 -1
- package/dist/chains/llm_chain.js +1 -1
- package/dist/chains/openai_functions/base.cjs +3 -4
- package/dist/chains/openai_functions/base.d.ts +1 -1
- package/dist/chains/openai_functions/base.js +1 -1
- package/dist/chains/openai_functions/extraction.cjs +2 -3
- package/dist/chains/openai_functions/openapi.cjs +4 -5
- package/dist/chains/openai_functions/openapi.js +1 -1
- package/dist/chains/openai_functions/structured_output.cjs +4 -4
- package/dist/chains/openai_functions/structured_output.js +1 -1
- package/dist/chains/openai_functions/tagging.cjs +2 -3
- package/dist/chains/query_constructor/index.cjs +3 -3
- package/dist/chains/question_answering/load.cjs +4 -4
- package/dist/chains/retrieval.cjs +2 -3
- package/dist/chains/retrieval.d.ts +1 -1
- package/dist/chains/retrieval.js +1 -1
- package/dist/chains/router/multi_prompt.cjs +16 -13
- package/dist/chains/router/multi_prompt.d.ts +16 -13
- package/dist/chains/router/multi_prompt.js +16 -13
- package/dist/chains/router/multi_retrieval_qa.cjs +1 -1
- package/dist/chains/router/multi_retrieval_qa.d.ts +1 -1
- package/dist/chains/router/multi_retrieval_qa.js +1 -1
- package/dist/chains/router/utils.cjs +1 -2
- package/dist/chains/sequential_chain.cjs +4 -3
- package/dist/chains/sequential_chain.d.ts +2 -2
- package/dist/chains/sequential_chain.js +4 -3
- package/dist/chains/sql_db/sql_db_chain.cjs +3 -3
- package/dist/chains/sql_db/sql_db_chain.d.ts +1 -1
- package/dist/chains/sql_db/sql_db_chain.js +1 -1
- package/dist/chat_models/universal.cjs +54 -21
- package/dist/document_loaders/fs/buffer.cjs +34 -1
- package/dist/document_loaders/fs/buffer.d.ts +0 -3
- package/dist/document_loaders/fs/directory.cjs +35 -2
- package/dist/document_loaders/fs/directory.d.ts +0 -2
- package/dist/document_loaders/fs/text.cjs +34 -1
- package/dist/document_loaders/fs/text.d.ts +0 -1
- package/dist/document_transformers/openai_functions.cjs +4 -4
- package/dist/document_transformers/openai_functions.js +1 -1
- package/dist/evaluation/embedding_distance/base.cjs +3 -3
- package/dist/evaluation/loader.cjs +2 -3
- package/dist/evaluation/loader.js +1 -1
- package/dist/experimental/autogpt/agent.cjs +1 -1
- package/dist/experimental/autogpt/agent.d.ts +1 -1
- package/dist/experimental/autogpt/agent.js +1 -1
- package/dist/experimental/autogpt/output_parser.cjs +2 -2
- package/dist/experimental/autogpt/prompt_generator.cjs +2 -2
- package/dist/experimental/generative_agents/generative_agent.cjs +2 -2
- package/dist/experimental/generative_agents/generative_agent.d.ts +1 -1
- package/dist/experimental/generative_agents/generative_agent.js +2 -2
- package/dist/experimental/openai_assistant/index.cjs +8 -4
- package/dist/experimental/openai_assistant/index.d.ts +6 -6
- package/dist/experimental/openai_assistant/index.js +9 -5
- package/dist/experimental/openai_files/index.cjs +2 -2
- package/dist/experimental/openai_files/index.d.ts +6 -4
- package/dist/experimental/openai_files/index.js +2 -2
- package/dist/experimental/plan_and_execute/agent_executor.cjs +2 -2
- package/dist/hub/base.cjs +4 -5
- package/dist/hub/index.cjs +2 -2
- package/dist/hub/node.cjs +43 -10
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -1
- package/dist/load/import_map.cjs +17 -7
- package/dist/load/index.cjs +18 -9
- package/dist/memory/buffer_memory.cjs +1 -1
- package/dist/memory/buffer_memory.d.ts +1 -1
- package/dist/memory/buffer_memory.js +1 -1
- package/dist/memory/buffer_token_memory.cjs +1 -1
- package/dist/memory/buffer_token_memory.d.ts +1 -1
- package/dist/memory/buffer_token_memory.js +1 -1
- package/dist/memory/buffer_window_memory.cjs +1 -1
- package/dist/memory/buffer_window_memory.d.ts +1 -1
- package/dist/memory/buffer_window_memory.js +1 -1
- package/dist/memory/entity_memory.cjs +2 -2
- package/dist/memory/entity_memory.d.ts +2 -2
- package/dist/memory/entity_memory.js +2 -2
- package/dist/memory/summary.cjs +2 -2
- package/dist/memory/summary.d.ts +2 -2
- package/dist/memory/summary.js +2 -2
- package/dist/memory/summary_buffer.cjs +2 -2
- package/dist/memory/summary_buffer.d.ts +2 -2
- package/dist/memory/summary_buffer.js +2 -2
- package/dist/output_parsers/expression_type_handlers/base.cjs +34 -1
- package/dist/prompts/index.cjs +0 -1
- package/dist/prompts/index.d.ts +0 -1
- package/dist/prompts/index.js +1 -1
- package/dist/retrievers/hyde.cjs +3 -3
- package/dist/retrievers/hyde.d.ts +1 -1
- package/dist/retrievers/hyde.js +1 -1
- package/dist/retrievers/parent_document.cjs +17 -7
- package/dist/retrievers/self_query/index.cjs +1 -1
- package/dist/retrievers/self_query/index.d.ts +1 -1
- package/dist/retrievers/self_query/index.js +1 -1
- package/dist/smith/config.cjs +5 -6
- package/dist/smith/name_generation.cjs +1 -2
- package/dist/smith/runner_utils.cjs +1 -2
- package/dist/sql_db.cjs +35 -2
- package/dist/storage/encoder_backed.cjs +2 -2
- package/dist/storage/encoder_backed.d.ts +1 -1
- package/dist/storage/file_system.cjs +17 -7
- package/dist/storage/file_system.d.ts +1 -1
- package/dist/stores/file/node.cjs +17 -7
- package/dist/tools/convert_to_openai.cjs +2 -2
- package/dist/tools/render.cjs +2 -3
- package/dist/tools/retriever.cjs +1 -2
- package/dist/tools/webbrowser.cjs +18 -8
- package/dist/tools/webbrowser.d.ts +1 -1
- package/dist/tools/webbrowser.js +1 -1
- package/dist/util/axios-fetch-adapter.cjs +1 -1
- package/dist/util/azure.cjs +1 -2
- package/dist/util/entrypoint_deprecation.cjs +2 -3
- package/dist/util/load.cjs +34 -1
- package/dist/util/ml-distance/distances.cjs +3 -4
- package/dist/util/ml-distance/similarities.cjs +1 -2
- package/dist/util/ml-distance-euclidean/euclidean.cjs +2 -3
- package/dist/util/openapi.cjs +17 -7
- package/dist/util/openapi.d.ts +32 -32
- package/dist/util/parse.cjs +17 -7
- package/dist/util/prompt-layer.d.ts +1 -1
- package/dist/util/set.cjs +3 -4
- package/dist/util/time.cjs +1 -2
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ You can use npm, yarn, or pnpm to install LangChain.js
|
|
|
20
20
|
|
|
21
21
|
LangChain is written in TypeScript and can be used in:
|
|
22
22
|
|
|
23
|
-
- Node.js (ESM and CommonJS) - 18.x, 19.x, 20.x
|
|
23
|
+
- Node.js (ESM and CommonJS) - 18.x, 19.x, 20.x, 22.x
|
|
24
24
|
- Cloudflare Workers
|
|
25
25
|
- Vercel / Next.js (Browser, Serverless and Edge functions)
|
|
26
26
|
- Supabase Edge Functions
|
|
@@ -30,20 +30,23 @@ LangChain is written in TypeScript and can be used in:
|
|
|
30
30
|
## 🤔 What is LangChain?
|
|
31
31
|
|
|
32
32
|
**LangChain** is a framework for developing applications powered by language models. It enables applications that:
|
|
33
|
+
|
|
33
34
|
- **Are context-aware**: connect a language model to sources of context (prompt instructions, few shot examples, content to ground its response in, etc.)
|
|
34
35
|
- **Reason**: rely on a language model to reason (about how to answer based on provided context, what actions to take, etc.)
|
|
35
36
|
|
|
36
37
|
This framework consists of several parts.
|
|
38
|
+
|
|
37
39
|
- **Open-source libraries**: Build your applications using LangChain's open-source [building blocks](https://js.langchain.com/docs/concepts/lcel), [components](https://js.langchain.com/docs/concepts), and [third-party integrations](https://js.langchain.com/docs/integrations/platforms/).
|
|
38
|
-
Use [LangGraph.js](https://js.langchain.com/docs/concepts/#langgraphjs) to build stateful agents with first-class streaming and human-in-the-loop support.
|
|
40
|
+
Use [LangGraph.js](https://js.langchain.com/docs/concepts/#langgraphjs) to build stateful agents with first-class streaming and human-in-the-loop support.
|
|
39
41
|
- **Productionization**: Use [LangSmith](https://docs.smith.langchain.com/) to inspect, monitor and evaluate your chains, so that you can continuously optimize and deploy with confidence.
|
|
40
42
|
- **Deployment**: Turn your LangGraph applications into production-ready APIs and Assistants with [LangGraph Cloud](https://langchain-ai.github.io/langgraph/cloud/).
|
|
41
43
|
|
|
42
44
|
The LangChain libraries themselves are made up of several different packages.
|
|
45
|
+
|
|
43
46
|
- **[`@langchain/core`](https://github.com/langchain-ai/langchainjs/blob/main/langchain-core)**: Base abstractions and LangChain Expression Language.
|
|
44
47
|
- **[`@langchain/community`](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-community)**: Third party integrations.
|
|
45
48
|
- **[`langchain`](https://github.com/langchain-ai/langchainjs/blob/main/langchain)**: Chains, agents, and retrieval strategies that make up an application's cognitive architecture.
|
|
46
|
-
- **[LangGraph.js](https://langchain-ai.github.io/langgraphjs/)**:
|
|
49
|
+
- **[LangGraph.js](https://langchain-ai.github.io/langgraphjs/)**: LangGraph powers production-grade agents, trusted by Linkedin, Uber, Klarna, GitLab, and many more. Build robust and stateful multi-actor applications with LLMs by modeling steps as edges and nodes in a graph. Integrates smoothly with LangChain, but can be used without it.
|
|
47
50
|
|
|
48
51
|
Integrations may also be split into their own compatible packages.
|
|
49
52
|
|
|
@@ -53,22 +56,22 @@ This library aims to assist in the development of those types of applications. C
|
|
|
53
56
|
|
|
54
57
|
**❓Question Answering over specific documents**
|
|
55
58
|
|
|
56
|
-
- [Documentation](https://js.langchain.com/docs/tutorials/rag)
|
|
59
|
+
- [Documentation](https://js.langchain.com/docs/tutorials/rag/)
|
|
57
60
|
- End-to-end Example: [Doc-Chatbot](https://github.com/dissorial/doc-chatbot)
|
|
58
61
|
|
|
59
|
-
|
|
60
62
|
**💬 Chatbots**
|
|
61
63
|
|
|
62
|
-
- [Documentation](https://js.langchain.com/docs/
|
|
63
|
-
- End-to-end Example: [Chat-LangChain](https://github.com/langchain-ai/chat-
|
|
64
|
+
- [Documentation](https://js.langchain.com/docs/tutorials/chatbot)
|
|
65
|
+
- End-to-end Example: [Chat-LangChain](https://github.com/langchain-ai/chat-langchain)
|
|
64
66
|
|
|
65
67
|
## 🚀 How does LangChain help?
|
|
66
68
|
|
|
67
69
|
The main value props of the LangChain libraries are:
|
|
70
|
+
|
|
68
71
|
1. **Components**: composable tools and integrations for working with language models. Components are modular and easy-to-use, whether you are using the rest of the LangChain framework or not
|
|
69
72
|
2. **Off-the-shelf chains**: built-in assemblages of components for accomplishing higher-level tasks
|
|
70
73
|
|
|
71
|
-
Off-the-shelf chains make it easy to get started. Components make it easy to customize existing chains and build new ones.
|
|
74
|
+
Off-the-shelf chains make it easy to get started. Components make it easy to customize existing chains and build new ones.
|
|
72
75
|
|
|
73
76
|
Components fall into the following **modules**:
|
|
74
77
|
|
|
@@ -84,14 +87,14 @@ Data Augmented Generation involves specific types of chains that first interact
|
|
|
84
87
|
|
|
85
88
|
Agents allow an LLM autonomy over how a task is accomplished. Agents make decisions about which Actions to take, then take that Action, observe the result, and repeat until the task is complete. LangChain provides a [standard interface for agents](https://js.langchain.com/docs/concepts/#agents), along with [LangGraph.js](https://github.com/langchain-ai/langgraphjs/) for building custom agents.
|
|
86
89
|
|
|
87
|
-
## 📖
|
|
88
|
-
|
|
89
|
-
Please see [here](https://js.langchain.com) for full documentation, which includes:
|
|
90
|
+
## 📖 Additional Resources
|
|
90
91
|
|
|
91
92
|
- [Getting started](https://js.langchain.com/docs/introduction): installation, setting up the environment, simple examples
|
|
92
93
|
- Overview of the [interfaces](https://js.langchain.com/docs/how_to/lcel_cheatsheet/), [modules](https://js.langchain.com/docs/concepts) and [integrations](https://js.langchain.com/docs/integrations/platforms/)
|
|
94
|
+
- [Full Documentation](https://js.langchain.com)
|
|
93
95
|
- [Tutorial](https://js.langchain.com/docs/tutorials/) walkthroughs
|
|
94
|
-
- [
|
|
96
|
+
- [Langhain Forum](https://forum.langchain.com)
|
|
97
|
+
- [API Reference](https://api.js.langchain.com)
|
|
95
98
|
|
|
96
99
|
## 💁 Contributing
|
|
97
100
|
|
package/dist/agents/agent.cjs
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Agent = exports.LLMSingleActionAgent = exports.RunnableAgent = exports.RunnableMultiActionAgent = exports.RunnableSingleActionAgent = exports.AgentRunnableSequence = exports.
|
|
36
|
+
exports.Agent = exports.LLMSingleActionAgent = exports.RunnableAgent = exports.RunnableMultiActionAgent = exports.RunnableSingleActionAgent = exports.AgentRunnableSequence = exports.BaseMultiActionAgent = exports.BaseSingleActionAgent = exports.BaseAgent = void 0;
|
|
37
|
+
exports.isRunnableAgent = isRunnableAgent;
|
|
4
38
|
const serializable_1 = require("@langchain/core/load/serializable");
|
|
5
39
|
const runnables_1 = require("@langchain/core/runnables");
|
|
6
40
|
/**
|
|
@@ -85,7 +119,6 @@ function isRunnableAgent(x) {
|
|
|
85
119
|
return (x.runnable !==
|
|
86
120
|
undefined);
|
|
87
121
|
}
|
|
88
|
-
exports.isRunnableAgent = isRunnableAgent;
|
|
89
122
|
// TODO: Remove in the future. Only for backwards compatibility.
|
|
90
123
|
// Allows for the creation of runnables with properties that will
|
|
91
124
|
// be passed to the agent executor constructor.
|
|
@@ -307,7 +340,7 @@ exports.RunnableAgent = RunnableAgent;
|
|
|
307
340
|
* const agent = new LLMSingleActionAgent({
|
|
308
341
|
* llmChain: new LLMChain({
|
|
309
342
|
* prompt: customPromptTemplate,
|
|
310
|
-
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
343
|
+
* llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
|
|
311
344
|
* }),
|
|
312
345
|
* outputParser: customOutputParser,
|
|
313
346
|
* stop: ["\nObservation"],
|
|
@@ -526,7 +559,7 @@ class Agent extends BaseSingleActionAgent {
|
|
|
526
559
|
static async deserialize(data) {
|
|
527
560
|
switch (data._type) {
|
|
528
561
|
case "zero-shot-react-description": {
|
|
529
|
-
const { ZeroShotAgent } = await
|
|
562
|
+
const { ZeroShotAgent } = await Promise.resolve().then(() => __importStar(require("./mrkl/index.cjs")));
|
|
530
563
|
return ZeroShotAgent.deserialize(data);
|
|
531
564
|
}
|
|
532
565
|
default:
|
package/dist/agents/agent.d.ts
CHANGED
|
@@ -159,7 +159,7 @@ export interface LLMSingleActionAgentInput {
|
|
|
159
159
|
* const agent = new LLMSingleActionAgent({
|
|
160
160
|
* llmChain: new LLMChain({
|
|
161
161
|
* prompt: customPromptTemplate,
|
|
162
|
-
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
162
|
+
* llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
|
|
163
163
|
* }),
|
|
164
164
|
* outputParser: customOutputParser,
|
|
165
165
|
* stop: ["\nObservation"],
|
package/dist/agents/agent.js
CHANGED
|
@@ -296,7 +296,7 @@ export class RunnableAgent extends RunnableMultiActionAgent {
|
|
|
296
296
|
* const agent = new LLMSingleActionAgent({
|
|
297
297
|
* llmChain: new LLMChain({
|
|
298
298
|
* prompt: customPromptTemplate,
|
|
299
|
-
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
299
|
+
* llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
|
|
300
300
|
* }),
|
|
301
301
|
* outputParser: customOutputParser,
|
|
302
302
|
* stop: ["\nObservation"],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatLogToString =
|
|
3
|
+
exports.formatLogToString = formatLogToString;
|
|
4
4
|
/**
|
|
5
5
|
* Construct the scratchpad that lets the agent continue its thought process.
|
|
6
6
|
* @param intermediateSteps
|
|
@@ -13,4 +13,3 @@ function formatLogToString(intermediateSteps, observationPrefix = "Observation:
|
|
|
13
13
|
[action.log, `\n${observationPrefix}${observation}`, llmPrefix].join("\n"), "");
|
|
14
14
|
return formattedSteps;
|
|
15
15
|
}
|
|
16
|
-
exports.formatLogToString = formatLogToString;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatLogToMessage =
|
|
3
|
+
exports.formatLogToMessage = formatLogToMessage;
|
|
4
4
|
const messages_1 = require("@langchain/core/messages");
|
|
5
5
|
const prompts_1 = require("@langchain/core/prompts");
|
|
6
6
|
function formatLogToMessage(intermediateSteps, templateToolResponse = "{observation}") {
|
|
@@ -19,4 +19,3 @@ function formatLogToMessage(intermediateSteps, templateToolResponse = "{observat
|
|
|
19
19
|
}
|
|
20
20
|
return thoughts;
|
|
21
21
|
}
|
|
22
|
-
exports.formatLogToMessage = formatLogToMessage;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.formatForOpenAIFunctions = formatForOpenAIFunctions;
|
|
4
|
+
exports.formatToOpenAIFunctionMessages = formatToOpenAIFunctionMessages;
|
|
4
5
|
const messages_1 = require("@langchain/core/messages");
|
|
5
6
|
const prompts_1 = require("@langchain/core/prompts");
|
|
6
7
|
const prompt_js_1 = require("../chat_convo/prompt.cjs");
|
|
@@ -23,7 +24,6 @@ function formatForOpenAIFunctions(steps) {
|
|
|
23
24
|
}
|
|
24
25
|
return thoughts;
|
|
25
26
|
}
|
|
26
|
-
exports.formatForOpenAIFunctions = formatForOpenAIFunctions;
|
|
27
27
|
/**
|
|
28
28
|
* Format a list of AgentSteps into a list of BaseMessage instances for
|
|
29
29
|
* agents that use OpenAI's API. Helpful for passing in previous agent
|
|
@@ -43,4 +43,3 @@ function formatToOpenAIFunctionMessages(steps) {
|
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
exports.formatToOpenAIFunctionMessages = formatToOpenAIFunctionMessages;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports._createToolMessage = _createToolMessage;
|
|
4
|
+
exports.formatToToolMessages = formatToToolMessages;
|
|
4
5
|
const messages_1 = require("@langchain/core/messages");
|
|
5
6
|
/**
|
|
6
7
|
* Convert agent action and observation into a function message.
|
|
@@ -15,7 +16,6 @@ function _createToolMessage(step) {
|
|
|
15
16
|
additional_kwargs: { name: step.action.tool },
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
|
-
exports._createToolMessage = _createToolMessage;
|
|
19
19
|
function formatToToolMessages(steps) {
|
|
20
20
|
return steps.flatMap(({ action, observation }) => {
|
|
21
21
|
if ("messageLog" in action && action.messageLog !== undefined) {
|
|
@@ -27,4 +27,3 @@ function formatToToolMessages(steps) {
|
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
exports.formatToToolMessages = formatToToolMessages;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatXml =
|
|
3
|
+
exports.formatXml = formatXml;
|
|
4
4
|
function formatXml(intermediateSteps) {
|
|
5
5
|
let log = "";
|
|
6
6
|
for (const step of intermediateSteps) {
|
|
@@ -9,4 +9,3 @@ function formatXml(intermediateSteps) {
|
|
|
9
9
|
}
|
|
10
10
|
return log;
|
|
11
11
|
}
|
|
12
|
-
exports.formatXml = formatXml;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.initializeAgentExecutor = void 0;
|
|
4
|
+
exports.initializeAgentExecutorWithOptions = initializeAgentExecutorWithOptions;
|
|
4
5
|
const buffer_memory_js_1 = require("../memory/buffer_memory.cjs");
|
|
5
6
|
const index_js_1 = require("./chat/index.cjs");
|
|
6
7
|
const index_js_2 = require("./chat_convo/index.cjs");
|
|
@@ -133,4 +134,3 @@ async function initializeAgentExecutorWithOptions(tools, llm, options = {
|
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
|
-
exports.initializeAgentExecutorWithOptions = initializeAgentExecutorWithOptions;
|
|
@@ -15,7 +15,7 @@ const prompt_js_1 = require("./prompt.cjs");
|
|
|
15
15
|
*
|
|
16
16
|
* const agent = new ZeroShotAgent({
|
|
17
17
|
* llmChain: new LLMChain({
|
|
18
|
-
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
18
|
+
* llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
|
|
19
19
|
* prompt: ZeroShotAgent.createPrompt([new SerpAPI(), new Calculator()], {
|
|
20
20
|
* prefix: `Answer the following questions as best you can, but speaking as a pirate might speak. You have access to the following tools:`,
|
|
21
21
|
* suffix: `Begin! Remember to speak as a pirate when giving your final answer. Use lots of "Args"
|
|
@@ -29,7 +29,7 @@ export type ZeroShotAgentInput = Optional<AgentInput, "outputParser">;
|
|
|
29
29
|
*
|
|
30
30
|
* const agent = new ZeroShotAgent({
|
|
31
31
|
* llmChain: new LLMChain({
|
|
32
|
-
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
32
|
+
* llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
|
|
33
33
|
* prompt: ZeroShotAgent.createPrompt([new SerpAPI(), new Calculator()], {
|
|
34
34
|
* prefix: `Answer the following questions as best you can, but speaking as a pirate might speak. You have access to the following tools:`,
|
|
35
35
|
* suffix: `Begin! Remember to speak as a pirate when giving your final answer. Use lots of "Args"
|
|
@@ -12,7 +12,7 @@ import { FORMAT_INSTRUCTIONS, PREFIX, SUFFIX } from "./prompt.js";
|
|
|
12
12
|
*
|
|
13
13
|
* const agent = new ZeroShotAgent({
|
|
14
14
|
* llmChain: new LLMChain({
|
|
15
|
-
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
15
|
+
* llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
|
|
16
16
|
* prompt: ZeroShotAgent.createPrompt([new SerpAPI(), new Calculator()], {
|
|
17
17
|
* prefix: `Answer the following questions as best you can, but speaking as a pirate might speak. You have access to the following tools:`,
|
|
18
18
|
* suffix: `Begin! Remember to speak as a pirate when giving your final answer. Use lots of "Args"
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.OpenAIAgent = void 0;
|
|
4
|
+
exports._formatIntermediateSteps = _formatIntermediateSteps;
|
|
5
|
+
exports.createOpenAIFunctionsAgent = createOpenAIFunctionsAgent;
|
|
4
6
|
const runnables_1 = require("@langchain/core/runnables");
|
|
5
7
|
const function_calling_1 = require("@langchain/core/utils/function_calling");
|
|
6
8
|
const messages_1 = require("@langchain/core/messages");
|
|
@@ -29,7 +31,6 @@ function _convertAgentStepToMessages(action, observation) {
|
|
|
29
31
|
function _formatIntermediateSteps(intermediateSteps) {
|
|
30
32
|
return intermediateSteps.flatMap(({ action, observation }) => _convertAgentStepToMessages(action, observation));
|
|
31
33
|
}
|
|
32
|
-
exports._formatIntermediateSteps = _formatIntermediateSteps;
|
|
33
34
|
/**
|
|
34
35
|
* Class representing an agent for the OpenAI chat model in LangChain. It
|
|
35
36
|
* extends the Agent class and provides additional functionality specific
|
|
@@ -191,6 +192,7 @@ exports.OpenAIAgent = OpenAIAgent;
|
|
|
191
192
|
* );
|
|
192
193
|
*
|
|
193
194
|
* const llm = new ChatOpenAI({
|
|
195
|
+
* model: "gpt-4o-mini",
|
|
194
196
|
* temperature: 0,
|
|
195
197
|
* });
|
|
196
198
|
*
|
|
@@ -245,4 +247,3 @@ async function createOpenAIFunctionsAgent({ llm, tools, prompt, streamRunnable,
|
|
|
245
247
|
});
|
|
246
248
|
return agent;
|
|
247
249
|
}
|
|
248
|
-
exports.createOpenAIFunctionsAgent = createOpenAIFunctionsAgent;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.OpenAIToolsAgentOutputParser = void 0;
|
|
4
|
+
exports.createOpenAIToolsAgent = createOpenAIToolsAgent;
|
|
4
5
|
const runnables_1 = require("@langchain/core/runnables");
|
|
5
6
|
const function_calling_1 = require("@langchain/core/utils/function_calling");
|
|
6
7
|
const openai_tools_js_1 = require("../format_scratchpad/openai_tools.cjs");
|
|
@@ -35,7 +36,7 @@ const agent_js_1 = require("../agent.cjs");
|
|
|
35
36
|
*
|
|
36
37
|
* const llm = new ChatOpenAI({
|
|
37
38
|
* temperature: 0,
|
|
38
|
-
*
|
|
39
|
+
* model: "gpt-3.5-turbo-1106",
|
|
39
40
|
* });
|
|
40
41
|
*
|
|
41
42
|
* const agent = await createOpenAIToolsAgent({
|
|
@@ -89,4 +90,3 @@ async function createOpenAIToolsAgent({ llm, tools, prompt, streamRunnable, }) {
|
|
|
89
90
|
});
|
|
90
91
|
return agent;
|
|
91
92
|
}
|
|
92
|
-
exports.createOpenAIToolsAgent = createOpenAIToolsAgent;
|
|
@@ -18,7 +18,7 @@ import { AgentMultiActionOutputParser } from "../types.js";
|
|
|
18
18
|
* },
|
|
19
19
|
* prompt,
|
|
20
20
|
* new ChatOpenAI({
|
|
21
|
-
*
|
|
21
|
+
* model: "gpt-3.5-turbo-1106",
|
|
22
22
|
* temperature: 0,
|
|
23
23
|
* }).bindTools(tools),
|
|
24
24
|
* new OpenAIToolsAgentOutputParser(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createReactAgent =
|
|
3
|
+
exports.createReactAgent = createReactAgent;
|
|
4
4
|
const runnables_1 = require("@langchain/core/runnables");
|
|
5
5
|
const render_js_1 = require("../../tools/render.cjs");
|
|
6
6
|
const log_js_1 = require("../format_scratchpad/log.cjs");
|
|
@@ -78,4 +78,3 @@ async function createReactAgent({ llm, tools, prompt, streamRunnable, }) {
|
|
|
78
78
|
});
|
|
79
79
|
return agent;
|
|
80
80
|
}
|
|
81
|
-
exports.createReactAgent = createReactAgent;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.StructuredChatAgent = void 0;
|
|
4
|
+
exports.createStructuredChatAgent = createStructuredChatAgent;
|
|
4
5
|
const base_1 = require("@langchain/core/language_models/base");
|
|
5
6
|
const runnables_1 = require("@langchain/core/runnables");
|
|
6
7
|
const prompts_1 = require("@langchain/core/prompts");
|
|
@@ -190,7 +191,7 @@ exports.StructuredChatAgent = StructuredChatAgent;
|
|
|
190
191
|
*
|
|
191
192
|
* const llm = new ChatOpenAI({
|
|
192
193
|
* temperature: 0,
|
|
193
|
-
*
|
|
194
|
+
* model: "gpt-3.5-turbo-1106",
|
|
194
195
|
* });
|
|
195
196
|
*
|
|
196
197
|
* const agent = await createStructuredChatAgent({
|
|
@@ -257,4 +258,3 @@ async function createStructuredChatAgent({ llm, tools, prompt, streamRunnable, }
|
|
|
257
258
|
});
|
|
258
259
|
return agent;
|
|
259
260
|
}
|
|
260
|
-
exports.createStructuredChatAgent = createStructuredChatAgent;
|
|
@@ -139,7 +139,7 @@ export type CreateStructuredChatAgentParams = {
|
|
|
139
139
|
*
|
|
140
140
|
* const llm = new ChatOpenAI({
|
|
141
141
|
* temperature: 0,
|
|
142
|
-
*
|
|
142
|
+
* model: "gpt-3.5-turbo-1106",
|
|
143
143
|
* });
|
|
144
144
|
*
|
|
145
145
|
* const agent = await createStructuredChatAgent({
|
|
@@ -186,7 +186,7 @@ export class StructuredChatAgent extends Agent {
|
|
|
186
186
|
*
|
|
187
187
|
* const llm = new ChatOpenAI({
|
|
188
188
|
* temperature: 0,
|
|
189
|
-
*
|
|
189
|
+
* model: "gpt-3.5-turbo-1106",
|
|
190
190
|
* });
|
|
191
191
|
*
|
|
192
192
|
* const agent = await createStructuredChatAgent({
|
|
@@ -75,7 +75,7 @@ exports.StructuredChatOutputParser = StructuredChatOutputParser;
|
|
|
75
75
|
* @example
|
|
76
76
|
* ```typescript
|
|
77
77
|
* const outputParser = new StructuredChatOutputParserWithRetries.fromLLM(
|
|
78
|
-
* new ChatOpenAI({ temperature: 0 }),
|
|
78
|
+
* new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
|
|
79
79
|
* {
|
|
80
80
|
* toolNames: ["calculator", "random-number-generator"],
|
|
81
81
|
* },
|
|
@@ -48,7 +48,7 @@ export interface StructuredChatOutputParserArgs {
|
|
|
48
48
|
* @example
|
|
49
49
|
* ```typescript
|
|
50
50
|
* const outputParser = new StructuredChatOutputParserWithRetries.fromLLM(
|
|
51
|
-
* new ChatOpenAI({ temperature: 0 }),
|
|
51
|
+
* new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
|
|
52
52
|
* {
|
|
53
53
|
* toolNames: ["calculator", "random-number-generator"],
|
|
54
54
|
* },
|
|
@@ -71,7 +71,7 @@ export class StructuredChatOutputParser extends AgentActionOutputParser {
|
|
|
71
71
|
* @example
|
|
72
72
|
* ```typescript
|
|
73
73
|
* const outputParser = new StructuredChatOutputParserWithRetries.fromLLM(
|
|
74
|
-
* new ChatOpenAI({ temperature: 0 }),
|
|
74
|
+
* new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
|
|
75
75
|
* {
|
|
76
76
|
* toolNames: ["calculator", "random-number-generator"],
|
|
77
77
|
* },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const PREFIX = "Answer the following questions truthfully and as best you can.";
|
|
2
2
|
export declare const AGENT_ACTION_FORMAT_INSTRUCTIONS = "Output a JSON markdown code snippet containing a valid JSON blob (denoted below by $JSON_BLOB).\nThis $JSON_BLOB must have a \"action\" key (with the name of the tool to use) and an \"action_input\" key (tool input).\n\nValid \"action\" values: \"Final Answer\" (which you must use when giving your final response to the user), or one of [{tool_names}].\n\nThe $JSON_BLOB must be valid, parseable JSON and only contain a SINGLE action. Here is an example of an acceptable output:\n\n```json\n{{\n \"action\": $TOOL_NAME,\n \"action_input\": $INPUT\n}}\n```\n\nRemember to include the surrounding markdown code snippet delimiters (begin with \"```\" json and close with \"```\")!\n";
|
|
3
|
-
export declare const FORMAT_INSTRUCTIONS: string;
|
|
3
|
+
export declare const FORMAT_INSTRUCTIONS = "You have access to the following tools.\nYou must format your inputs to these tools to match their \"JSON schema\" definitions below.\n\n\"JSON Schema\" is a declarative language that allows you to annotate and validate JSON documents.\n\nFor example, the example \"JSON Schema\" instance {{\"properties\": {{\"foo\": {{\"description\": \"a list of test words\", \"type\": \"array\", \"items\": {{\"type\": \"string\"}}}}}}, \"required\": [\"foo\"]}}}}\nwould match an object with one required property, \"foo\". The \"type\" property specifies \"foo\" must be an \"array\", and the \"description\" property semantically describes it as \"a list of test words\". The items within \"foo\" must be strings.\nThus, the object {{\"foo\": [\"bar\", \"baz\"]}} is a well-formatted instance of this example \"JSON Schema\". The object {{\"properties\": {{\"foo\": [\"bar\", \"baz\"]}}}} is not well-formatted.\n\nHere are the JSON Schema instances for the tools you have access to:\n\n{tool_schemas}\n\nThe way you use the tools is as follows:\n\n------------------------\n\nOutput a JSON markdown code snippet containing a valid JSON blob (denoted below by $JSON_BLOB).\nThis $JSON_BLOB must have a \"action\" key (with the name of the tool to use) and an \"action_input\" key (tool input).\n\nValid \"action\" values: \"Final Answer\" (which you must use when giving your final response to the user), or one of [{tool_names}].\n\nThe $JSON_BLOB must be valid, parseable JSON and only contain a SINGLE action. Here is an example of an acceptable output:\n\n```json\n{{\n \"action\": $TOOL_NAME,\n \"action_input\": $INPUT\n}}\n```\n\nRemember to include the surrounding markdown code snippet delimiters (begin with \"```\" json and close with \"```\")!\n\n\nIf you are using a tool, \"action_input\" must adhere to the tool's input schema, given above.\n\n------------------------\n\nALWAYS use the following format:\n\nQuestion: the input question you must answer\nThought: you should always think about what to do\nAction:\n```json\n$JSON_BLOB\n```\nObservation: the result of the action\n... (this Thought/Action/Observation can repeat N times)\nThought: I now know the final answer\nAction:\n```json\n{{\n \"action\": \"Final Answer\",\n \"action_input\": \"Final response to human\"\n}}\n```";
|
|
4
4
|
export declare const SUFFIX = "Begin! Reminder to ALWAYS use the above format, and to use tools if appropriate.";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createToolCallingAgent =
|
|
3
|
+
exports.createToolCallingAgent = createToolCallingAgent;
|
|
4
4
|
const runnables_1 = require("@langchain/core/runnables");
|
|
5
5
|
const agent_js_1 = require("../agent.cjs");
|
|
6
6
|
const output_parser_js_1 = require("./output_parser.cjs");
|
|
@@ -91,4 +91,3 @@ function createToolCallingAgent({ llm, tools, prompt, streamRunnable, }) {
|
|
|
91
91
|
});
|
|
92
92
|
return agent;
|
|
93
93
|
}
|
|
94
|
-
exports.createToolCallingAgent = createToolCallingAgent;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ToolCallingAgentOutputParser =
|
|
3
|
+
exports.ToolCallingAgentOutputParser = void 0;
|
|
4
|
+
exports.parseAIMessageToToolAction = parseAIMessageToToolAction;
|
|
4
5
|
const messages_1 = require("@langchain/core/messages");
|
|
5
6
|
const output_parsers_1 = require("@langchain/core/output_parsers");
|
|
6
7
|
const types_js_1 = require("../types.cjs");
|
|
@@ -45,7 +46,6 @@ function parseAIMessageToToolAction(message) {
|
|
|
45
46
|
};
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
|
-
exports.parseAIMessageToToolAction = parseAIMessageToToolAction;
|
|
49
49
|
class ToolCallingAgentOutputParser extends types_js_1.AgentMultiActionOutputParser {
|
|
50
50
|
constructor() {
|
|
51
51
|
super(...arguments);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createConversationalRetrievalAgent =
|
|
3
|
+
exports.createConversationalRetrievalAgent = createConversationalRetrievalAgent;
|
|
4
4
|
const summary_buffer_js_1 = require("../../../memory/summary_buffer.cjs");
|
|
5
5
|
const initialize_js_1 = require("../../initialize.cjs");
|
|
6
6
|
const token_buffer_memory_js_1 = require("./token_buffer_memory.cjs");
|
|
@@ -47,4 +47,3 @@ async function createConversationalRetrievalAgent(llm, tools, options) {
|
|
|
47
47
|
});
|
|
48
48
|
return executor;
|
|
49
49
|
}
|
|
50
|
-
exports.createConversationalRetrievalAgent = createConversationalRetrievalAgent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createRetrieverTool =
|
|
3
|
+
exports.createRetrieverTool = createRetrieverTool;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const tools_1 = require("@langchain/core/tools");
|
|
6
6
|
const document_js_1 = require("../../../util/document.cjs");
|
|
@@ -17,4 +17,3 @@ function createRetrieverTool(retriever, input) {
|
|
|
17
17
|
});
|
|
18
18
|
return new tools_1.DynamicStructuredTool({ ...input, func, schema });
|
|
19
19
|
}
|
|
20
|
-
exports.createRetrieverTool = createRetrieverTool;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.JsonToolkit = void 0;
|
|
4
|
+
exports.createJsonAgent = createJsonAgent;
|
|
4
5
|
const tools_1 = require("@langchain/core/tools");
|
|
5
6
|
const json_js_1 = require("../../../tools/json.cjs");
|
|
6
7
|
const prompt_js_1 = require("./prompt.cjs");
|
|
@@ -73,4 +74,3 @@ function createJsonAgent(llm, toolkit, args) {
|
|
|
73
74
|
returnIntermediateSteps: true,
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
|
-
exports.createJsonAgent = createJsonAgent;
|