@librechat/agents 3.0.0 → 3.0.2
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/cjs/common/enum.cjs +0 -1
- package/dist/cjs/common/enum.cjs.map +1 -1
- package/dist/cjs/llm/providers.cjs +0 -2
- package/dist/cjs/llm/providers.cjs.map +1 -1
- package/dist/cjs/main.cjs +2 -0
- package/dist/cjs/main.cjs.map +1 -1
- package/dist/cjs/tools/Calculator.cjs +45 -0
- package/dist/cjs/tools/Calculator.cjs.map +1 -0
- package/dist/esm/common/enum.mjs +0 -1
- package/dist/esm/common/enum.mjs.map +1 -1
- package/dist/esm/llm/providers.mjs +0 -2
- package/dist/esm/llm/providers.mjs.map +1 -1
- package/dist/esm/main.mjs +1 -0
- package/dist/esm/main.mjs.map +1 -1
- package/dist/esm/tools/Calculator.mjs +24 -0
- package/dist/esm/tools/Calculator.mjs.map +1 -0
- package/dist/types/common/enum.d.ts +0 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/tools/Calculator.d.ts +8 -0
- package/dist/types/types/llm.d.ts +1 -6
- package/package.json +5 -3
- package/src/common/enum.ts +0 -1
- package/src/index.ts +1 -0
- package/src/llm/providers.ts +0 -2
- package/src/scripts/abort.ts +34 -15
- package/src/scripts/cli.ts +25 -20
- package/src/scripts/cli2.ts +23 -15
- package/src/scripts/cli3.ts +35 -29
- package/src/scripts/cli4.ts +1 -2
- package/src/scripts/cli5.ts +1 -2
- package/src/scripts/code_exec.ts +1 -2
- package/src/scripts/code_exec_simple.ts +1 -2
- package/src/scripts/content.ts +33 -15
- package/src/scripts/simple.ts +1 -2
- package/src/scripts/stream.ts +33 -15
- package/src/scripts/test-tools-before-handoff.ts +17 -28
- package/src/scripts/tools.ts +4 -6
- package/src/specs/anthropic.simple.test.ts +1 -1
- package/src/specs/azure.simple.test.ts +1 -1
- package/src/specs/openai.simple.test.ts +1 -1
- package/src/specs/openrouter.simple.test.ts +1 -1
- package/src/tools/Calculator.ts +25 -0
- package/src/types/llm.ts +0 -6
- package/dist/types/tools/example.d.ts +0 -78
- package/src/proto/CollabGraph.ts +0 -269
- package/src/proto/TaskManager.ts +0 -243
- package/src/proto/collab.ts +0 -200
- package/src/proto/collab_design.ts +0 -184
- package/src/proto/collab_design_v2.ts +0 -224
- package/src/proto/collab_design_v3.ts +0 -255
- package/src/proto/collab_design_v4.ts +0 -220
- package/src/proto/collab_design_v5.ts +0 -251
- package/src/proto/collab_graph.ts +0 -181
- package/src/proto/collab_original.ts +0 -123
- package/src/proto/example.ts +0 -93
- package/src/proto/example_new.ts +0 -68
- package/src/proto/example_old.ts +0 -201
- package/src/proto/example_test.ts +0 -152
- package/src/proto/example_test_anthropic.ts +0 -100
- package/src/proto/log_stream.ts +0 -202
- package/src/proto/main_collab_community_event.ts +0 -133
- package/src/proto/main_collab_design_v2.ts +0 -96
- package/src/proto/main_collab_design_v4.ts +0 -100
- package/src/proto/main_collab_design_v5.ts +0 -135
- package/src/proto/main_collab_global_analysis.ts +0 -122
- package/src/proto/main_collab_hackathon_event.ts +0 -153
- package/src/proto/main_collab_space_mission.ts +0 -153
- package/src/proto/main_philosophy.ts +0 -210
- package/src/proto/original_script.ts +0 -126
- package/src/proto/standard.ts +0 -100
- package/src/proto/stream.ts +0 -56
- package/src/proto/tasks.ts +0 -118
- package/src/proto/tools/global_analysis_tools.ts +0 -86
- package/src/proto/tools/space_mission_tools.ts +0 -60
- package/src/proto/vertexai.ts +0 -54
- package/src/tools/example.ts +0 -129
package/dist/cjs/common/enum.cjs
CHANGED
|
@@ -58,7 +58,6 @@ exports.GraphEvents = void 0;
|
|
|
58
58
|
exports.Providers = void 0;
|
|
59
59
|
(function (Providers) {
|
|
60
60
|
Providers["OPENAI"] = "openAI";
|
|
61
|
-
Providers["BEDROCK_LEGACY"] = "bedrock_legacy";
|
|
62
61
|
Providers["VERTEXAI"] = "vertexai";
|
|
63
62
|
Providers["BEDROCK"] = "bedrock";
|
|
64
63
|
Providers["ANTHROPIC"] = "anthropic";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.cjs","sources":["../../../src/common/enum.ts"],"sourcesContent":["/**\n * Enum representing the various event types emitted during the execution of runnables.\n * These events provide real-time information about the progress and state of different components.\n *\n * @enum {string}\n */\nexport enum GraphEvents {\n /* Custom Events */\n\n /** [Custom] Agent update event in multi-agent graph/workflow */\n ON_AGENT_UPDATE = 'on_agent_update',\n /** [Custom] Delta event for run steps (message creation and tool calls) */\n ON_RUN_STEP = 'on_run_step',\n /** [Custom] Delta event for run steps (tool calls) */\n ON_RUN_STEP_DELTA = 'on_run_step_delta',\n /** [Custom] Completed event for run steps (tool calls) */\n ON_RUN_STEP_COMPLETED = 'on_run_step_completed',\n /** [Custom] Delta events for messages */\n ON_MESSAGE_DELTA = 'on_message_delta',\n /** [Custom] Reasoning Delta events for messages */\n ON_REASONING_DELTA = 'on_reasoning_delta',\n\n /* Official Events */\n\n /** Custom event, emitted by system */\n ON_CUSTOM_EVENT = 'on_custom_event',\n /** Emitted when a chat model starts processing. */\n CHAT_MODEL_START = 'on_chat_model_start',\n\n /** Emitted when a chat model streams a chunk of its response. */\n CHAT_MODEL_STREAM = 'on_chat_model_stream',\n\n /** Emitted when a chat model completes its processing. */\n CHAT_MODEL_END = 'on_chat_model_end',\n\n /** Emitted when a language model starts processing. */\n LLM_START = 'on_llm_start',\n\n /** Emitted when a language model streams a chunk of its response. */\n LLM_STREAM = 'on_llm_stream',\n\n /** Emitted when a language model completes its processing. */\n LLM_END = 'on_llm_end',\n\n /** Emitted when a chain starts processing. */\n CHAIN_START = 'on_chain_start',\n\n /** Emitted when a chain streams a chunk of its output. */\n CHAIN_STREAM = 'on_chain_stream',\n\n /** Emitted when a chain completes its processing. */\n CHAIN_END = 'on_chain_end',\n\n /** Emitted when a tool starts its operation. */\n TOOL_START = 'on_tool_start',\n\n /** Emitted when a tool completes its operation. */\n TOOL_END = 'on_tool_end',\n\n /** Emitted when a retriever starts its operation. */\n RETRIEVER_START = 'on_retriever_start',\n\n /** Emitted when a retriever completes its operation. */\n RETRIEVER_END = 'on_retriever_end',\n\n /** Emitted when a prompt starts processing. */\n PROMPT_START = 'on_prompt_start',\n\n /** Emitted when a prompt completes its processing. */\n PROMPT_END = 'on_prompt_end',\n}\n\nexport enum Providers {\n OPENAI = 'openAI',\n
|
|
1
|
+
{"version":3,"file":"enum.cjs","sources":["../../../src/common/enum.ts"],"sourcesContent":["/**\n * Enum representing the various event types emitted during the execution of runnables.\n * These events provide real-time information about the progress and state of different components.\n *\n * @enum {string}\n */\nexport enum GraphEvents {\n /* Custom Events */\n\n /** [Custom] Agent update event in multi-agent graph/workflow */\n ON_AGENT_UPDATE = 'on_agent_update',\n /** [Custom] Delta event for run steps (message creation and tool calls) */\n ON_RUN_STEP = 'on_run_step',\n /** [Custom] Delta event for run steps (tool calls) */\n ON_RUN_STEP_DELTA = 'on_run_step_delta',\n /** [Custom] Completed event for run steps (tool calls) */\n ON_RUN_STEP_COMPLETED = 'on_run_step_completed',\n /** [Custom] Delta events for messages */\n ON_MESSAGE_DELTA = 'on_message_delta',\n /** [Custom] Reasoning Delta events for messages */\n ON_REASONING_DELTA = 'on_reasoning_delta',\n\n /* Official Events */\n\n /** Custom event, emitted by system */\n ON_CUSTOM_EVENT = 'on_custom_event',\n /** Emitted when a chat model starts processing. */\n CHAT_MODEL_START = 'on_chat_model_start',\n\n /** Emitted when a chat model streams a chunk of its response. */\n CHAT_MODEL_STREAM = 'on_chat_model_stream',\n\n /** Emitted when a chat model completes its processing. */\n CHAT_MODEL_END = 'on_chat_model_end',\n\n /** Emitted when a language model starts processing. */\n LLM_START = 'on_llm_start',\n\n /** Emitted when a language model streams a chunk of its response. */\n LLM_STREAM = 'on_llm_stream',\n\n /** Emitted when a language model completes its processing. */\n LLM_END = 'on_llm_end',\n\n /** Emitted when a chain starts processing. */\n CHAIN_START = 'on_chain_start',\n\n /** Emitted when a chain streams a chunk of its output. */\n CHAIN_STREAM = 'on_chain_stream',\n\n /** Emitted when a chain completes its processing. */\n CHAIN_END = 'on_chain_end',\n\n /** Emitted when a tool starts its operation. */\n TOOL_START = 'on_tool_start',\n\n /** Emitted when a tool completes its operation. */\n TOOL_END = 'on_tool_end',\n\n /** Emitted when a retriever starts its operation. */\n RETRIEVER_START = 'on_retriever_start',\n\n /** Emitted when a retriever completes its operation. */\n RETRIEVER_END = 'on_retriever_end',\n\n /** Emitted when a prompt starts processing. */\n PROMPT_START = 'on_prompt_start',\n\n /** Emitted when a prompt completes its processing. */\n PROMPT_END = 'on_prompt_end',\n}\n\nexport enum Providers {\n OPENAI = 'openAI',\n VERTEXAI = 'vertexai',\n BEDROCK = 'bedrock',\n ANTHROPIC = 'anthropic',\n MISTRALAI = 'mistralai',\n MISTRAL = 'mistral',\n OLLAMA = 'ollama',\n GOOGLE = 'google',\n AZURE = 'azureOpenAI',\n DEEPSEEK = 'deepseek',\n OPENROUTER = 'openrouter',\n XAI = 'xai',\n}\n\nexport enum GraphNodeKeys {\n TOOLS = 'tools=',\n AGENT = 'agent=',\n ROUTER = 'router',\n PRE_TOOLS = 'pre_tools',\n POST_TOOLS = 'post_tools',\n}\n\nexport enum GraphNodeActions {\n TOOL_NODE = 'tool_node',\n CALL_MODEL = 'call_model',\n ROUTE_MESSAGE = 'route_message',\n}\n\nexport enum CommonEvents {\n LANGGRAPH = 'LangGraph',\n}\n\nexport enum StepTypes {\n TOOL_CALLS = 'tool_calls',\n MESSAGE_CREATION = 'message_creation',\n}\n\nexport enum ContentTypes {\n TEXT = 'text',\n ERROR = 'error',\n THINK = 'think',\n TOOL_CALL = 'tool_call',\n IMAGE_URL = 'image_url',\n IMAGE_FILE = 'image_file',\n /** Anthropic */\n THINKING = 'thinking',\n /** Vertex AI / Google Common */\n REASONING = 'reasoning',\n /** Multi-Agent Switch */\n AGENT_UPDATE = 'agent_update',\n /** Bedrock */\n REASONING_CONTENT = 'reasoning_content',\n}\n\nexport enum ToolCallTypes {\n FUNCTION = 'function',\n RETRIEVAL = 'retrieval',\n FILE_SEARCH = 'file_search',\n CODE_INTERPRETER = 'code_interpreter',\n /* Agents Tool Call */\n TOOL_CALL = 'tool_call',\n}\n\nexport enum Callback {\n TOOL_ERROR = 'handleToolError',\n TOOL_START = 'handleToolStart',\n TOOL_END = 'handleToolEnd',\n CUSTOM_EVENT = 'handleCustomEvent',\n /*\n LLM_START = 'handleLLMStart',\n LLM_NEW_TOKEN = 'handleLLMNewToken',\n LLM_ERROR = 'handleLLMError',\n LLM_END = 'handleLLMEnd',\n CHAT_MODEL_START = 'handleChatModelStart',\n CHAIN_START = 'handleChainStart',\n CHAIN_ERROR = 'handleChainError',\n CHAIN_END = 'handleChainEnd',\n TEXT = 'handleText',\n AGENT_ACTION = 'handleAgentAction',\n AGENT_END = 'handleAgentEnd',\n RETRIEVER_START = 'handleRetrieverStart',\n RETRIEVER_END = 'handleRetrieverEnd',\n RETRIEVER_ERROR = 'handleRetrieverError',\n */\n}\n\nexport enum Constants {\n OFFICIAL_CODE_BASEURL = 'https://api.librechat.ai/v1',\n EXECUTE_CODE = 'execute_code',\n WEB_SEARCH = 'web_search',\n CONTENT_AND_ARTIFACT = 'content_and_artifact',\n LC_TRANSFER_TO_ = 'lc_transfer_to_',\n}\n\nexport enum TitleMethod {\n STRUCTURED = 'structured',\n FUNCTIONS = 'functions',\n COMPLETION = 'completion',\n}\n\nexport enum EnvVar {\n CODE_API_KEY = 'LIBRECHAT_CODE_API_KEY',\n CODE_BASEURL = 'LIBRECHAT_CODE_BASEURL',\n}\n"],"names":["GraphEvents","Providers","GraphNodeKeys","GraphNodeActions","CommonEvents","StepTypes","ContentTypes","ToolCallTypes","Callback","Constants","TitleMethod","EnvVar"],"mappings":";;AAAA;;;;;AAKG;AACSA;AAAZ,CAAA,UAAY,WAAW,EAAA;;;AAIrB,IAAA,WAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC;;AAEnC,IAAA,WAAA,CAAA,aAAA,CAAA,GAAA,aAA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7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var mistralai = require('@langchain/mistralai');
|
|
4
4
|
var aws = require('@langchain/aws');
|
|
5
|
-
var web = require('@langchain/community/chat_models/bedrock/web');
|
|
6
5
|
var index$3 = require('./openai/index.cjs');
|
|
7
6
|
var index = require('./google/index.cjs');
|
|
8
7
|
var index$2 = require('./anthropic/index.cjs');
|
|
@@ -23,7 +22,6 @@ const llmProviders = {
|
|
|
23
22
|
[_enum.Providers.MISTRAL]: mistralai.ChatMistralAI,
|
|
24
23
|
[_enum.Providers.ANTHROPIC]: index$2.CustomAnthropic,
|
|
25
24
|
[_enum.Providers.OPENROUTER]: index$1.ChatOpenRouter,
|
|
26
|
-
[_enum.Providers.BEDROCK_LEGACY]: web.BedrockChat,
|
|
27
25
|
[_enum.Providers.BEDROCK]: aws.ChatBedrockConverse,
|
|
28
26
|
// [Providers.ANTHROPIC]: ChatAnthropic,
|
|
29
27
|
[_enum.Providers.GOOGLE]: index.CustomChatGoogleGenerativeAI,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.cjs","sources":["../../../src/llm/providers.ts"],"sourcesContent":["// src/llm/providers.ts\nimport { ChatMistralAI } from '@langchain/mistralai';\nimport { ChatBedrockConverse } from '@langchain/aws';\n// import { ChatAnthropic } from '@langchain/anthropic';\n// import { ChatVertexAI } from '@langchain/google-vertexai';\nimport
|
|
1
|
+
{"version":3,"file":"providers.cjs","sources":["../../../src/llm/providers.ts"],"sourcesContent":["// src/llm/providers.ts\nimport { ChatMistralAI } from '@langchain/mistralai';\nimport { ChatBedrockConverse } from '@langchain/aws';\n// import { ChatAnthropic } from '@langchain/anthropic';\n// import { ChatVertexAI } from '@langchain/google-vertexai';\nimport type {\n ChatModelConstructorMap,\n ProviderOptionsMap,\n ChatModelMap,\n} from '@/types';\nimport {\n AzureChatOpenAI,\n ChatDeepSeek,\n ChatOpenAI,\n ChatXAI,\n} from '@/llm/openai';\nimport { CustomChatGoogleGenerativeAI } from '@/llm/google';\nimport { CustomAnthropic } from '@/llm/anthropic';\nimport { ChatOpenRouter } from '@/llm/openrouter';\nimport { ChatVertexAI } from '@/llm/vertexai';\nimport { ChatOllama } from '@/llm/ollama';\nimport { Providers } from '@/common';\n\nexport const llmProviders: Partial<ChatModelConstructorMap> = {\n [Providers.XAI]: ChatXAI,\n [Providers.OPENAI]: ChatOpenAI,\n [Providers.OLLAMA]: ChatOllama,\n [Providers.AZURE]: AzureChatOpenAI,\n [Providers.VERTEXAI]: ChatVertexAI,\n [Providers.DEEPSEEK]: ChatDeepSeek,\n [Providers.MISTRALAI]: ChatMistralAI,\n [Providers.MISTRAL]: ChatMistralAI,\n [Providers.ANTHROPIC]: CustomAnthropic,\n [Providers.OPENROUTER]: ChatOpenRouter,\n [Providers.BEDROCK]: ChatBedrockConverse,\n // [Providers.ANTHROPIC]: ChatAnthropic,\n [Providers.GOOGLE]: CustomChatGoogleGenerativeAI,\n};\n\nexport const manualToolStreamProviders = new Set<Providers | string>([\n Providers.ANTHROPIC,\n Providers.BEDROCK,\n Providers.OLLAMA,\n]);\n\nexport const getChatModelClass = <P extends Providers>(\n provider: P\n): new (config: ProviderOptionsMap[P]) => ChatModelMap[P] => {\n const ChatModelClass = llmProviders[provider];\n if (!ChatModelClass) {\n throw new Error(`Unsupported LLM provider: ${provider}`);\n }\n\n return ChatModelClass;\n};\n"],"names":["Providers","ChatXAI","ChatOpenAI","ChatOllama","AzureChatOpenAI","ChatVertexAI","ChatDeepSeek","ChatMistralAI","CustomAnthropic","ChatOpenRouter","ChatBedrockConverse","CustomChatGoogleGenerativeAI"],"mappings":";;;;;;;;;;;;AAAA;AAuBa,MAAA,YAAY,GAAqC;AAC5D,IAAA,CAACA,eAAS,CAAC,GAAG,GAAGC,eAAO;AACxB,IAAA,CAACD,eAAS,CAAC,MAAM,GAAGE,kBAAU;AAC9B,IAAA,CAACF,eAAS,CAAC,MAAM,GAAGG,kBAAU;AAC9B,IAAA,CAACH,eAAS,CAAC,KAAK,GAAGI,uBAAe;AAClC,IAAA,CAACJ,eAAS,CAAC,QAAQ,GAAGK,oBAAY;AAClC,IAAA,CAACL,eAAS,CAAC,QAAQ,GAAGM,oBAAY;AAClC,IAAA,CAACN,eAAS,CAAC,SAAS,GAAGO,uBAAa;AACpC,IAAA,CAACP,eAAS,CAAC,OAAO,GAAGO,uBAAa;AAClC,IAAA,CAACP,eAAS,CAAC,SAAS,GAAGQ,uBAAe;AACtC,IAAA,CAACR,eAAS,CAAC,UAAU,GAAGS,sBAAc;AACtC,IAAA,CAACT,eAAS,CAAC,OAAO,GAAGU,uBAAmB;;AAExC,IAAA,CAACV,eAAS,CAAC,MAAM,GAAGW,kCAA4B;;AAGrC,MAAA,yBAAyB,GAAG,IAAI,GAAG,CAAqB;AACnE,IAAAX,eAAS,CAAC,SAAS;AACnB,IAAAA,eAAS,CAAC,OAAO;AACjB,IAAAA,eAAS,CAAC,MAAM;AACjB,CAAA;AAEY,MAAA,iBAAiB,GAAG,CAC/B,QAAW,KAC+C;AAC1D,IAAA,MAAM,cAAc,GAAG,YAAY,CAAC,QAAQ,CAAC;IAC7C,IAAI,CAAC,cAAc,EAAE;AACnB,QAAA,MAAM,IAAI,KAAK,CAAC,6BAA6B,QAAQ,CAAA,CAAE,CAAC;;AAG1D,IAAA,OAAO,cAAc;AACvB;;;;;;"}
|
package/dist/cjs/main.cjs
CHANGED
|
@@ -12,6 +12,7 @@ var cache = require('./messages/cache.cjs');
|
|
|
12
12
|
var content = require('./messages/content.cjs');
|
|
13
13
|
var Graph = require('./graphs/Graph.cjs');
|
|
14
14
|
var MultiAgentGraph = require('./graphs/MultiAgentGraph.cjs');
|
|
15
|
+
var Calculator = require('./tools/Calculator.cjs');
|
|
15
16
|
var CodeExecutor = require('./tools/CodeExecutor.cjs');
|
|
16
17
|
var handlers = require('./tools/handlers.cjs');
|
|
17
18
|
var tool = require('./tools/search/tool.cjs');
|
|
@@ -63,6 +64,7 @@ exports.formatContentStrings = content.formatContentStrings;
|
|
|
63
64
|
exports.Graph = Graph.Graph;
|
|
64
65
|
exports.StandardGraph = Graph.StandardGraph;
|
|
65
66
|
exports.MultiAgentGraph = MultiAgentGraph.MultiAgentGraph;
|
|
67
|
+
exports.Calculator = Calculator.Calculator;
|
|
66
68
|
exports.createCodeExecutionTool = CodeExecutor.createCodeExecutionTool;
|
|
67
69
|
exports.getCodeBaseURL = CodeExecutor.getCodeBaseURL;
|
|
68
70
|
exports.imageExtRegex = CodeExecutor.imageExtRegex;
|
package/dist/cjs/main.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tools = require('@langchain/core/tools');
|
|
4
|
+
var math = require('mathjs');
|
|
5
|
+
|
|
6
|
+
function _interopNamespaceDefault(e) {
|
|
7
|
+
var n = Object.create(null);
|
|
8
|
+
if (e) {
|
|
9
|
+
Object.keys(e).forEach(function (k) {
|
|
10
|
+
if (k !== 'default') {
|
|
11
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return e[k]; }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var math__namespace = /*#__PURE__*/_interopNamespaceDefault(math);
|
|
24
|
+
|
|
25
|
+
class Calculator extends tools.Tool {
|
|
26
|
+
static lc_name() {
|
|
27
|
+
return 'Calculator';
|
|
28
|
+
}
|
|
29
|
+
get lc_namespace() {
|
|
30
|
+
return [...super.lc_namespace, 'calculator'];
|
|
31
|
+
}
|
|
32
|
+
name = 'calculator';
|
|
33
|
+
async _call(input) {
|
|
34
|
+
try {
|
|
35
|
+
return math__namespace.evaluate(input).toString();
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return 'I don\'t know how to do that.';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
description = 'Useful for getting the result of a math expression. The input to this tool should be a valid mathematical expression that could be executed by a simple calculator.';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
exports.Calculator = Calculator;
|
|
45
|
+
//# sourceMappingURL=Calculator.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Calculator.cjs","sources":["../../../src/tools/Calculator.ts"],"sourcesContent":["import { Tool } from '@langchain/core/tools';\nimport * as math from 'mathjs';\n\nexport class Calculator extends Tool {\n static lc_name(): string {\n return 'Calculator';\n }\n\n get lc_namespace(): string[] {\n return [...super.lc_namespace, 'calculator'];\n }\n\n name = 'calculator';\n\n async _call(input: string): Promise<string> {\n try {\n return math.evaluate(input).toString();\n } catch {\n return 'I don\\'t know how to do that.';\n }\n }\n\n description =\n 'Useful for getting the result of a math expression. The input to this tool should be a valid mathematical expression that could be executed by a simple calculator.';\n}\n"],"names":["Tool","math"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGM,MAAO,UAAW,SAAQA,UAAI,CAAA;AAClC,IAAA,OAAO,OAAO,GAAA;AACZ,QAAA,OAAO,YAAY;;AAGrB,IAAA,IAAI,YAAY,GAAA;QACd,OAAO,CAAC,GAAG,KAAK,CAAC,YAAY,EAAE,YAAY,CAAC;;IAG9C,IAAI,GAAG,YAAY;IAEnB,MAAM,KAAK,CAAC,KAAa,EAAA;AACvB,QAAA,IAAI;YACF,OAAOC,eAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;;AACtC,QAAA,MAAM;AACN,YAAA,OAAO,+BAA+B;;;IAI1C,WAAW,GACT,qKAAqK;AACxK;;;;"}
|
package/dist/esm/common/enum.mjs
CHANGED
|
@@ -56,7 +56,6 @@ var GraphEvents;
|
|
|
56
56
|
var Providers;
|
|
57
57
|
(function (Providers) {
|
|
58
58
|
Providers["OPENAI"] = "openAI";
|
|
59
|
-
Providers["BEDROCK_LEGACY"] = "bedrock_legacy";
|
|
60
59
|
Providers["VERTEXAI"] = "vertexai";
|
|
61
60
|
Providers["BEDROCK"] = "bedrock";
|
|
62
61
|
Providers["ANTHROPIC"] = "anthropic";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.mjs","sources":["../../../src/common/enum.ts"],"sourcesContent":["/**\n * Enum representing the various event types emitted during the execution of runnables.\n * These events provide real-time information about the progress and state of different components.\n *\n * @enum {string}\n */\nexport enum GraphEvents {\n /* Custom Events */\n\n /** [Custom] Agent update event in multi-agent graph/workflow */\n ON_AGENT_UPDATE = 'on_agent_update',\n /** [Custom] Delta event for run steps (message creation and tool calls) */\n ON_RUN_STEP = 'on_run_step',\n /** [Custom] Delta event for run steps (tool calls) */\n ON_RUN_STEP_DELTA = 'on_run_step_delta',\n /** [Custom] Completed event for run steps (tool calls) */\n ON_RUN_STEP_COMPLETED = 'on_run_step_completed',\n /** [Custom] Delta events for messages */\n ON_MESSAGE_DELTA = 'on_message_delta',\n /** [Custom] Reasoning Delta events for messages */\n ON_REASONING_DELTA = 'on_reasoning_delta',\n\n /* Official Events */\n\n /** Custom event, emitted by system */\n ON_CUSTOM_EVENT = 'on_custom_event',\n /** Emitted when a chat model starts processing. */\n CHAT_MODEL_START = 'on_chat_model_start',\n\n /** Emitted when a chat model streams a chunk of its response. */\n CHAT_MODEL_STREAM = 'on_chat_model_stream',\n\n /** Emitted when a chat model completes its processing. */\n CHAT_MODEL_END = 'on_chat_model_end',\n\n /** Emitted when a language model starts processing. */\n LLM_START = 'on_llm_start',\n\n /** Emitted when a language model streams a chunk of its response. */\n LLM_STREAM = 'on_llm_stream',\n\n /** Emitted when a language model completes its processing. */\n LLM_END = 'on_llm_end',\n\n /** Emitted when a chain starts processing. */\n CHAIN_START = 'on_chain_start',\n\n /** Emitted when a chain streams a chunk of its output. */\n CHAIN_STREAM = 'on_chain_stream',\n\n /** Emitted when a chain completes its processing. */\n CHAIN_END = 'on_chain_end',\n\n /** Emitted when a tool starts its operation. */\n TOOL_START = 'on_tool_start',\n\n /** Emitted when a tool completes its operation. */\n TOOL_END = 'on_tool_end',\n\n /** Emitted when a retriever starts its operation. */\n RETRIEVER_START = 'on_retriever_start',\n\n /** Emitted when a retriever completes its operation. */\n RETRIEVER_END = 'on_retriever_end',\n\n /** Emitted when a prompt starts processing. */\n PROMPT_START = 'on_prompt_start',\n\n /** Emitted when a prompt completes its processing. */\n PROMPT_END = 'on_prompt_end',\n}\n\nexport enum Providers {\n OPENAI = 'openAI',\n
|
|
1
|
+
{"version":3,"file":"enum.mjs","sources":["../../../src/common/enum.ts"],"sourcesContent":["/**\n * Enum representing the various event types emitted during the execution of runnables.\n * These events provide real-time information about the progress and state of different components.\n *\n * @enum {string}\n */\nexport enum GraphEvents {\n /* Custom Events */\n\n /** [Custom] Agent update event in multi-agent graph/workflow */\n ON_AGENT_UPDATE = 'on_agent_update',\n /** [Custom] Delta event for run steps (message creation and tool calls) */\n ON_RUN_STEP = 'on_run_step',\n /** [Custom] Delta event for run steps (tool calls) */\n ON_RUN_STEP_DELTA = 'on_run_step_delta',\n /** [Custom] Completed event for run steps (tool calls) */\n ON_RUN_STEP_COMPLETED = 'on_run_step_completed',\n /** [Custom] Delta events for messages */\n ON_MESSAGE_DELTA = 'on_message_delta',\n /** [Custom] Reasoning Delta events for messages */\n ON_REASONING_DELTA = 'on_reasoning_delta',\n\n /* Official Events */\n\n /** Custom event, emitted by system */\n ON_CUSTOM_EVENT = 'on_custom_event',\n /** Emitted when a chat model starts processing. */\n CHAT_MODEL_START = 'on_chat_model_start',\n\n /** Emitted when a chat model streams a chunk of its response. */\n CHAT_MODEL_STREAM = 'on_chat_model_stream',\n\n /** Emitted when a chat model completes its processing. */\n CHAT_MODEL_END = 'on_chat_model_end',\n\n /** Emitted when a language model starts processing. */\n LLM_START = 'on_llm_start',\n\n /** Emitted when a language model streams a chunk of its response. */\n LLM_STREAM = 'on_llm_stream',\n\n /** Emitted when a language model completes its processing. */\n LLM_END = 'on_llm_end',\n\n /** Emitted when a chain starts processing. */\n CHAIN_START = 'on_chain_start',\n\n /** Emitted when a chain streams a chunk of its output. */\n CHAIN_STREAM = 'on_chain_stream',\n\n /** Emitted when a chain completes its processing. */\n CHAIN_END = 'on_chain_end',\n\n /** Emitted when a tool starts its operation. */\n TOOL_START = 'on_tool_start',\n\n /** Emitted when a tool completes its operation. */\n TOOL_END = 'on_tool_end',\n\n /** Emitted when a retriever starts its operation. */\n RETRIEVER_START = 'on_retriever_start',\n\n /** Emitted when a retriever completes its operation. */\n RETRIEVER_END = 'on_retriever_end',\n\n /** Emitted when a prompt starts processing. */\n PROMPT_START = 'on_prompt_start',\n\n /** Emitted when a prompt completes its processing. */\n PROMPT_END = 'on_prompt_end',\n}\n\nexport enum Providers {\n OPENAI = 'openAI',\n VERTEXAI = 'vertexai',\n BEDROCK = 'bedrock',\n ANTHROPIC = 'anthropic',\n MISTRALAI = 'mistralai',\n MISTRAL = 'mistral',\n OLLAMA = 'ollama',\n GOOGLE = 'google',\n AZURE = 'azureOpenAI',\n DEEPSEEK = 'deepseek',\n OPENROUTER = 'openrouter',\n XAI = 'xai',\n}\n\nexport enum GraphNodeKeys {\n TOOLS = 'tools=',\n AGENT = 'agent=',\n ROUTER = 'router',\n PRE_TOOLS = 'pre_tools',\n POST_TOOLS = 'post_tools',\n}\n\nexport enum GraphNodeActions {\n TOOL_NODE = 'tool_node',\n CALL_MODEL = 'call_model',\n ROUTE_MESSAGE = 'route_message',\n}\n\nexport enum CommonEvents {\n LANGGRAPH = 'LangGraph',\n}\n\nexport enum StepTypes {\n TOOL_CALLS = 'tool_calls',\n MESSAGE_CREATION = 'message_creation',\n}\n\nexport enum ContentTypes {\n TEXT = 'text',\n ERROR = 'error',\n THINK = 'think',\n TOOL_CALL = 'tool_call',\n IMAGE_URL = 'image_url',\n IMAGE_FILE = 'image_file',\n /** Anthropic */\n THINKING = 'thinking',\n /** Vertex AI / Google Common */\n REASONING = 'reasoning',\n /** Multi-Agent Switch */\n AGENT_UPDATE = 'agent_update',\n /** Bedrock */\n REASONING_CONTENT = 'reasoning_content',\n}\n\nexport enum ToolCallTypes {\n FUNCTION = 'function',\n RETRIEVAL = 'retrieval',\n FILE_SEARCH = 'file_search',\n CODE_INTERPRETER = 'code_interpreter',\n /* Agents Tool Call */\n TOOL_CALL = 'tool_call',\n}\n\nexport enum Callback {\n TOOL_ERROR = 'handleToolError',\n TOOL_START = 'handleToolStart',\n TOOL_END = 'handleToolEnd',\n CUSTOM_EVENT = 'handleCustomEvent',\n /*\n LLM_START = 'handleLLMStart',\n LLM_NEW_TOKEN = 'handleLLMNewToken',\n LLM_ERROR = 'handleLLMError',\n LLM_END = 'handleLLMEnd',\n CHAT_MODEL_START = 'handleChatModelStart',\n CHAIN_START = 'handleChainStart',\n CHAIN_ERROR = 'handleChainError',\n CHAIN_END = 'handleChainEnd',\n TEXT = 'handleText',\n AGENT_ACTION = 'handleAgentAction',\n AGENT_END = 'handleAgentEnd',\n RETRIEVER_START = 'handleRetrieverStart',\n RETRIEVER_END = 'handleRetrieverEnd',\n RETRIEVER_ERROR = 'handleRetrieverError',\n */\n}\n\nexport enum Constants {\n OFFICIAL_CODE_BASEURL = 'https://api.librechat.ai/v1',\n EXECUTE_CODE = 'execute_code',\n WEB_SEARCH = 'web_search',\n CONTENT_AND_ARTIFACT = 'content_and_artifact',\n LC_TRANSFER_TO_ = 'lc_transfer_to_',\n}\n\nexport enum Tit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B;AAC3B,CAAC,EAJW,WAAW,KAAX,WAAW,GAItB,EAAA,CAAA,CAAA;IAEW;AAAZ,CAAA,UAAY,MAAM,EAAA;AAChB,IAAA,MAAA,CAAA,cAAA,CAAA,GAAA,wBAAuC;AACvC,IAAA,MAAA,CAAA,cAAA,CAAA,GAAA,wBAAuC;AACzC,CAAC,EAHW,MAAM,KAAN,MAAM,GAGjB,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ChatMistralAI } from '@langchain/mistralai';
|
|
2
2
|
import { ChatBedrockConverse } from '@langchain/aws';
|
|
3
|
-
import { BedrockChat } from '@langchain/community/chat_models/bedrock/web';
|
|
4
3
|
import { ChatDeepSeek, AzureChatOpenAI, ChatOpenAI, ChatXAI } from './openai/index.mjs';
|
|
5
4
|
import { CustomChatGoogleGenerativeAI } from './google/index.mjs';
|
|
6
5
|
import { CustomAnthropic } from './anthropic/index.mjs';
|
|
@@ -21,7 +20,6 @@ const llmProviders = {
|
|
|
21
20
|
[Providers.MISTRAL]: ChatMistralAI,
|
|
22
21
|
[Providers.ANTHROPIC]: CustomAnthropic,
|
|
23
22
|
[Providers.OPENROUTER]: ChatOpenRouter,
|
|
24
|
-
[Providers.BEDROCK_LEGACY]: BedrockChat,
|
|
25
23
|
[Providers.BEDROCK]: ChatBedrockConverse,
|
|
26
24
|
// [Providers.ANTHROPIC]: ChatAnthropic,
|
|
27
25
|
[Providers.GOOGLE]: CustomChatGoogleGenerativeAI,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.mjs","sources":["../../../src/llm/providers.ts"],"sourcesContent":["// src/llm/providers.ts\nimport { ChatMistralAI } from '@langchain/mistralai';\nimport { ChatBedrockConverse } from '@langchain/aws';\n// import { ChatAnthropic } from '@langchain/anthropic';\n// import { ChatVertexAI } from '@langchain/google-vertexai';\nimport
|
|
1
|
+
{"version":3,"file":"providers.mjs","sources":["../../../src/llm/providers.ts"],"sourcesContent":["// src/llm/providers.ts\nimport { ChatMistralAI } from '@langchain/mistralai';\nimport { ChatBedrockConverse } from '@langchain/aws';\n// import { ChatAnthropic } from '@langchain/anthropic';\n// import { ChatVertexAI } from '@langchain/google-vertexai';\nimport type {\n ChatModelConstructorMap,\n ProviderOptionsMap,\n ChatModelMap,\n} from '@/types';\nimport {\n AzureChatOpenAI,\n ChatDeepSeek,\n ChatOpenAI,\n ChatXAI,\n} from '@/llm/openai';\nimport { CustomChatGoogleGenerativeAI } from '@/llm/google';\nimport { CustomAnthropic } from '@/llm/anthropic';\nimport { ChatOpenRouter } from '@/llm/openrouter';\nimport { ChatVertexAI } from '@/llm/vertexai';\nimport { ChatOllama } from '@/llm/ollama';\nimport { Providers } from '@/common';\n\nexport const llmProviders: Partial<ChatModelConstructorMap> = {\n [Providers.XAI]: ChatXAI,\n [Providers.OPENAI]: ChatOpenAI,\n [Providers.OLLAMA]: ChatOllama,\n [Providers.AZURE]: AzureChatOpenAI,\n [Providers.VERTEXAI]: ChatVertexAI,\n [Providers.DEEPSEEK]: ChatDeepSeek,\n [Providers.MISTRALAI]: ChatMistralAI,\n [Providers.MISTRAL]: ChatMistralAI,\n [Providers.ANTHROPIC]: CustomAnthropic,\n [Providers.OPENROUTER]: ChatOpenRouter,\n [Providers.BEDROCK]: ChatBedrockConverse,\n // [Providers.ANTHROPIC]: ChatAnthropic,\n [Providers.GOOGLE]: CustomChatGoogleGenerativeAI,\n};\n\nexport const manualToolStreamProviders = new Set<Providers | string>([\n Providers.ANTHROPIC,\n Providers.BEDROCK,\n Providers.OLLAMA,\n]);\n\nexport const getChatModelClass = <P extends Providers>(\n provider: P\n): new (config: ProviderOptionsMap[P]) => ChatModelMap[P] => {\n const ChatModelClass = llmProviders[provider];\n if (!ChatModelClass) {\n throw new Error(`Unsupported LLM provider: ${provider}`);\n }\n\n return ChatModelClass;\n};\n"],"names":[],"mappings":";;;;;;;;;;AAAA;AAuBa,MAAA,YAAY,GAAqC;AAC5D,IAAA,CAAC,SAAS,CAAC,GAAG,GAAG,OAAO;AACxB,IAAA,CAAC,SAAS,CAAC,MAAM,GAAG,UAAU;AAC9B,IAAA,CAAC,SAAS,CAAC,MAAM,GAAG,UAAU;AAC9B,IAAA,CAAC,SAAS,CAAC,KAAK,GAAG,eAAe;AAClC,IAAA,CAAC,SAAS,CAAC,QAAQ,GAAG,YAAY;AAClC,IAAA,CAAC,SAAS,CAAC,QAAQ,GAAG,YAAY;AAClC,IAAA,CAAC,SAAS,CAAC,SAAS,GAAG,aAAa;AACpC,IAAA,CAAC,SAAS,CAAC,OAAO,GAAG,aAAa;AAClC,IAAA,CAAC,SAAS,CAAC,SAAS,GAAG,eAAe;AACtC,IAAA,CAAC,SAAS,CAAC,UAAU,GAAG,cAAc;AACtC,IAAA,CAAC,SAAS,CAAC,OAAO,GAAG,mBAAmB;;AAExC,IAAA,CAAC,SAAS,CAAC,MAAM,GAAG,4BAA4B;;AAGrC,MAAA,yBAAyB,GAAG,IAAI,GAAG,CAAqB;AACnE,IAAA,SAAS,CAAC,SAAS;AACnB,IAAA,SAAS,CAAC,OAAO;AACjB,IAAA,SAAS,CAAC,MAAM;AACjB,CAAA;AAEY,MAAA,iBAAiB,GAAG,CAC/B,QAAW,KAC+C;AAC1D,IAAA,MAAM,cAAc,GAAG,YAAY,CAAC,QAAQ,CAAC;IAC7C,IAAI,CAAC,cAAc,EAAE;AACnB,QAAA,MAAM,IAAI,KAAK,CAAC,6BAA6B,QAAQ,CAAA,CAAE,CAAC;;AAG1D,IAAA,OAAO,cAAc;AACvB;;;;"}
|
package/dist/esm/main.mjs
CHANGED
|
@@ -10,6 +10,7 @@ export { addCacheControl } from './messages/cache.mjs';
|
|
|
10
10
|
export { formatContentStrings } from './messages/content.mjs';
|
|
11
11
|
export { Graph, StandardGraph } from './graphs/Graph.mjs';
|
|
12
12
|
export { MultiAgentGraph } from './graphs/MultiAgentGraph.mjs';
|
|
13
|
+
export { Calculator } from './tools/Calculator.mjs';
|
|
13
14
|
export { createCodeExecutionTool, getCodeBaseURL, imageExtRegex } from './tools/CodeExecutor.mjs';
|
|
14
15
|
export { handleServerToolResult, handleToolCallChunks, handleToolCalls, toolResultTypes } from './tools/handlers.mjs';
|
|
15
16
|
export { createSearchTool } from './tools/search/tool.mjs';
|
package/dist/esm/main.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Tool } from '@langchain/core/tools';
|
|
2
|
+
import * as math from 'mathjs';
|
|
3
|
+
|
|
4
|
+
class Calculator extends Tool {
|
|
5
|
+
static lc_name() {
|
|
6
|
+
return 'Calculator';
|
|
7
|
+
}
|
|
8
|
+
get lc_namespace() {
|
|
9
|
+
return [...super.lc_namespace, 'calculator'];
|
|
10
|
+
}
|
|
11
|
+
name = 'calculator';
|
|
12
|
+
async _call(input) {
|
|
13
|
+
try {
|
|
14
|
+
return math.evaluate(input).toString();
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return 'I don\'t know how to do that.';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
description = 'Useful for getting the result of a math expression. The input to this tool should be a valid mathematical expression that could be executed by a simple calculator.';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { Calculator };
|
|
24
|
+
//# sourceMappingURL=Calculator.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Calculator.mjs","sources":["../../../src/tools/Calculator.ts"],"sourcesContent":["import { Tool } from '@langchain/core/tools';\nimport * as math from 'mathjs';\n\nexport class Calculator extends Tool {\n static lc_name(): string {\n return 'Calculator';\n }\n\n get lc_namespace(): string[] {\n return [...super.lc_namespace, 'calculator'];\n }\n\n name = 'calculator';\n\n async _call(input: string): Promise<string> {\n try {\n return math.evaluate(input).toString();\n } catch {\n return 'I don\\'t know how to do that.';\n }\n }\n\n description =\n 'Useful for getting the result of a math expression. The input to this tool should be a valid mathematical expression that could be executed by a simple calculator.';\n}\n"],"names":[],"mappings":";;;AAGM,MAAO,UAAW,SAAQ,IAAI,CAAA;AAClC,IAAA,OAAO,OAAO,GAAA;AACZ,QAAA,OAAO,YAAY;;AAGrB,IAAA,IAAI,YAAY,GAAA;QACd,OAAO,CAAC,GAAG,KAAK,CAAC,YAAY,EAAE,YAAY,CAAC;;IAG9C,IAAI,GAAG,YAAY;IAEnB,MAAM,KAAK,CAAC,KAAa,EAAA;AACvB,QAAA,IAAI;YACF,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;;AACtC,QAAA,MAAM;AACN,YAAA,OAAO,+BAA+B;;;IAI1C,WAAW,GACT,qKAAqK;AACxK;;;;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { ChatOllama } from '@langchain/ollama';
|
|
2
2
|
import { ChatMistralAI } from '@langchain/mistralai';
|
|
3
3
|
import { ChatBedrockConverse } from '@langchain/aws';
|
|
4
|
-
import { BedrockChat } from '@langchain/community/chat_models/bedrock/web';
|
|
5
4
|
import type { BindToolsInput, BaseChatModelParams } from '@langchain/core/language_models/chat_models';
|
|
6
5
|
import type { OpenAIChatInput, ChatOpenAIFields, AzureOpenAIInput, ClientOptions as OAIClientOptions } from '@langchain/openai';
|
|
7
|
-
import type { BedrockChatFields } from '@langchain/community/chat_models/bedrock/web';
|
|
8
6
|
import type { GoogleGenerativeAIChatInput } from '@langchain/google-genai';
|
|
9
7
|
import type { GeminiGenerationConfig } from '@langchain/google-common';
|
|
10
8
|
import type { ChatVertexAIInput } from '@langchain/google-vertexai';
|
|
@@ -47,7 +45,6 @@ export type MistralAIClientOptions = ChatMistralAIInput;
|
|
|
47
45
|
export type VertexAIClientOptions = ChatVertexAIInput & {
|
|
48
46
|
includeThoughts?: boolean;
|
|
49
47
|
};
|
|
50
|
-
export type BedrockClientOptions = BedrockChatFields;
|
|
51
48
|
export type BedrockAnthropicInput = ChatBedrockConverseInput & {
|
|
52
49
|
additionalModelRequestFields?: ChatBedrockConverseInput['additionalModelRequestFields'] & AnthropicReasoning;
|
|
53
50
|
};
|
|
@@ -58,7 +55,7 @@ export type GoogleClientOptions = GoogleGenerativeAIChatInput & {
|
|
|
58
55
|
};
|
|
59
56
|
export type DeepSeekClientOptions = ChatDeepSeekCallOptions;
|
|
60
57
|
export type XAIClientOptions = ChatXAIInput;
|
|
61
|
-
export type ClientOptions = OpenAIClientOptions | AzureClientOptions | OllamaClientOptions | AnthropicClientOptions | MistralAIClientOptions | VertexAIClientOptions |
|
|
58
|
+
export type ClientOptions = OpenAIClientOptions | AzureClientOptions | OllamaClientOptions | AnthropicClientOptions | MistralAIClientOptions | VertexAIClientOptions | BedrockConverseClientOptions | GoogleClientOptions | DeepSeekClientOptions | XAIClientOptions;
|
|
62
59
|
export type SharedLLMConfig = {
|
|
63
60
|
provider: Providers;
|
|
64
61
|
_lc_stream_delay?: number;
|
|
@@ -81,7 +78,6 @@ export type ProviderOptionsMap = {
|
|
|
81
78
|
[Providers.MISTRALAI]: MistralAIClientOptions;
|
|
82
79
|
[Providers.MISTRAL]: MistralAIClientOptions;
|
|
83
80
|
[Providers.OPENROUTER]: ChatOpenRouterCallOptions;
|
|
84
|
-
[Providers.BEDROCK_LEGACY]: BedrockClientOptions;
|
|
85
81
|
[Providers.BEDROCK]: BedrockConverseClientOptions;
|
|
86
82
|
[Providers.XAI]: XAIClientOptions;
|
|
87
83
|
};
|
|
@@ -96,7 +92,6 @@ export type ChatModelMap = {
|
|
|
96
92
|
[Providers.MISTRALAI]: ChatMistralAI;
|
|
97
93
|
[Providers.MISTRAL]: ChatMistralAI;
|
|
98
94
|
[Providers.OPENROUTER]: ChatOpenRouter;
|
|
99
|
-
[Providers.BEDROCK_LEGACY]: BedrockChat;
|
|
100
95
|
[Providers.BEDROCK]: ChatBedrockConverse;
|
|
101
96
|
[Providers.GOOGLE]: CustomChatGoogleGenerativeAI;
|
|
102
97
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@librechat/agents",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.02",
|
|
4
4
|
"main": "./dist/cjs/main.cjs",
|
|
5
5
|
"module": "./dist/esm/main.mjs",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -95,7 +95,6 @@
|
|
|
95
95
|
"dependencies": {
|
|
96
96
|
"@langchain/anthropic": "^0.3.26",
|
|
97
97
|
"@langchain/aws": "^0.1.12",
|
|
98
|
-
"@langchain/community": "^0.3.47",
|
|
99
98
|
"@langchain/core": "^0.3.72",
|
|
100
99
|
"@langchain/deepseek": "^0.0.2",
|
|
101
100
|
"@langchain/google-genai": "^0.2.13",
|
|
@@ -104,14 +103,17 @@
|
|
|
104
103
|
"@langchain/mistralai": "^0.2.1",
|
|
105
104
|
"@langchain/ollama": "^0.2.3",
|
|
106
105
|
"@langchain/openai": "0.5.18",
|
|
106
|
+
"@langchain/textsplitters": "^0.1.0",
|
|
107
107
|
"@langchain/xai": "^0.0.3",
|
|
108
108
|
"@langfuse/langchain": "^4.3.0",
|
|
109
109
|
"@langfuse/otel": "^4.3.0",
|
|
110
110
|
"@langfuse/tracing": "^4.3.0",
|
|
111
111
|
"@opentelemetry/sdk-node": "^0.207.0",
|
|
112
|
+
"axios": "^1.12.1",
|
|
112
113
|
"cheerio": "^1.0.0",
|
|
113
114
|
"dotenv": "^16.4.7",
|
|
114
115
|
"https-proxy-agent": "^7.0.6",
|
|
116
|
+
"mathjs": "^15.1.0",
|
|
115
117
|
"nanoid": "^3.3.7",
|
|
116
118
|
"openai": "^5.10.1"
|
|
117
119
|
},
|
|
@@ -122,7 +124,6 @@
|
|
|
122
124
|
"devDependencies": {
|
|
123
125
|
"@anthropic-ai/vertex-sdk": "^0.12.0",
|
|
124
126
|
"@eslint/compat": "^1.2.7",
|
|
125
|
-
"@langchain/tavily": "^0.1.5",
|
|
126
127
|
"@rollup/plugin-alias": "^5.1.0",
|
|
127
128
|
"@rollup/plugin-commonjs": "^28.0.3",
|
|
128
129
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -132,6 +133,7 @@
|
|
|
132
133
|
"@swc/core": "^1.6.13",
|
|
133
134
|
"@types/jest": "^29.5.14",
|
|
134
135
|
"@types/node": "^20.14.11",
|
|
136
|
+
"@types/node-fetch": "^2.6.13",
|
|
135
137
|
"@types/yargs-parser": "^21.0.3",
|
|
136
138
|
"@typescript-eslint/eslint-plugin": "^8.24.0",
|
|
137
139
|
"@typescript-eslint/parser": "^8.24.0",
|
package/src/common/enum.ts
CHANGED
package/src/index.ts
CHANGED
package/src/llm/providers.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { ChatMistralAI } from '@langchain/mistralai';
|
|
|
3
3
|
import { ChatBedrockConverse } from '@langchain/aws';
|
|
4
4
|
// import { ChatAnthropic } from '@langchain/anthropic';
|
|
5
5
|
// import { ChatVertexAI } from '@langchain/google-vertexai';
|
|
6
|
-
import { BedrockChat } from '@langchain/community/chat_models/bedrock/web';
|
|
7
6
|
import type {
|
|
8
7
|
ChatModelConstructorMap,
|
|
9
8
|
ProviderOptionsMap,
|
|
@@ -33,7 +32,6 @@ export const llmProviders: Partial<ChatModelConstructorMap> = {
|
|
|
33
32
|
[Providers.MISTRAL]: ChatMistralAI,
|
|
34
33
|
[Providers.ANTHROPIC]: CustomAnthropic,
|
|
35
34
|
[Providers.OPENROUTER]: ChatOpenRouter,
|
|
36
|
-
[Providers.BEDROCK_LEGACY]: BedrockChat,
|
|
37
35
|
[Providers.BEDROCK]: ChatBedrockConverse,
|
|
38
36
|
// [Providers.ANTHROPIC]: ChatAnthropic,
|
|
39
37
|
[Providers.GOOGLE]: CustomChatGoogleGenerativeAI,
|
package/src/scripts/abort.ts
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { config } from 'dotenv';
|
|
4
4
|
config();
|
|
5
5
|
import { HumanMessage, BaseMessage } from '@langchain/core/messages';
|
|
6
|
-
import { TavilySearchResults } from '@langchain/community/tools/tavily_search';
|
|
7
6
|
import type * as t from '@/types';
|
|
8
7
|
import { ChatModelStreamHandler, createContentAggregator } from '@/stream';
|
|
9
8
|
import { ToolEndHandler } from '@/events';
|
|
@@ -24,36 +23,55 @@ async function testStandardStreaming(): Promise<void> {
|
|
|
24
23
|
[GraphEvents.TOOL_END]: new ToolEndHandler(),
|
|
25
24
|
[GraphEvents.CHAT_MODEL_STREAM]: new ChatModelStreamHandler(),
|
|
26
25
|
[GraphEvents.ON_RUN_STEP_COMPLETED]: {
|
|
27
|
-
handle: (
|
|
26
|
+
handle: (
|
|
27
|
+
event: GraphEvents.ON_RUN_STEP_COMPLETED,
|
|
28
|
+
data: t.StreamEventData
|
|
29
|
+
): void => {
|
|
28
30
|
console.log('====== ON_RUN_STEP_COMPLETED ======');
|
|
29
|
-
aggregateContent({
|
|
30
|
-
|
|
31
|
+
aggregateContent({
|
|
32
|
+
event,
|
|
33
|
+
data: data as unknown as { result: t.ToolEndEvent },
|
|
34
|
+
});
|
|
35
|
+
},
|
|
31
36
|
},
|
|
32
37
|
[GraphEvents.ON_RUN_STEP]: {
|
|
33
|
-
handle: (
|
|
38
|
+
handle: (
|
|
39
|
+
event: GraphEvents.ON_RUN_STEP,
|
|
40
|
+
data: t.StreamEventData
|
|
41
|
+
): void => {
|
|
34
42
|
console.log('====== ON_RUN_STEP ======');
|
|
35
43
|
console.dir(data, { depth: null });
|
|
36
44
|
aggregateContent({ event, data: data as t.RunStep });
|
|
37
|
-
}
|
|
45
|
+
},
|
|
38
46
|
},
|
|
39
47
|
[GraphEvents.ON_RUN_STEP_DELTA]: {
|
|
40
|
-
handle: (
|
|
48
|
+
handle: (
|
|
49
|
+
event: GraphEvents.ON_RUN_STEP_DELTA,
|
|
50
|
+
data: t.StreamEventData
|
|
51
|
+
): void => {
|
|
41
52
|
console.log('====== ON_RUN_STEP_DELTA ======');
|
|
42
53
|
console.dir(data, { depth: null });
|
|
43
54
|
aggregateContent({ event, data: data as t.RunStepDeltaEvent });
|
|
44
|
-
}
|
|
55
|
+
},
|
|
45
56
|
},
|
|
46
57
|
[GraphEvents.ON_MESSAGE_DELTA]: {
|
|
47
|
-
handle: (
|
|
58
|
+
handle: (
|
|
59
|
+
event: GraphEvents.ON_MESSAGE_DELTA,
|
|
60
|
+
data: t.StreamEventData
|
|
61
|
+
): void => {
|
|
48
62
|
console.log('====== ON_MESSAGE_DELTA ======');
|
|
49
63
|
console.dir(data, { depth: null });
|
|
50
64
|
aggregateContent({ event, data: data as t.MessageDeltaEvent });
|
|
51
|
-
}
|
|
65
|
+
},
|
|
52
66
|
},
|
|
53
67
|
[GraphEvents.TOOL_START]: {
|
|
54
|
-
handle: (
|
|
68
|
+
handle: (
|
|
69
|
+
_event: string,
|
|
70
|
+
data: t.StreamEventData,
|
|
71
|
+
metadata?: Record<string, unknown>
|
|
72
|
+
): void => {
|
|
55
73
|
console.log('====== TOOL_START ======');
|
|
56
|
-
}
|
|
74
|
+
},
|
|
57
75
|
},
|
|
58
76
|
};
|
|
59
77
|
|
|
@@ -65,8 +83,9 @@ async function testStandardStreaming(): Promise<void> {
|
|
|
65
83
|
type: 'standard',
|
|
66
84
|
signal,
|
|
67
85
|
llmConfig,
|
|
68
|
-
tools: [
|
|
69
|
-
instructions:
|
|
86
|
+
tools: [],
|
|
87
|
+
instructions:
|
|
88
|
+
'You are a friendly AI assistant. Always address the user by their name.',
|
|
70
89
|
additional_instructions: `The user's name is ${userName} and they are located in ${location}.`,
|
|
71
90
|
},
|
|
72
91
|
customHandlers,
|
|
@@ -135,4 +154,4 @@ testStandardStreaming().catch((err) => {
|
|
|
135
154
|
console.log('Conversation history:');
|
|
136
155
|
console.dir(conversationHistory, { depth: null });
|
|
137
156
|
process.exit(1);
|
|
138
|
-
});
|
|
157
|
+
});
|