@librechat/agents-types 2.0.5 → 2.1.1

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.
Files changed (5) hide show
  1. package/graph.ts +18 -1
  2. package/llm.ts +10 -5
  3. package/package.json +1 -1
  4. package/run.ts +5 -13
  5. package/stream.ts +14 -1
package/graph.ts CHANGED
@@ -3,6 +3,9 @@ import type { StateGraphArgs, StateGraph, CompiledStateGraph } from '@langchain/
3
3
  import type { BaseMessage, AIMessageChunk } from '@langchain/core/messages';
4
4
  import type { ChatGenerationChunk } from '@langchain/core/outputs';
5
5
  import type { RunnableConfig } from '@langchain/core/runnables';
6
+ import type { ToolMap, GenericTool } from '@/types/tools';
7
+ import type { ClientOptions } from '@/types/llm';
8
+ import type { Providers } from '@/common';
6
9
  import type { Graph } from '@/graphs';
7
10
  // import type { RunnableConfig } from '@langchain/core/runnables';
8
11
 
@@ -135,4 +138,18 @@ export type PartMetadata = {
135
138
  output?: string;
136
139
  };
137
140
 
138
- export type ModelEndData = StreamEventData & { output: AIMessageChunk | undefined } | undefined;
141
+ export type ModelEndData = StreamEventData & { output: AIMessageChunk | undefined } | undefined;
142
+
143
+ export type StandardGraphInput = {
144
+ runId?: string;
145
+ toolEnd?: boolean;
146
+ toolMap?: ToolMap;
147
+ provider: Providers;
148
+ signal?: AbortSignal;
149
+ instructions?: string;
150
+ streamBuffer?: number;
151
+ tools?: GenericTool[];
152
+ clientOptions: ClientOptions;
153
+ additional_instructions?: string;
154
+ reasoningKey?: 'reasoning_content' | 'reasoning';
155
+ };
package/llm.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  // src/types/llm.ts
2
2
  import { ChatOllama } from '@langchain/ollama';
3
+ import { ChatDeepSeek } from '@langchain/deepseek';
3
4
  import { ChatAnthropic } from '@langchain/anthropic';
4
5
  import { ChatMistralAI } from '@langchain/mistralai';
5
6
  import { ChatBedrockConverse } from '@langchain/aws';
@@ -12,6 +13,7 @@ import type { ChatOpenAIFields, OpenAIChatInput, AzureOpenAIInput } from '@langc
12
13
  import type { BedrockChatFields } from '@langchain/community/chat_models/bedrock/web';
13
14
  import type { GoogleGenerativeAIChatInput } from '@langchain/google-genai';
14
15
  import type { ChatVertexAIInput } from '@langchain/google-vertexai';
16
+ import type { ChatDeepSeekCallOptions } from '@langchain/deepseek';
15
17
  import type { ChatBedrockConverseInput } from '@langchain/aws';
16
18
  import type { ChatMistralAIInput } from '@langchain/mistralai';
17
19
  import type { StructuredTool } from '@langchain/core/tools';
@@ -41,32 +43,35 @@ export type VertexAIClientOptions = ChatVertexAIInput;
41
43
  export type BedrockClientOptions = BedrockChatFields;
42
44
  export type BedrockConverseClientOptions = ChatBedrockConverseInput;
43
45
  export type GoogleClientOptions = GoogleGenerativeAIChatInput;
46
+ export type DeepSeekClientOptions = ChatDeepSeekCallOptions;
44
47
 
45
- export type ClientOptions = OpenAIClientOptions | AzureClientOptions | OllamaClientOptions | AnthropicClientOptions | MistralAIClientOptions | VertexAIClientOptions | BedrockClientOptions | BedrockConverseClientOptions | GoogleClientOptions;
48
+ export type ClientOptions = OpenAIClientOptions | AzureClientOptions | OllamaClientOptions | AnthropicClientOptions | MistralAIClientOptions | VertexAIClientOptions | BedrockClientOptions | BedrockConverseClientOptions | GoogleClientOptions | DeepSeekClientOptions;
46
49
 
47
50
  export type LLMConfig = {
48
51
  provider: Providers;
49
52
  } & ClientOptions;
50
53
 
51
54
  export type ProviderOptionsMap = {
52
- [Providers.OPENAI]: OpenAIClientOptions;
53
55
  [Providers.AZURE]: AzureClientOptions;
56
+ [Providers.OPENAI]: OpenAIClientOptions;
54
57
  [Providers.OLLAMA]: OllamaClientOptions;
58
+ [Providers.GOOGLE]: GoogleClientOptions;
59
+ [Providers.VERTEXAI]: VertexAIClientOptions;
60
+ [Providers.DEEPSEEK]: DeepSeekClientOptions;
55
61
  [Providers.ANTHROPIC]: AnthropicClientOptions;
56
62
  [Providers.MISTRALAI]: MistralAIClientOptions;
57
- [Providers.VERTEXAI]: VertexAIClientOptions;
58
63
  [Providers.BEDROCK_LEGACY]: BedrockClientOptions;
59
64
  [Providers.BEDROCK]: BedrockConverseClientOptions;
60
- [Providers.GOOGLE]: GoogleClientOptions;
61
65
  };
62
66
 
63
67
  export type ChatModelMap = {
64
68
  [Providers.OPENAI]: ChatOpenAI;
65
69
  [Providers.OLLAMA]: ChatOllama;
66
70
  [Providers.AZURE]: AzureChatOpenAI;
71
+ [Providers.DEEPSEEK]: ChatDeepSeek;
72
+ [Providers.VERTEXAI]: ChatVertexAI;
67
73
  [Providers.ANTHROPIC]: ChatAnthropic;
68
74
  [Providers.MISTRALAI]: ChatMistralAI;
69
- [Providers.VERTEXAI]: ChatVertexAI;
70
75
  [Providers.BEDROCK_LEGACY]: BedrockChat;
71
76
  [Providers.BEDROCK]: ChatBedrockConverse;
72
77
  [Providers.GOOGLE]: ChatGoogleGenerativeAI;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@librechat/agents-types",
3
- "version": "2.0.5",
3
+ "version": "2.1.1",
4
4
  "description": "Type definitions for @librechat/agents",
5
5
  "types": "index.d.ts",
6
6
  "scripts": {
package/run.ts CHANGED
@@ -6,26 +6,18 @@ import type { BaseCallbackHandler, CallbackHandlerMethods } from '@langchain/cor
6
6
  import type * as graph from '@/graphs/Graph';
7
7
  import type * as e from '@/common/enum';
8
8
  import type * as g from '@/types/graph';
9
- import type * as t from '@/types/tools';
10
9
  import type * as l from '@/types/llm';
11
10
 
12
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
12
  export type ZodObjectAny = z.ZodObject<any, any, any, any>;
14
-
15
- export type StandardGraphConfig = {
16
- runId?: string;
13
+ export type BaseGraphConfig = {
17
14
  type?: 'standard';
18
- provider?: e.Providers;
19
- instructions?: string;
20
15
  llmConfig: l.LLMConfig;
21
- tools?: t.GenericTool[];
22
- toolMap?: t.ToolMap;
23
- additional_instructions?: string;
24
- streamBuffer?: number;
25
- signal?: AbortSignal;
26
- clientOptions?: Record<string, unknown>;
27
- toolEnd?: boolean;
16
+ provider?: e.Providers;
17
+ clientOptions?: l.ClientOptions;
28
18
  };
19
+ export type StandardGraphConfig = BaseGraphConfig &
20
+ Omit<g.StandardGraphInput, 'provider' | 'clientOptions'>;
29
21
 
30
22
  export interface AgentStateChannels {
31
23
  messages: BaseMessage[];
package/stream.ts CHANGED
@@ -3,6 +3,7 @@ import type OpenAITypes from 'openai';
3
3
  import type { MessageContentImageUrl, MessageContentText, ToolMessage, BaseMessage } from '@langchain/core/messages';
4
4
  import type { ToolCall, ToolCallChunk } from '@langchain/core/messages/tool';
5
5
  import type { LLMResult, Generation } from '@langchain/core/outputs';
6
+ import type { ToolEndEvent } from '@/types/tools';
6
7
  import { StepTypes, ContentTypes, GraphEvents } from '@/common/enum';
7
8
 
8
9
  export type HandleLLMEnd = (output: LLMResult, runId: string, parentRunId?: string, tags?: string[]) => void;
@@ -239,4 +240,16 @@ export type SplitStreamHandlers = Partial<{
239
240
  [GraphEvents.ON_RUN_STEP]: ({ event, data}: { event: GraphEvents, data: RunStep }) => void;
240
241
  [GraphEvents.ON_MESSAGE_DELTA]: ({ event, data}: { event: GraphEvents, data: MessageDeltaEvent }) => void;
241
242
  [GraphEvents.ON_REASONING_DELTA]: ({ event, data}: { event: GraphEvents, data: ReasoningDeltaEvent }) => void;
242
- }>
243
+ }>
244
+
245
+ export type ContentAggregator = ({ event, data }: {
246
+ event: GraphEvents;
247
+ data: RunStep | MessageDeltaEvent | RunStepDeltaEvent | {
248
+ result: ToolEndEvent;
249
+ };
250
+ }) => void;
251
+ export type ContentAggregatorResult = {
252
+ stepMap: Map<string, RunStep | undefined>;
253
+ contentParts: Array<MessageContentComplex | undefined>;
254
+ aggregateContent: ContentAggregator;
255
+ };