@librechat/agents 2.4.317 → 2.4.319
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/events.cjs +3 -3
- package/dist/cjs/events.cjs.map +1 -1
- package/dist/cjs/main.cjs +5 -2
- package/dist/cjs/main.cjs.map +1 -1
- package/dist/cjs/messages/ids.cjs +23 -0
- package/dist/cjs/messages/ids.cjs.map +1 -0
- package/dist/cjs/stream.cjs +8 -155
- package/dist/cjs/stream.cjs.map +1 -1
- package/dist/cjs/tools/handlers.cjs +144 -0
- package/dist/cjs/tools/handlers.cjs.map +1 -0
- package/dist/cjs/tools/search/content.cjs +140 -0
- package/dist/cjs/tools/search/content.cjs.map +1 -0
- package/dist/cjs/tools/search/firecrawl.cjs +17 -37
- package/dist/cjs/tools/search/firecrawl.cjs.map +1 -1
- package/dist/cjs/tools/search/format.cjs +79 -29
- package/dist/cjs/tools/search/format.cjs.map +1 -1
- package/dist/cjs/tools/search/highlights.cjs +64 -13
- package/dist/cjs/tools/search/highlights.cjs.map +1 -1
- package/dist/cjs/tools/search/search.cjs +13 -15
- package/dist/cjs/tools/search/search.cjs.map +1 -1
- package/dist/cjs/tools/search/tool.cjs +42 -12
- package/dist/cjs/tools/search/tool.cjs.map +1 -1
- package/dist/cjs/tools/search/utils.cjs +35 -0
- package/dist/cjs/tools/search/utils.cjs.map +1 -0
- package/dist/esm/events.mjs +1 -1
- package/dist/esm/events.mjs.map +1 -1
- package/dist/esm/main.mjs +3 -1
- package/dist/esm/main.mjs.map +1 -1
- package/dist/esm/messages/ids.mjs +21 -0
- package/dist/esm/messages/ids.mjs.map +1 -0
- package/dist/esm/stream.mjs +7 -152
- package/dist/esm/stream.mjs.map +1 -1
- package/dist/esm/tools/handlers.mjs +141 -0
- package/dist/esm/tools/handlers.mjs.map +1 -0
- package/dist/esm/tools/search/content.mjs +119 -0
- package/dist/esm/tools/search/content.mjs.map +1 -0
- package/dist/esm/tools/search/firecrawl.mjs +18 -37
- package/dist/esm/tools/search/firecrawl.mjs.map +1 -1
- package/dist/esm/tools/search/format.mjs +79 -29
- package/dist/esm/tools/search/format.mjs.map +1 -1
- package/dist/esm/tools/search/highlights.mjs +64 -13
- package/dist/esm/tools/search/highlights.mjs.map +1 -1
- package/dist/esm/tools/search/search.mjs +12 -14
- package/dist/esm/tools/search/search.mjs.map +1 -1
- package/dist/esm/tools/search/tool.mjs +42 -12
- package/dist/esm/tools/search/tool.mjs.map +1 -1
- package/dist/esm/tools/search/utils.mjs +32 -0
- package/dist/esm/tools/search/utils.mjs.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/messages/ids.d.ts +3 -0
- package/dist/types/messages/index.d.ts +1 -0
- package/dist/types/stream.d.ts +0 -8
- package/dist/types/tools/handlers.d.ts +8 -0
- package/dist/types/tools/search/content.d.ts +4 -0
- package/dist/types/tools/search/firecrawl.d.ts +6 -86
- package/dist/types/tools/search/format.d.ts +4 -1
- package/dist/types/tools/search/highlights.d.ts +1 -1
- package/dist/types/tools/search/search.d.ts +1 -1
- package/dist/types/tools/search/test.d.ts +1 -0
- package/dist/types/tools/search/tool.d.ts +12 -4
- package/dist/types/tools/search/types.d.ts +388 -53
- package/dist/types/tools/search/utils.d.ts +3 -0
- package/package.json +2 -1
- package/src/events.ts +49 -15
- package/src/index.ts +1 -0
- package/src/messages/ids.ts +26 -0
- package/src/messages/index.ts +1 -0
- package/src/scripts/search.ts +5 -3
- package/src/stream.ts +4 -186
- package/src/tools/handlers.ts +167 -0
- package/src/tools/search/content.test.ts +173 -0
- package/src/tools/search/content.ts +147 -0
- package/src/tools/search/firecrawl.ts +27 -144
- package/src/tools/search/format.ts +89 -31
- package/src/tools/search/highlights.ts +99 -17
- package/src/tools/search/output.md +2775 -0
- package/src/tools/search/search.ts +42 -54
- package/src/tools/search/test.html +884 -0
- package/src/tools/search/test.md +643 -0
- package/src/tools/search/test.ts +159 -0
- package/src/tools/search/tool.ts +52 -15
- package/src/tools/search/types.ts +439 -61
- package/src/tools/search/utils.ts +43 -0
package/dist/types/stream.d.ts
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
import type { AIMessageChunk } from '@langchain/core/messages';
|
|
2
|
-
import type { ToolCall, ToolCallChunk } from '@langchain/core/messages/tool';
|
|
3
2
|
import type { Graph } from '@/graphs';
|
|
4
3
|
import type * as t from '@/types';
|
|
5
|
-
export declare const getMessageId: (stepKey: string, graph: Graph<t.BaseGraphState>, returnExistingId?: boolean) => string | undefined;
|
|
6
|
-
export declare const handleToolCalls: (toolCalls?: ToolCall[], metadata?: Record<string, unknown>, graph?: Graph) => void;
|
|
7
4
|
export declare class ChatModelStreamHandler implements t.EventHandler {
|
|
8
5
|
handle(event: string, data: t.StreamEventData, metadata?: Record<string, unknown>, graph?: Graph): void;
|
|
9
|
-
handleToolCallChunks: ({ graph, stepKey, toolCallChunks, }: {
|
|
10
|
-
graph: Graph;
|
|
11
|
-
stepKey: string;
|
|
12
|
-
toolCallChunks: ToolCallChunk[];
|
|
13
|
-
}) => void;
|
|
14
6
|
handleReasoning(chunk: Partial<AIMessageChunk>, graph: Graph): void;
|
|
15
7
|
}
|
|
16
8
|
export declare function createContentAggregator(): t.ContentAggregatorResult;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ToolCall, ToolCallChunk } from '@langchain/core/messages/tool';
|
|
2
|
+
import type { Graph } from '@/graphs';
|
|
3
|
+
export declare function handleToolCallChunks({ graph, stepKey, toolCallChunks, }: {
|
|
4
|
+
graph: Graph;
|
|
5
|
+
stepKey: string;
|
|
6
|
+
toolCallChunks: ToolCallChunk[];
|
|
7
|
+
}): void;
|
|
8
|
+
export declare const handleToolCalls: (toolCalls?: ToolCall[], metadata?: Record<string, unknown>, graph?: Graph) => void;
|
|
@@ -1,83 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
formats?: string[];
|
|
3
|
-
includeTags?: string[];
|
|
4
|
-
excludeTags?: string[];
|
|
5
|
-
headers?: Record<string, string>;
|
|
6
|
-
waitFor?: number;
|
|
7
|
-
timeout?: number;
|
|
8
|
-
}
|
|
9
|
-
interface ScrapeMetadata {
|
|
10
|
-
sourceURL?: string;
|
|
11
|
-
url?: string;
|
|
12
|
-
scrapeId?: string;
|
|
13
|
-
statusCode?: number;
|
|
14
|
-
title?: string;
|
|
15
|
-
description?: string;
|
|
16
|
-
language?: string;
|
|
17
|
-
favicon?: string;
|
|
18
|
-
viewport?: string;
|
|
19
|
-
robots?: string;
|
|
20
|
-
'theme-color'?: string;
|
|
21
|
-
'og:url'?: string;
|
|
22
|
-
'og:title'?: string;
|
|
23
|
-
'og:description'?: string;
|
|
24
|
-
'og:type'?: string;
|
|
25
|
-
'og:image'?: string;
|
|
26
|
-
'og:image:width'?: string;
|
|
27
|
-
'og:image:height'?: string;
|
|
28
|
-
'og:site_name'?: string;
|
|
29
|
-
ogUrl?: string;
|
|
30
|
-
ogTitle?: string;
|
|
31
|
-
ogDescription?: string;
|
|
32
|
-
ogImage?: string;
|
|
33
|
-
ogSiteName?: string;
|
|
34
|
-
'article:author'?: string;
|
|
35
|
-
'article:published_time'?: string;
|
|
36
|
-
'article:modified_time'?: string;
|
|
37
|
-
'article:section'?: string;
|
|
38
|
-
'article:tag'?: string;
|
|
39
|
-
'article:publisher'?: string;
|
|
40
|
-
publishedTime?: string;
|
|
41
|
-
modifiedTime?: string;
|
|
42
|
-
'twitter:site'?: string;
|
|
43
|
-
'twitter:creator'?: string;
|
|
44
|
-
'twitter:card'?: string;
|
|
45
|
-
'twitter:image'?: string;
|
|
46
|
-
'twitter:dnt'?: string;
|
|
47
|
-
'twitter:app:name:iphone'?: string;
|
|
48
|
-
'twitter:app:id:iphone'?: string;
|
|
49
|
-
'twitter:app:url:iphone'?: string;
|
|
50
|
-
'twitter:app:name:ipad'?: string;
|
|
51
|
-
'twitter:app:id:ipad'?: string;
|
|
52
|
-
'twitter:app:url:ipad'?: string;
|
|
53
|
-
'twitter:app:name:googleplay'?: string;
|
|
54
|
-
'twitter:app:id:googleplay'?: string;
|
|
55
|
-
'twitter:app:url:googleplay'?: string;
|
|
56
|
-
'fb:app_id'?: string;
|
|
57
|
-
'al:ios:url'?: string;
|
|
58
|
-
'al:ios:app_name'?: string;
|
|
59
|
-
'al:ios:app_store_id'?: string;
|
|
60
|
-
[key: string]: string | number | boolean | null | undefined;
|
|
61
|
-
}
|
|
62
|
-
export interface FirecrawlScrapeResponse {
|
|
63
|
-
success: boolean;
|
|
64
|
-
data?: {
|
|
65
|
-
markdown?: string;
|
|
66
|
-
html?: string;
|
|
67
|
-
rawHtml?: string;
|
|
68
|
-
screenshot?: string;
|
|
69
|
-
links?: string[];
|
|
70
|
-
metadata?: ScrapeMetadata;
|
|
71
|
-
};
|
|
72
|
-
error?: string;
|
|
73
|
-
}
|
|
74
|
-
export interface FirecrawlScraperConfig {
|
|
75
|
-
apiKey?: string;
|
|
76
|
-
apiUrl?: string;
|
|
77
|
-
formats?: string[];
|
|
78
|
-
timeout?: number;
|
|
79
|
-
}
|
|
80
|
-
export declare function getAttribution(link: string, metadata?: ScrapeMetadata): string | undefined;
|
|
1
|
+
import type * as t from './types';
|
|
81
2
|
/**
|
|
82
3
|
* Firecrawl scraper implementation
|
|
83
4
|
* Uses the Firecrawl API to scrape web pages
|
|
@@ -87,31 +8,30 @@ export declare class FirecrawlScraper {
|
|
|
87
8
|
private apiUrl;
|
|
88
9
|
private defaultFormats;
|
|
89
10
|
private timeout;
|
|
90
|
-
constructor(config?: FirecrawlScraperConfig);
|
|
11
|
+
constructor(config?: t.FirecrawlScraperConfig);
|
|
91
12
|
/**
|
|
92
13
|
* Scrape a single URL
|
|
93
14
|
* @param url URL to scrape
|
|
94
15
|
* @param options Scrape options
|
|
95
16
|
* @returns Scrape response
|
|
96
17
|
*/
|
|
97
|
-
scrapeUrl(url: string, options?: FirecrawlScrapeOptions): Promise<[string, FirecrawlScrapeResponse]>;
|
|
18
|
+
scrapeUrl(url: string, options?: t.FirecrawlScrapeOptions): Promise<[string, t.FirecrawlScrapeResponse]>;
|
|
98
19
|
/**
|
|
99
20
|
* Extract content from scrape response
|
|
100
21
|
* @param response Scrape response
|
|
101
22
|
* @returns Extracted content or empty string if not available
|
|
102
23
|
*/
|
|
103
|
-
extractContent(response: FirecrawlScrapeResponse): string;
|
|
24
|
+
extractContent(response: t.FirecrawlScrapeResponse): [string, undefined | t.References];
|
|
104
25
|
/**
|
|
105
26
|
* Extract metadata from scrape response
|
|
106
27
|
* @param response Scrape response
|
|
107
28
|
* @returns Metadata object
|
|
108
29
|
*/
|
|
109
|
-
extractMetadata(response: FirecrawlScrapeResponse): ScrapeMetadata;
|
|
30
|
+
extractMetadata(response: t.FirecrawlScrapeResponse): t.ScrapeMetadata;
|
|
110
31
|
}
|
|
111
32
|
/**
|
|
112
33
|
* Create a Firecrawl scraper instance
|
|
113
34
|
* @param config Scraper configuration
|
|
114
35
|
* @returns Firecrawl scraper instance
|
|
115
36
|
*/
|
|
116
|
-
export declare const createFirecrawlScraper: (config?: FirecrawlScraperConfig) => FirecrawlScraper;
|
|
117
|
-
export {};
|
|
37
|
+
export declare const createFirecrawlScraper: (config?: t.FirecrawlScraperConfig) => FirecrawlScraper;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import type * as t from './types';
|
|
2
|
-
export declare function formatResultsForLLM(turn: number, results: t.SearchResultData):
|
|
2
|
+
export declare function formatResultsForLLM(turn: number, results: t.SearchResultData): {
|
|
3
|
+
output: string;
|
|
4
|
+
references: t.ResultReference[];
|
|
5
|
+
};
|
|
@@ -8,6 +8,6 @@ import type * as t from './types';
|
|
|
8
8
|
* @param searchResults - Search results object
|
|
9
9
|
* @param mainExpandBy - Primary expansion size on each side (default: 300)
|
|
10
10
|
* @param separatorExpandBy - Additional range to look for separators (default: 150)
|
|
11
|
-
* @returns Copy of search results with expanded highlights
|
|
11
|
+
* @returns Copy of search results with expanded highlights and tracked references
|
|
12
12
|
*/
|
|
13
13
|
export declare function expandHighlights(searchResults: t.SearchResultData, mainExpandBy?: number, separatorExpandBy?: number): t.SearchResultData;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as t from './types';
|
|
2
2
|
import { FirecrawlScraper } from './firecrawl';
|
|
3
3
|
export declare const createSearchAPI: (config: t.SearchConfig) => {
|
|
4
|
-
getSources: (
|
|
4
|
+
getSources: (params: t.GetSourcesParams) => Promise<t.SearchResult>;
|
|
5
5
|
};
|
|
6
6
|
export declare const createSourceProcessor: (config?: t.ProcessSourcesConfig, scraperInstance?: FirecrawlScraper) => {
|
|
7
7
|
processSources: (result: t.SearchResult, numElements: number, query: string, proMode?: boolean) => Promise<t.SearchResultData>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
3
3
|
import type * as t from './types';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Creates a search tool with a schema that dynamically includes the country field
|
|
6
|
+
* only when the searchProvider is 'serper'.
|
|
7
|
+
*
|
|
8
|
+
* @param config - The search tool configuration
|
|
9
|
+
* @returns A DynamicStructuredTool with a schema that depends on the searchProvider
|
|
10
|
+
*/
|
|
11
|
+
export declare const createSearchTool: (config?: t.SearchToolConfig) => DynamicStructuredTool<z.ZodObject<{
|
|
5
12
|
query: z.ZodString;
|
|
13
|
+
country?: z.ZodOptional<z.ZodString>;
|
|
6
14
|
}, "strip", z.ZodTypeAny, {
|
|
7
15
|
query: string;
|
|
16
|
+
country?: unknown;
|
|
8
17
|
}, {
|
|
9
18
|
query: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export {};
|
|
19
|
+
country?: unknown;
|
|
20
|
+
}>>;
|
|
@@ -2,64 +2,41 @@ import type { RunnableConfig } from '@langchain/core/runnables';
|
|
|
2
2
|
import type { BaseReranker } from './rerankers';
|
|
3
3
|
export type SearchProvider = 'serper' | 'searxng';
|
|
4
4
|
export type RerankerType = 'infinity' | 'jina' | 'cohere' | 'none';
|
|
5
|
-
export interface OrganicResult {
|
|
6
|
-
position?: number;
|
|
7
|
-
title?: string;
|
|
8
|
-
link: string;
|
|
9
|
-
snippet?: string;
|
|
10
|
-
date?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface TopStoryResult {
|
|
13
|
-
title?: string;
|
|
14
|
-
link: string;
|
|
15
|
-
source?: string;
|
|
16
|
-
date?: string;
|
|
17
|
-
imageUrl?: string;
|
|
18
|
-
}
|
|
19
|
-
export interface ImageResult {
|
|
20
|
-
title?: string;
|
|
21
|
-
imageUrl?: string;
|
|
22
|
-
}
|
|
23
|
-
export interface KnowledgeGraphResult {
|
|
24
|
-
title?: string;
|
|
25
|
-
type?: string;
|
|
26
|
-
description?: string;
|
|
27
|
-
attributes?: Record<string, string>;
|
|
28
|
-
imageUrl?: string;
|
|
29
|
-
}
|
|
30
|
-
export interface AnswerBoxResult {
|
|
31
|
-
title?: string;
|
|
32
|
-
answer?: string;
|
|
33
|
-
snippet?: string;
|
|
34
|
-
date?: string;
|
|
35
|
-
}
|
|
36
|
-
export interface PeopleAlsoAskResult {
|
|
37
|
-
question?: string;
|
|
38
|
-
answer?: string;
|
|
39
|
-
}
|
|
40
5
|
export interface Highlight {
|
|
41
6
|
score: number;
|
|
42
7
|
text: string;
|
|
8
|
+
references?: UsedReferences;
|
|
43
9
|
}
|
|
44
|
-
export
|
|
45
|
-
link: string;
|
|
46
|
-
position?: number;
|
|
47
|
-
title?: string;
|
|
48
|
-
snippet?: string;
|
|
49
|
-
date?: string;
|
|
10
|
+
export type ProcessedSource = {
|
|
50
11
|
content?: string;
|
|
51
12
|
attribution?: string;
|
|
13
|
+
references?: References;
|
|
52
14
|
highlights?: Highlight[];
|
|
53
|
-
}
|
|
15
|
+
};
|
|
16
|
+
export type ProcessedOrganic = OrganicResult & ProcessedSource;
|
|
17
|
+
export type ProcessedTopStory = TopStoryResult & ProcessedSource;
|
|
18
|
+
export type ValidSource = ProcessedOrganic | ProcessedTopStory;
|
|
19
|
+
export type ResultReference = {
|
|
20
|
+
link: string;
|
|
21
|
+
title?: string;
|
|
22
|
+
attribution?: string;
|
|
23
|
+
};
|
|
54
24
|
export interface SearchResultData {
|
|
55
|
-
|
|
56
|
-
|
|
25
|
+
turn?: number;
|
|
26
|
+
organic?: ProcessedOrganic[];
|
|
27
|
+
topStories?: ProcessedTopStory[];
|
|
57
28
|
images?: ImageResult[];
|
|
29
|
+
videos?: VideoResult[];
|
|
30
|
+
places?: PlaceResult[];
|
|
31
|
+
news?: NewsResult[];
|
|
32
|
+
shopping?: ShoppingResult[];
|
|
58
33
|
knowledgeGraph?: KnowledgeGraphResult;
|
|
59
34
|
answerBox?: AnswerBoxResult;
|
|
60
35
|
peopleAlsoAsk?: PeopleAlsoAskResult[];
|
|
61
|
-
relatedSearches?:
|
|
62
|
-
|
|
36
|
+
relatedSearches?: Array<{
|
|
37
|
+
query: string;
|
|
38
|
+
}>;
|
|
39
|
+
references?: ResultReference[];
|
|
63
40
|
error?: string;
|
|
64
41
|
}
|
|
65
42
|
export interface SearchResult {
|
|
@@ -80,11 +57,17 @@ export interface SearchConfig {
|
|
|
80
57
|
searxngInstanceUrl?: string;
|
|
81
58
|
searxngApiKey?: string;
|
|
82
59
|
}
|
|
60
|
+
export type References = {
|
|
61
|
+
links: MediaReference[];
|
|
62
|
+
images: MediaReference[];
|
|
63
|
+
videos: MediaReference[];
|
|
64
|
+
};
|
|
83
65
|
export interface ScrapeResult {
|
|
84
66
|
url: string;
|
|
85
67
|
error?: boolean;
|
|
86
68
|
content: string;
|
|
87
69
|
attribution?: string;
|
|
70
|
+
references?: References;
|
|
88
71
|
highlights?: Highlight[];
|
|
89
72
|
}
|
|
90
73
|
export interface ProcessSourcesConfig {
|
|
@@ -104,13 +87,6 @@ export interface ScraperContentResult {
|
|
|
104
87
|
export interface ScraperExtractionResult {
|
|
105
88
|
no_extraction: ScraperContentResult;
|
|
106
89
|
}
|
|
107
|
-
export interface SearXNGResult {
|
|
108
|
-
title?: string;
|
|
109
|
-
url?: string;
|
|
110
|
-
content?: string;
|
|
111
|
-
publishedDate?: string;
|
|
112
|
-
img_src?: string;
|
|
113
|
-
}
|
|
114
90
|
export interface JinaRerankerResult {
|
|
115
91
|
index: number;
|
|
116
92
|
relevance_score: number;
|
|
@@ -148,3 +124,362 @@ export interface SearchToolConfig extends SearchConfig, ProcessSourcesConfig, Fi
|
|
|
148
124
|
rerankerType?: RerankerType;
|
|
149
125
|
onSearchResults?: (results: SearchResult, runnableConfig?: RunnableConfig) => void;
|
|
150
126
|
}
|
|
127
|
+
export interface MediaReference {
|
|
128
|
+
originalUrl: string;
|
|
129
|
+
title?: string;
|
|
130
|
+
text?: string;
|
|
131
|
+
}
|
|
132
|
+
export type UsedReferences = {
|
|
133
|
+
type: 'link' | 'image' | 'video';
|
|
134
|
+
originalIndex: number;
|
|
135
|
+
reference: MediaReference;
|
|
136
|
+
}[];
|
|
137
|
+
/** Firecrawl */
|
|
138
|
+
export interface FirecrawlScrapeOptions {
|
|
139
|
+
formats?: string[];
|
|
140
|
+
includeTags?: string[];
|
|
141
|
+
excludeTags?: string[];
|
|
142
|
+
headers?: Record<string, string>;
|
|
143
|
+
waitFor?: number;
|
|
144
|
+
timeout?: number;
|
|
145
|
+
}
|
|
146
|
+
export interface ScrapeMetadata {
|
|
147
|
+
sourceURL?: string;
|
|
148
|
+
url?: string;
|
|
149
|
+
scrapeId?: string;
|
|
150
|
+
statusCode?: number;
|
|
151
|
+
title?: string;
|
|
152
|
+
description?: string;
|
|
153
|
+
language?: string;
|
|
154
|
+
favicon?: string;
|
|
155
|
+
viewport?: string;
|
|
156
|
+
robots?: string;
|
|
157
|
+
'theme-color'?: string;
|
|
158
|
+
'og:url'?: string;
|
|
159
|
+
'og:title'?: string;
|
|
160
|
+
'og:description'?: string;
|
|
161
|
+
'og:type'?: string;
|
|
162
|
+
'og:image'?: string;
|
|
163
|
+
'og:image:width'?: string;
|
|
164
|
+
'og:image:height'?: string;
|
|
165
|
+
'og:site_name'?: string;
|
|
166
|
+
ogUrl?: string;
|
|
167
|
+
ogTitle?: string;
|
|
168
|
+
ogDescription?: string;
|
|
169
|
+
ogImage?: string;
|
|
170
|
+
ogSiteName?: string;
|
|
171
|
+
'article:author'?: string;
|
|
172
|
+
'article:published_time'?: string;
|
|
173
|
+
'article:modified_time'?: string;
|
|
174
|
+
'article:section'?: string;
|
|
175
|
+
'article:tag'?: string;
|
|
176
|
+
'article:publisher'?: string;
|
|
177
|
+
publishedTime?: string;
|
|
178
|
+
modifiedTime?: string;
|
|
179
|
+
'twitter:site'?: string;
|
|
180
|
+
'twitter:creator'?: string;
|
|
181
|
+
'twitter:card'?: string;
|
|
182
|
+
'twitter:image'?: string;
|
|
183
|
+
'twitter:dnt'?: string;
|
|
184
|
+
'twitter:app:name:iphone'?: string;
|
|
185
|
+
'twitter:app:id:iphone'?: string;
|
|
186
|
+
'twitter:app:url:iphone'?: string;
|
|
187
|
+
'twitter:app:name:ipad'?: string;
|
|
188
|
+
'twitter:app:id:ipad'?: string;
|
|
189
|
+
'twitter:app:url:ipad'?: string;
|
|
190
|
+
'twitter:app:name:googleplay'?: string;
|
|
191
|
+
'twitter:app:id:googleplay'?: string;
|
|
192
|
+
'twitter:app:url:googleplay'?: string;
|
|
193
|
+
'fb:app_id'?: string;
|
|
194
|
+
'al:ios:url'?: string;
|
|
195
|
+
'al:ios:app_name'?: string;
|
|
196
|
+
'al:ios:app_store_id'?: string;
|
|
197
|
+
[key: string]: string | number | boolean | null | undefined;
|
|
198
|
+
}
|
|
199
|
+
export interface FirecrawlScrapeResponse {
|
|
200
|
+
success: boolean;
|
|
201
|
+
data?: {
|
|
202
|
+
markdown?: string;
|
|
203
|
+
html?: string;
|
|
204
|
+
rawHtml?: string;
|
|
205
|
+
screenshot?: string;
|
|
206
|
+
links?: string[];
|
|
207
|
+
metadata?: ScrapeMetadata;
|
|
208
|
+
};
|
|
209
|
+
error?: string;
|
|
210
|
+
}
|
|
211
|
+
export interface FirecrawlScraperConfig {
|
|
212
|
+
apiKey?: string;
|
|
213
|
+
apiUrl?: string;
|
|
214
|
+
formats?: string[];
|
|
215
|
+
timeout?: number;
|
|
216
|
+
}
|
|
217
|
+
export type GetSourcesParams = {
|
|
218
|
+
query: string;
|
|
219
|
+
country?: string;
|
|
220
|
+
numResults?: number;
|
|
221
|
+
};
|
|
222
|
+
/** Serper API */
|
|
223
|
+
export interface VideoResult {
|
|
224
|
+
title?: string;
|
|
225
|
+
link?: string;
|
|
226
|
+
snippet?: string;
|
|
227
|
+
imageUrl?: string;
|
|
228
|
+
duration?: string;
|
|
229
|
+
source?: string;
|
|
230
|
+
channel?: string;
|
|
231
|
+
date?: string;
|
|
232
|
+
position?: number;
|
|
233
|
+
}
|
|
234
|
+
export interface PlaceResult {
|
|
235
|
+
position?: number;
|
|
236
|
+
name?: string;
|
|
237
|
+
address?: string;
|
|
238
|
+
latitude?: number;
|
|
239
|
+
longitude?: number;
|
|
240
|
+
rating?: number;
|
|
241
|
+
ratingCount?: number;
|
|
242
|
+
category?: string;
|
|
243
|
+
identifier?: string;
|
|
244
|
+
}
|
|
245
|
+
export interface NewsResult {
|
|
246
|
+
title?: string;
|
|
247
|
+
link?: string;
|
|
248
|
+
snippet?: string;
|
|
249
|
+
date?: string;
|
|
250
|
+
source?: string;
|
|
251
|
+
imageUrl?: string;
|
|
252
|
+
position?: number;
|
|
253
|
+
}
|
|
254
|
+
export interface ShoppingResult {
|
|
255
|
+
title?: string;
|
|
256
|
+
source?: string;
|
|
257
|
+
link?: string;
|
|
258
|
+
price?: string;
|
|
259
|
+
delivery?: string;
|
|
260
|
+
imageUrl?: string;
|
|
261
|
+
rating?: number;
|
|
262
|
+
ratingCount?: number;
|
|
263
|
+
offers?: string;
|
|
264
|
+
productId?: string;
|
|
265
|
+
position?: number;
|
|
266
|
+
}
|
|
267
|
+
export interface ScholarResult {
|
|
268
|
+
title?: string;
|
|
269
|
+
link?: string;
|
|
270
|
+
publicationInfo?: string;
|
|
271
|
+
snippet?: string;
|
|
272
|
+
year?: number;
|
|
273
|
+
citedBy?: number;
|
|
274
|
+
}
|
|
275
|
+
export interface ImageResult {
|
|
276
|
+
title?: string;
|
|
277
|
+
imageUrl?: string;
|
|
278
|
+
imageWidth?: number;
|
|
279
|
+
imageHeight?: number;
|
|
280
|
+
thumbnailUrl?: string;
|
|
281
|
+
thumbnailWidth?: number;
|
|
282
|
+
thumbnailHeight?: number;
|
|
283
|
+
source?: string;
|
|
284
|
+
domain?: string;
|
|
285
|
+
link?: string;
|
|
286
|
+
googleUrl?: string;
|
|
287
|
+
position?: number;
|
|
288
|
+
}
|
|
289
|
+
export interface SerperSearchPayload extends SerperSearchInput {
|
|
290
|
+
/**
|
|
291
|
+
* Search type/vertical
|
|
292
|
+
* Options: "search" (web), "images", "news", "places", "videos"
|
|
293
|
+
*/
|
|
294
|
+
type?: 'search' | 'images' | 'news' | 'places' | 'videos';
|
|
295
|
+
/**
|
|
296
|
+
* Starting index for search results pagination (used instead of page)
|
|
297
|
+
*/
|
|
298
|
+
start?: number;
|
|
299
|
+
/**
|
|
300
|
+
* Filtering for safe search
|
|
301
|
+
* Options: "off", "moderate", "active"
|
|
302
|
+
*/
|
|
303
|
+
safe?: 'off' | 'moderate' | 'active';
|
|
304
|
+
}
|
|
305
|
+
export type SerperSearchParameters = Pick<SerperSearchPayload, 'q' | 'type'> & {
|
|
306
|
+
engine: 'google';
|
|
307
|
+
};
|
|
308
|
+
export interface OrganicResult {
|
|
309
|
+
position?: number;
|
|
310
|
+
title?: string;
|
|
311
|
+
link: string;
|
|
312
|
+
snippet?: string;
|
|
313
|
+
date?: string;
|
|
314
|
+
sitelinks?: Array<{
|
|
315
|
+
title: string;
|
|
316
|
+
link: string;
|
|
317
|
+
}>;
|
|
318
|
+
}
|
|
319
|
+
export interface TopStoryResult {
|
|
320
|
+
title?: string;
|
|
321
|
+
link: string;
|
|
322
|
+
source?: string;
|
|
323
|
+
date?: string;
|
|
324
|
+
imageUrl?: string;
|
|
325
|
+
}
|
|
326
|
+
export interface KnowledgeGraphResult {
|
|
327
|
+
title?: string;
|
|
328
|
+
type?: string;
|
|
329
|
+
imageUrl?: string;
|
|
330
|
+
description?: string;
|
|
331
|
+
descriptionSource?: string;
|
|
332
|
+
descriptionLink?: string;
|
|
333
|
+
attributes?: Record<string, string>;
|
|
334
|
+
website?: string;
|
|
335
|
+
}
|
|
336
|
+
export interface AnswerBoxResult {
|
|
337
|
+
title?: string;
|
|
338
|
+
snippet?: string;
|
|
339
|
+
snippetHighlighted?: string[];
|
|
340
|
+
link?: string;
|
|
341
|
+
date?: string;
|
|
342
|
+
}
|
|
343
|
+
export interface PeopleAlsoAskResult {
|
|
344
|
+
question?: string;
|
|
345
|
+
snippet?: string;
|
|
346
|
+
title?: string;
|
|
347
|
+
link?: string;
|
|
348
|
+
}
|
|
349
|
+
export type RelatedSearches = Array<{
|
|
350
|
+
query: string;
|
|
351
|
+
}>;
|
|
352
|
+
export interface SerperSearchInput {
|
|
353
|
+
/**
|
|
354
|
+
* The search query string
|
|
355
|
+
*/
|
|
356
|
+
q: string;
|
|
357
|
+
/**
|
|
358
|
+
* Country code for localized results
|
|
359
|
+
* Examples: "us", "uk", "ca", "de", etc.
|
|
360
|
+
*/
|
|
361
|
+
gl?: string;
|
|
362
|
+
/**
|
|
363
|
+
* Interface language
|
|
364
|
+
* Examples: "en", "fr", "de", etc.
|
|
365
|
+
*/
|
|
366
|
+
hl?: string;
|
|
367
|
+
/**
|
|
368
|
+
* Number of results to return (up to 100)
|
|
369
|
+
*/
|
|
370
|
+
num?: number;
|
|
371
|
+
/**
|
|
372
|
+
* Specific location for contextual results
|
|
373
|
+
* Example: "New York, NY"
|
|
374
|
+
*/
|
|
375
|
+
location?: string;
|
|
376
|
+
/**
|
|
377
|
+
* Search autocorrection setting
|
|
378
|
+
*/
|
|
379
|
+
autocorrect?: boolean;
|
|
380
|
+
page?: number;
|
|
381
|
+
}
|
|
382
|
+
export type SerperResultData = {
|
|
383
|
+
searchParameters: SerperSearchPayload;
|
|
384
|
+
organic?: OrganicResult[];
|
|
385
|
+
topStories?: TopStoryResult[];
|
|
386
|
+
images?: ImageResult[];
|
|
387
|
+
videos?: VideoResult[];
|
|
388
|
+
places?: PlaceResult[];
|
|
389
|
+
news?: NewsResult[];
|
|
390
|
+
shopping?: ShoppingResult[];
|
|
391
|
+
peopleAlsoAsk?: PeopleAlsoAskResult[];
|
|
392
|
+
relatedSearches?: RelatedSearches;
|
|
393
|
+
knowledgeGraph?: KnowledgeGraphResult;
|
|
394
|
+
answerBox?: AnswerBoxResult;
|
|
395
|
+
credits?: number;
|
|
396
|
+
};
|
|
397
|
+
/** SearXNG */
|
|
398
|
+
export interface SearxNGSearchPayload {
|
|
399
|
+
/**
|
|
400
|
+
* The search query string
|
|
401
|
+
* Supports syntax specific to different search engines
|
|
402
|
+
* Example: "site:github.com SearXNG"
|
|
403
|
+
*/
|
|
404
|
+
q: string;
|
|
405
|
+
/**
|
|
406
|
+
* Comma-separated list of search categories
|
|
407
|
+
* Example: "general,images,news"
|
|
408
|
+
*/
|
|
409
|
+
categories?: string;
|
|
410
|
+
/**
|
|
411
|
+
* Comma-separated list of search engines to use
|
|
412
|
+
* Example: "google,bing,duckduckgo"
|
|
413
|
+
*/
|
|
414
|
+
engines?: string;
|
|
415
|
+
/**
|
|
416
|
+
* Code of the language for search results
|
|
417
|
+
* Example: "en", "fr", "de", "es"
|
|
418
|
+
*/
|
|
419
|
+
language?: string;
|
|
420
|
+
/**
|
|
421
|
+
* Search page number
|
|
422
|
+
* Default: 1
|
|
423
|
+
*/
|
|
424
|
+
pageno?: number;
|
|
425
|
+
/**
|
|
426
|
+
* Time range filter for search results
|
|
427
|
+
* Options: "day", "month", "year"
|
|
428
|
+
*/
|
|
429
|
+
time_range?: 'day' | 'month' | 'year';
|
|
430
|
+
/**
|
|
431
|
+
* Output format of results
|
|
432
|
+
* Options: "json", "csv", "rss"
|
|
433
|
+
*/
|
|
434
|
+
format?: 'json' | 'csv' | 'rss';
|
|
435
|
+
/**
|
|
436
|
+
* Open search results on new tab
|
|
437
|
+
* Options: `0` (off), `1` (on)
|
|
438
|
+
*/
|
|
439
|
+
results_on_new_tab?: 0 | 1;
|
|
440
|
+
/**
|
|
441
|
+
* Proxy image results through SearxNG
|
|
442
|
+
* Options: true, false
|
|
443
|
+
*/
|
|
444
|
+
image_proxy?: boolean;
|
|
445
|
+
/**
|
|
446
|
+
* Service for autocomplete suggestions
|
|
447
|
+
* Options: "google", "dbpedia", "duckduckgo", "mwmbl",
|
|
448
|
+
* "startpage", "wikipedia", "stract", "swisscows", "qwant"
|
|
449
|
+
*/
|
|
450
|
+
autocomplete?: string;
|
|
451
|
+
/**
|
|
452
|
+
* Safe search filtering level
|
|
453
|
+
* Options: "0" (off), "1" (moderate), "2" (strict)
|
|
454
|
+
*/
|
|
455
|
+
safesearch?: 0 | 1 | 2;
|
|
456
|
+
/**
|
|
457
|
+
* Theme to use for results page
|
|
458
|
+
* Default: "simple" (other themes may be available per instance)
|
|
459
|
+
*/
|
|
460
|
+
theme?: string;
|
|
461
|
+
/**
|
|
462
|
+
* List of enabled plugins
|
|
463
|
+
* Default: "Hash_plugin,Self_Information,Tracker_URL_remover,Ahmia_blacklist"
|
|
464
|
+
*/
|
|
465
|
+
enabled_plugins?: string;
|
|
466
|
+
/**
|
|
467
|
+
* List of disabled plugins
|
|
468
|
+
*/
|
|
469
|
+
disabled_plugins?: string;
|
|
470
|
+
/**
|
|
471
|
+
* List of enabled engines
|
|
472
|
+
*/
|
|
473
|
+
enabled_engines?: string;
|
|
474
|
+
/**
|
|
475
|
+
* List of disabled engines
|
|
476
|
+
*/
|
|
477
|
+
disabled_engines?: string;
|
|
478
|
+
}
|
|
479
|
+
export interface SearXNGResult {
|
|
480
|
+
title?: string;
|
|
481
|
+
url?: string;
|
|
482
|
+
content?: string;
|
|
483
|
+
publishedDate?: string;
|
|
484
|
+
img_src?: string;
|
|
485
|
+
}
|