@librechat/agents-types 1.7.3 → 1.7.4

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 (2) hide show
  1. package/llm.ts +47 -18
  2. package/package.json +1 -1
package/llm.ts CHANGED
@@ -1,38 +1,67 @@
1
1
  // src/types/llm.ts
2
2
  import { ChatOpenAI } from '@langchain/openai';
3
+ import { ChatOllama } from '@langchain/ollama';
3
4
  import { ChatAnthropic } from '@langchain/anthropic';
4
5
  import { ChatMistralAI } from '@langchain/mistralai';
5
6
  import { ChatBedrockConverse } from '@langchain/aws';
6
7
  import { ChatVertexAI } from '@langchain/google-vertexai';
7
- import { BedrockChat, BedrockChatFields } from '@langchain/community/chat_models/bedrock/web';
8
+ import { BedrockChat } from '@langchain/community/chat_models/bedrock/web';
9
+ import type { Runnable } from '@langchain/core/runnables';
10
+ import type { StructuredTool } from '@langchain/core/tools';
11
+ import type { BindToolsInput } from '@langchain/core/language_models/chat_models';
12
+ import type { BedrockChatFields } from '@langchain/community/chat_models/bedrock/web';
13
+ import type { ChatOpenAIFields } from '@langchain/openai';
14
+ import type { OpenAI as OpenAIClient } from 'openai';
8
15
  import type { ChatVertexAIInput } from '@langchain/google-vertexai';
9
16
  import type { ChatBedrockConverseInput } from '@langchain/aws';
10
17
  import type { ChatMistralAIInput } from '@langchain/mistralai';
11
18
  import type { AnthropicInput } from '@langchain/anthropic';
12
- import type { OpenAIInput } from '@langchain/openai';
19
+ import type { ChatOllamaInput } from '@langchain/ollama';
13
20
  import { Providers } from '@/common';
14
21
 
15
- export type OpenAIClientOptions = Partial<OpenAIInput>;
16
- export type AnthropicClientOptions = Partial<AnthropicInput>;
17
- export type MistralAIClientOptions = Partial<ChatMistralAIInput>;
18
- export type VertexAIClientOptions = Partial<ChatVertexAIInput>;
19
- export type BedrockClientOptions = Partial<BedrockChatFields>;
20
- export type BedrockConverseClientOptions = Partial<ChatBedrockConverseInput>;
22
+ export type ChatOpenAIToolType = BindToolsInput | OpenAIClient.ChatCompletionTool;
23
+ export type CommonToolType = StructuredTool | ChatOpenAIToolType;
21
24
 
22
- export type ClientOptions =
23
- | OpenAIClientOptions
24
- | AnthropicClientOptions
25
- | MistralAIClientOptions
26
- | VertexAIClientOptions
27
- | BedrockClientOptions
28
- | BedrockConverseClientOptions;
25
+ export type OpenAIClientOptions = ChatOpenAIFields;
26
+ export type OllamaClientOptions = ChatOllamaInput;
27
+ export type AnthropicClientOptions = AnthropicInput;
28
+ export type MistralAIClientOptions = ChatMistralAIInput;
29
+ export type VertexAIClientOptions = ChatVertexAIInput;
30
+ export type BedrockClientOptions = BedrockChatFields;
31
+ export type BedrockConverseClientOptions = ChatBedrockConverseInput;
29
32
 
30
- export type ChatModel = typeof ChatAnthropic | typeof ChatOpenAI | typeof ChatMistralAI | typeof ChatVertexAI | typeof BedrockChat | typeof ChatBedrockConverse;
33
+ export type ClientOptions = OpenAIClientOptions | OllamaClientOptions | AnthropicClientOptions | MistralAIClientOptions | VertexAIClientOptions | BedrockClientOptions | BedrockConverseClientOptions;
31
34
 
32
35
  export type LLMConfig = {
33
36
  provider: Providers;
34
37
  } & ClientOptions;
35
38
 
36
- export type ChatModelInstance = ChatOpenAI | ChatAnthropic | ChatMistralAI | ChatVertexAI | BedrockChat | ChatBedrockConverse;
39
+ export type ProviderOptionsMap = {
40
+ [Providers.OPENAI]: OpenAIClientOptions;
41
+ [Providers.OLLAMA]: OllamaClientOptions;
42
+ [Providers.ANTHROPIC]: AnthropicClientOptions;
43
+ [Providers.MISTRALAI]: MistralAIClientOptions;
44
+ [Providers.VERTEXAI]: VertexAIClientOptions;
45
+ [Providers.BEDROCK_LEGACY]: BedrockClientOptions;
46
+ [Providers.BEDROCK]: BedrockConverseClientOptions;
47
+ };
37
48
 
38
- export type ChatModelConstructor = new (config: ClientOptions) => ChatModelInstance;
49
+ export type ChatModelMap = {
50
+ [Providers.OPENAI]: ChatOpenAI;
51
+ [Providers.OLLAMA]: ChatOllama;
52
+ [Providers.ANTHROPIC]: ChatAnthropic;
53
+ [Providers.MISTRALAI]: ChatMistralAI;
54
+ [Providers.VERTEXAI]: ChatVertexAI;
55
+ [Providers.BEDROCK_LEGACY]: BedrockChat;
56
+ [Providers.BEDROCK]: ChatBedrockConverse;
57
+ };
58
+
59
+ export type ChatModelConstructorMap = {
60
+ [P in Providers]: new (config: ProviderOptionsMap[P]) => ChatModelMap[P];
61
+ };
62
+
63
+ export type ChatModelInstance = ChatModelMap[Providers];
64
+
65
+ export type ModelWithTools = ChatModelInstance & {
66
+ bindTools(tools: CommonToolType[]): Runnable;
67
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@librechat/agents-types",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "description": "Type definitions for @librechat/agents",
5
5
  "types": "index.d.ts",
6
6
  "scripts": {