@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.
Files changed (62) hide show
  1. package/dist/cjs/common/enum.cjs +4 -2
  2. package/dist/cjs/common/enum.cjs.map +1 -1
  3. package/dist/cjs/graphs/Graph.cjs +5 -6
  4. package/dist/cjs/graphs/Graph.cjs.map +1 -1
  5. package/dist/cjs/llm/google/index.cjs +73 -1
  6. package/dist/cjs/llm/google/index.cjs.map +1 -1
  7. package/dist/cjs/llm/google/utils/common.cjs +469 -0
  8. package/dist/cjs/llm/google/utils/common.cjs.map +1 -0
  9. package/dist/cjs/run.cjs +4 -3
  10. package/dist/cjs/run.cjs.map +1 -1
  11. package/dist/cjs/stream.cjs +5 -2
  12. package/dist/cjs/stream.cjs.map +1 -1
  13. package/dist/cjs/utils/title.cjs +25 -20
  14. package/dist/cjs/utils/title.cjs.map +1 -1
  15. package/dist/esm/common/enum.mjs +4 -2
  16. package/dist/esm/common/enum.mjs.map +1 -1
  17. package/dist/esm/graphs/Graph.mjs +5 -6
  18. package/dist/esm/graphs/Graph.mjs.map +1 -1
  19. package/dist/esm/llm/google/index.mjs +73 -1
  20. package/dist/esm/llm/google/index.mjs.map +1 -1
  21. package/dist/esm/llm/google/utils/common.mjs +463 -0
  22. package/dist/esm/llm/google/utils/common.mjs.map +1 -0
  23. package/dist/esm/run.mjs +4 -3
  24. package/dist/esm/run.mjs.map +1 -1
  25. package/dist/esm/stream.mjs +5 -2
  26. package/dist/esm/stream.mjs.map +1 -1
  27. package/dist/esm/utils/title.mjs +25 -20
  28. package/dist/esm/utils/title.mjs.map +1 -1
  29. package/dist/types/common/enum.d.ts +5 -3
  30. package/dist/types/graphs/Graph.d.ts +3 -2
  31. package/dist/types/llm/google/index.d.ts +10 -5
  32. package/dist/types/llm/google/types.d.ts +32 -0
  33. package/dist/types/llm/google/utils/common.d.ts +19 -0
  34. package/dist/types/llm/google/utils/tools.d.ts +10 -0
  35. package/dist/types/llm/google/utils/zod_to_genai_parameters.d.ts +14 -0
  36. package/dist/types/run.d.ts +1 -1
  37. package/dist/types/scripts/args.d.ts +2 -1
  38. package/dist/types/types/llm.d.ts +2 -0
  39. package/dist/types/types/run.d.ts +1 -0
  40. package/dist/types/types/stream.d.ts +5 -0
  41. package/package.json +1 -1
  42. package/src/common/enum.ts +4 -2
  43. package/src/graphs/Graph.ts +16 -11
  44. package/src/llm/google/index.ts +118 -8
  45. package/src/llm/google/types.ts +43 -0
  46. package/src/llm/google/utils/common.ts +632 -0
  47. package/src/llm/google/utils/tools.ts +160 -0
  48. package/src/llm/google/utils/zod_to_genai_parameters.ts +88 -0
  49. package/src/run.ts +4 -2
  50. package/src/scripts/args.ts +12 -8
  51. package/src/scripts/code_exec.ts +49 -18
  52. package/src/scripts/code_exec_files.ts +48 -17
  53. package/src/scripts/image.ts +52 -20
  54. package/src/scripts/simple.ts +1 -0
  55. package/src/specs/anthropic.simple.test.ts +88 -31
  56. package/src/specs/openai.simple.test.ts +88 -31
  57. package/src/stream.ts +5 -2
  58. package/src/types/llm.ts +2 -0
  59. package/src/types/run.ts +1 -0
  60. package/src/types/stream.ts +6 -0
  61. package/src/utils/llmConfig.ts +2 -2
  62. package/src/utils/title.ts +44 -27
@@ -93,14 +93,14 @@ export const llmConfigs: Record<string, t.LLMConfig | undefined> = {
93
93
  },
94
94
  [Providers.VERTEXAI]: {
95
95
  provider: Providers.VERTEXAI,
96
- modelName: 'gemini-2.0-flash-001',
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-preview-04-17',
103
+ model: 'gemini-2.5-flash',
104
104
  streaming: true,
105
105
  streamUsage: true,
106
106
  },
@@ -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 = `Write a concise title for this conversation in the detected language. Title in 5 Words or Less. No Punctuation or Quotation.
8
- {convo}`;
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
- const languagePrompt = ChatPromptTemplate.fromTemplate(languageInstructions);
11
+ {convo}`;
13
12
 
14
- const languageSchema = z.object({
15
- language: z.string().describe('The detected language of the conversation')
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 titleSchema = z.object({
19
- title: z.string().describe('A concise title for the conversation in 5 words or less, without punctuation or quotation'),
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 (model: t.ChatModelInstance, _titlePrompt?: string): Promise<Runnable> => {
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 languageLLM = model.withStructuredOutput(languageSchema);
37
+ const titleLLM = model.withStructuredOutput(titleSchema);
27
38
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
28
39
  /* @ts-ignore */
29
- const titleLLM = model.withStructuredOutput(titleSchema);
30
-
31
- const languageChain = languagePrompt.pipe(languageLLM);
40
+ const combinedLLM = model.withStructuredOutput(combinedSchema);
32
41
 
33
- const titlePrompt = ChatPromptTemplate.fromTemplate(_titlePrompt ?? defaultTitlePrompt);
42
+ const titlePrompt = ChatPromptTemplate.fromTemplate(
43
+ _titlePrompt ?? defaultTitlePrompt
44
+ );
34
45
 
35
46
  return new RunnableLambda({
36
- func: async (input: { convo: string, inputText: string, skipLanguage: boolean }): Promise<{ language: string; title: string } | { title: string }> => {
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
- const languageResult = await languageChain.invoke({ text: input.inputText }) as { language: string } | undefined;
43
- const language = languageResult?.language ?? 'English';
44
- const titleResult = await titlePrompt.pipe(titleLLM).invoke({
45
- language,
46
- convo: input.convo
47
- }) as { title: string } | undefined;
48
- return { language, title: titleResult?.title ?? '' };
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
+ };