@librechat/agents 2.4.41 → 2.4.43
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 +4 -2
- package/dist/cjs/common/enum.cjs.map +1 -1
- package/dist/cjs/graphs/Graph.cjs +5 -6
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/llm/google/index.cjs +73 -1
- package/dist/cjs/llm/google/index.cjs.map +1 -1
- package/dist/cjs/llm/google/utils/common.cjs +469 -0
- package/dist/cjs/llm/google/utils/common.cjs.map +1 -0
- package/dist/cjs/run.cjs +4 -3
- package/dist/cjs/run.cjs.map +1 -1
- package/dist/cjs/stream.cjs +5 -2
- package/dist/cjs/stream.cjs.map +1 -1
- package/dist/cjs/utils/title.cjs +25 -20
- package/dist/cjs/utils/title.cjs.map +1 -1
- package/dist/esm/common/enum.mjs +4 -2
- package/dist/esm/common/enum.mjs.map +1 -1
- package/dist/esm/graphs/Graph.mjs +5 -6
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/llm/google/index.mjs +73 -1
- package/dist/esm/llm/google/index.mjs.map +1 -1
- package/dist/esm/llm/google/utils/common.mjs +463 -0
- package/dist/esm/llm/google/utils/common.mjs.map +1 -0
- package/dist/esm/run.mjs +4 -3
- package/dist/esm/run.mjs.map +1 -1
- package/dist/esm/stream.mjs +5 -2
- package/dist/esm/stream.mjs.map +1 -1
- package/dist/esm/utils/title.mjs +25 -20
- package/dist/esm/utils/title.mjs.map +1 -1
- package/dist/types/common/enum.d.ts +5 -3
- package/dist/types/graphs/Graph.d.ts +3 -2
- package/dist/types/llm/google/index.d.ts +10 -5
- package/dist/types/llm/google/types.d.ts +32 -0
- package/dist/types/llm/google/utils/common.d.ts +19 -0
- package/dist/types/llm/google/utils/tools.d.ts +10 -0
- package/dist/types/llm/google/utils/zod_to_genai_parameters.d.ts +14 -0
- package/dist/types/run.d.ts +1 -1
- package/dist/types/scripts/args.d.ts +2 -1
- package/dist/types/types/llm.d.ts +2 -0
- package/dist/types/types/run.d.ts +1 -0
- package/dist/types/types/stream.d.ts +5 -0
- package/package.json +1 -1
- package/src/common/enum.ts +4 -2
- package/src/graphs/Graph.ts +16 -11
- package/src/llm/google/index.ts +118 -8
- package/src/llm/google/types.ts +43 -0
- package/src/llm/google/utils/common.ts +632 -0
- package/src/llm/google/utils/tools.ts +160 -0
- package/src/llm/google/utils/zod_to_genai_parameters.ts +88 -0
- package/src/run.ts +4 -2
- package/src/scripts/args.ts +12 -8
- package/src/scripts/code_exec.ts +49 -18
- package/src/scripts/code_exec_files.ts +48 -17
- package/src/scripts/image.ts +52 -20
- package/src/scripts/simple.ts +1 -0
- package/src/specs/anthropic.simple.test.ts +88 -31
- package/src/specs/openai.simple.test.ts +88 -31
- package/src/stream.ts +5 -2
- package/src/types/llm.ts +2 -0
- package/src/types/run.ts +1 -0
- package/src/types/stream.ts +6 -0
- package/src/utils/llmConfig.ts +2 -2
- package/src/utils/title.ts +44 -27
package/src/utils/llmConfig.ts
CHANGED
|
@@ -93,14 +93,14 @@ export const llmConfigs: Record<string, t.LLMConfig | undefined> = {
|
|
|
93
93
|
},
|
|
94
94
|
[Providers.VERTEXAI]: {
|
|
95
95
|
provider: Providers.VERTEXAI,
|
|
96
|
-
|
|
96
|
+
model: 'gemini-2.5-flash',
|
|
97
97
|
streaming: true,
|
|
98
98
|
streamUsage: true,
|
|
99
99
|
keyFile: process.env.VERTEXAI_KEY_FILE,
|
|
100
100
|
} as t.VertexAIClientOptions & t.LLMConfig,
|
|
101
101
|
[Providers.GOOGLE]: {
|
|
102
102
|
provider: Providers.GOOGLE,
|
|
103
|
-
model: 'gemini-2.5-flash
|
|
103
|
+
model: 'gemini-2.5-flash',
|
|
104
104
|
streaming: true,
|
|
105
105
|
streamUsage: true,
|
|
106
106
|
},
|
package/src/utils/title.ts
CHANGED
|
@@ -4,48 +4,65 @@ import { RunnableLambda } from '@langchain/core/runnables';
|
|
|
4
4
|
import type { Runnable } from '@langchain/core/runnables';
|
|
5
5
|
import * as t from '@/types';
|
|
6
6
|
|
|
7
|
-
const defaultTitlePrompt = `
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const languageInstructions = 'Detect the language used in the following text. Note: words may be misspelled or cut off; use context clues to identify the language:\n{text}';
|
|
7
|
+
const defaultTitlePrompt = `Analyze this conversation and provide:
|
|
8
|
+
1. The detected language of the conversation
|
|
9
|
+
2. A concise title in the detected language (5 words or less, no punctuation or quotation)
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
{convo}`;
|
|
13
12
|
|
|
14
|
-
const
|
|
15
|
-
|
|
13
|
+
const titleSchema = z.object({
|
|
14
|
+
title: z
|
|
15
|
+
.string()
|
|
16
|
+
.describe(
|
|
17
|
+
'A concise title for the conversation in 5 words or less, without punctuation or quotation'
|
|
18
|
+
),
|
|
16
19
|
});
|
|
17
20
|
|
|
18
|
-
const
|
|
19
|
-
|
|
21
|
+
const combinedSchema = z.object({
|
|
22
|
+
language: z.string().describe('The detected language of the conversation'),
|
|
23
|
+
title: z
|
|
24
|
+
.string()
|
|
25
|
+
.describe(
|
|
26
|
+
'A concise title for the conversation in 5 words or less, without punctuation or quotation'
|
|
27
|
+
),
|
|
20
28
|
});
|
|
21
29
|
|
|
22
|
-
export const createTitleRunnable = async (
|
|
30
|
+
export const createTitleRunnable = async (
|
|
31
|
+
model: t.ChatModelInstance,
|
|
32
|
+
_titlePrompt?: string
|
|
33
|
+
): Promise<Runnable> => {
|
|
23
34
|
// Disabled since this works fine
|
|
24
35
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
25
36
|
/* @ts-ignore */
|
|
26
|
-
const
|
|
37
|
+
const titleLLM = model.withStructuredOutput(titleSchema);
|
|
27
38
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
28
39
|
/* @ts-ignore */
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
const languageChain = languagePrompt.pipe(languageLLM);
|
|
40
|
+
const combinedLLM = model.withStructuredOutput(combinedSchema);
|
|
32
41
|
|
|
33
|
-
const titlePrompt = ChatPromptTemplate.fromTemplate(
|
|
42
|
+
const titlePrompt = ChatPromptTemplate.fromTemplate(
|
|
43
|
+
_titlePrompt ?? defaultTitlePrompt
|
|
44
|
+
);
|
|
34
45
|
|
|
35
46
|
return new RunnableLambda({
|
|
36
|
-
func: async (input: {
|
|
47
|
+
func: async (input: {
|
|
48
|
+
convo: string;
|
|
49
|
+
inputText: string;
|
|
50
|
+
skipLanguage: boolean;
|
|
51
|
+
}): Promise<{ language: string; title: string } | { title: string }> => {
|
|
37
52
|
if (input.skipLanguage) {
|
|
38
|
-
return await titlePrompt.pipe(titleLLM).invoke({
|
|
39
|
-
convo: input.convo
|
|
40
|
-
}) as { title: string };
|
|
53
|
+
return (await titlePrompt.pipe(titleLLM).invoke({
|
|
54
|
+
convo: input.convo,
|
|
55
|
+
})) as { title: string };
|
|
41
56
|
}
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
|
|
58
|
+
const result = (await titlePrompt.pipe(combinedLLM).invoke({
|
|
59
|
+
convo: input.convo,
|
|
60
|
+
})) as { language: string; title: string } | undefined;
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
language: result?.language ?? 'English',
|
|
64
|
+
title: result?.title ?? '',
|
|
65
|
+
};
|
|
49
66
|
},
|
|
50
67
|
});
|
|
51
|
-
};
|
|
68
|
+
};
|