@librechat/agents 2.4.30 → 2.4.311

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 (55) hide show
  1. package/dist/cjs/common/enum.cjs +1 -0
  2. package/dist/cjs/common/enum.cjs.map +1 -1
  3. package/dist/cjs/main.cjs +2 -0
  4. package/dist/cjs/main.cjs.map +1 -1
  5. package/dist/cjs/tools/search/firecrawl.cjs +149 -0
  6. package/dist/cjs/tools/search/firecrawl.cjs.map +1 -0
  7. package/dist/cjs/tools/search/format.cjs +116 -0
  8. package/dist/cjs/tools/search/format.cjs.map +1 -0
  9. package/dist/cjs/tools/search/highlights.cjs +194 -0
  10. package/dist/cjs/tools/search/highlights.cjs.map +1 -0
  11. package/dist/cjs/tools/search/rerankers.cjs +187 -0
  12. package/dist/cjs/tools/search/rerankers.cjs.map +1 -0
  13. package/dist/cjs/tools/search/search.cjs +410 -0
  14. package/dist/cjs/tools/search/search.cjs.map +1 -0
  15. package/dist/cjs/tools/search/tool.cjs +103 -0
  16. package/dist/cjs/tools/search/tool.cjs.map +1 -0
  17. package/dist/esm/common/enum.mjs +1 -0
  18. package/dist/esm/common/enum.mjs.map +1 -1
  19. package/dist/esm/main.mjs +1 -0
  20. package/dist/esm/main.mjs.map +1 -1
  21. package/dist/esm/tools/search/firecrawl.mjs +145 -0
  22. package/dist/esm/tools/search/firecrawl.mjs.map +1 -0
  23. package/dist/esm/tools/search/format.mjs +114 -0
  24. package/dist/esm/tools/search/format.mjs.map +1 -0
  25. package/dist/esm/tools/search/highlights.mjs +192 -0
  26. package/dist/esm/tools/search/highlights.mjs.map +1 -0
  27. package/dist/esm/tools/search/rerankers.mjs +181 -0
  28. package/dist/esm/tools/search/rerankers.mjs.map +1 -0
  29. package/dist/esm/tools/search/search.mjs +407 -0
  30. package/dist/esm/tools/search/search.mjs.map +1 -0
  31. package/dist/esm/tools/search/tool.mjs +101 -0
  32. package/dist/esm/tools/search/tool.mjs.map +1 -0
  33. package/dist/types/common/enum.d.ts +1 -0
  34. package/dist/types/index.d.ts +1 -0
  35. package/dist/types/scripts/search.d.ts +1 -0
  36. package/dist/types/tools/search/firecrawl.d.ts +117 -0
  37. package/dist/types/tools/search/format.d.ts +2 -0
  38. package/dist/types/tools/search/highlights.d.ts +13 -0
  39. package/dist/types/tools/search/index.d.ts +2 -0
  40. package/dist/types/tools/search/rerankers.d.ts +32 -0
  41. package/dist/types/tools/search/search.d.ts +9 -0
  42. package/dist/types/tools/search/tool.d.ts +12 -0
  43. package/dist/types/tools/search/types.d.ts +150 -0
  44. package/package.json +2 -1
  45. package/src/common/enum.ts +1 -0
  46. package/src/index.ts +1 -0
  47. package/src/scripts/search.ts +141 -0
  48. package/src/tools/search/firecrawl.ts +270 -0
  49. package/src/tools/search/format.ts +121 -0
  50. package/src/tools/search/highlights.ts +238 -0
  51. package/src/tools/search/index.ts +2 -0
  52. package/src/tools/search/rerankers.ts +248 -0
  53. package/src/tools/search/search.ts +567 -0
  54. package/src/tools/search/tool.ts +151 -0
  55. package/src/tools/search/types.ts +179 -0
@@ -0,0 +1,179 @@
1
+ import type { RunnableConfig } from '@langchain/core/runnables';
2
+ import type { BaseReranker } from './rerankers';
3
+
4
+ export type SearchProvider = 'serper' | 'searxng';
5
+ export type RerankerType = 'infinity' | 'jina' | 'cohere' | 'none';
6
+
7
+ export interface OrganicResult {
8
+ position?: number;
9
+ title?: string;
10
+ link: string;
11
+ snippet?: string;
12
+ date?: string;
13
+ }
14
+
15
+ export interface TopStoryResult {
16
+ title?: string;
17
+ link: string;
18
+ source?: string;
19
+ date?: string;
20
+ imageUrl?: string;
21
+ }
22
+
23
+ export interface ImageResult {
24
+ title?: string;
25
+ imageUrl?: string;
26
+ }
27
+
28
+ export interface KnowledgeGraphResult {
29
+ title?: string;
30
+ type?: string;
31
+ description?: string;
32
+ attributes?: Record<string, string>;
33
+ imageUrl?: string;
34
+ }
35
+
36
+ export interface AnswerBoxResult {
37
+ title?: string;
38
+ answer?: string;
39
+ snippet?: string;
40
+ date?: string;
41
+ }
42
+
43
+ export interface PeopleAlsoAskResult {
44
+ question?: string;
45
+ answer?: string;
46
+ }
47
+
48
+ export interface Highlight {
49
+ score: number;
50
+ text: string;
51
+ }
52
+
53
+ export interface ValidSource {
54
+ link: string;
55
+ position?: number;
56
+ title?: string;
57
+ snippet?: string;
58
+ date?: string;
59
+ content?: string;
60
+ attribution?: string;
61
+ highlights?: Highlight[];
62
+ }
63
+
64
+ export interface SearchResultData {
65
+ organic?: ValidSource[];
66
+ topStories?: ValidSource[];
67
+ images?: ImageResult[];
68
+ knowledgeGraph?: KnowledgeGraphResult;
69
+ answerBox?: AnswerBoxResult;
70
+ peopleAlsoAsk?: PeopleAlsoAskResult[];
71
+ relatedSearches?: string[];
72
+ suggestions?: string[];
73
+ error?: string;
74
+ }
75
+
76
+ export interface SearchResult {
77
+ data?: SearchResultData;
78
+ error?: string;
79
+ success: boolean;
80
+ }
81
+
82
+ export interface Source {
83
+ link: string;
84
+ html?: string;
85
+ title?: string;
86
+ snippet?: string;
87
+ date?: string;
88
+ }
89
+
90
+ export interface SearchConfig {
91
+ searchProvider?: SearchProvider;
92
+ serperApiKey?: string;
93
+ searxngInstanceUrl?: string;
94
+ searxngApiKey?: string;
95
+ }
96
+
97
+ export interface ScrapeResult {
98
+ url: string;
99
+ error?: boolean;
100
+ content: string;
101
+ attribution?: string;
102
+ highlights?: Highlight[];
103
+ }
104
+
105
+ export interface ProcessSourcesConfig {
106
+ topResults?: number;
107
+ strategies?: string[];
108
+ filterContent?: boolean;
109
+ reranker?: BaseReranker;
110
+ }
111
+
112
+ export interface FirecrawlConfig {
113
+ firecrawlApiKey?: string;
114
+ firecrawlApiUrl?: string;
115
+ firecrawlFormats?: string[];
116
+ }
117
+
118
+ export interface ScraperContentResult {
119
+ content: string;
120
+ }
121
+
122
+ export interface ScraperExtractionResult {
123
+ no_extraction: ScraperContentResult;
124
+ }
125
+
126
+ // Define type for SearXNG result
127
+ export interface SearXNGResult {
128
+ title?: string;
129
+ url?: string;
130
+ content?: string;
131
+ publishedDate?: string;
132
+ img_src?: string;
133
+ }
134
+
135
+ export interface JinaRerankerResult {
136
+ index: number;
137
+ relevance_score: number;
138
+ document?: string | { text: string };
139
+ }
140
+
141
+ export interface JinaRerankerResponse {
142
+ model: string;
143
+ usage: {
144
+ total_tokens: number;
145
+ };
146
+ results: JinaRerankerResult[];
147
+ }
148
+
149
+ export interface CohereRerankerResult {
150
+ index: number;
151
+ relevance_score: number;
152
+ }
153
+
154
+ export interface CohereRerankerResponse {
155
+ results: CohereRerankerResult[];
156
+ id: string;
157
+ meta: {
158
+ api_version: {
159
+ version: string;
160
+ is_experimental: boolean;
161
+ };
162
+ billed_units: {
163
+ search_units: number;
164
+ };
165
+ };
166
+ }
167
+
168
+ export interface SearchToolConfig
169
+ extends SearchConfig,
170
+ ProcessSourcesConfig,
171
+ FirecrawlConfig {
172
+ jinaApiKey?: string;
173
+ cohereApiKey?: string;
174
+ rerankerType?: RerankerType;
175
+ onSearchResults?: (
176
+ results: SearchResult,
177
+ runnableConfig?: RunnableConfig
178
+ ) => void;
179
+ }