@librechat/agents-types 1.7.2 → 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.
- package/llm.ts +47 -18
- 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
|
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 {
|
19
|
+
import type { ChatOllamaInput } from '@langchain/ollama';
|
13
20
|
import { Providers } from '@/common';
|
14
21
|
|
15
|
-
export type
|
16
|
-
export type
|
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
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
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
|
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
|
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
|
+
}
|