mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
feat(exa): add date filters to search (#4451)
This commit is contained in:
@@ -54,6 +54,10 @@ Search the web using Exa AI. Returns relevant search results with titles, URLs,
|
||||
| `highlights` | boolean | No | Include highlighted snippets in results \(default: false\) |
|
||||
| `summary` | boolean | No | Include AI-generated summaries in results \(default: false\) |
|
||||
| `livecrawl` | string | No | Live crawling mode: never \(default\), fallback, always, or preferred \(always try livecrawl, fall back to cache if fails\) |
|
||||
| `startCrawlDate` | string | No | Only include results crawled on or after this ISO 8601 date \(e.g., "2024-01-01" or "2024-01-01T00:00:00.000Z"\) |
|
||||
| `endCrawlDate` | string | No | Only include results crawled on or before this ISO 8601 date |
|
||||
| `startPublishedDate` | string | No | Only include results published on or after this ISO 8601 date |
|
||||
| `endPublishedDate` | string | No | Only include results published on or before this ISO 8601 date |
|
||||
| `apiKey` | string | Yes | Exa AI API Key |
|
||||
| `pricing` | custom | No | No description |
|
||||
| `metadata` | string | No | No description |
|
||||
|
||||
@@ -136,6 +136,38 @@ export const ExaBlock: BlockConfig<ExaResponse> = {
|
||||
condition: { field: 'operation', value: 'exa_search' },
|
||||
mode: 'advanced',
|
||||
},
|
||||
{
|
||||
id: 'startPublishedDate',
|
||||
title: 'Start Published Date',
|
||||
type: 'short-input',
|
||||
placeholder: '2024-01-01 or 2024-01-01T00:00:00.000Z',
|
||||
condition: { field: 'operation', value: 'exa_search' },
|
||||
mode: 'advanced',
|
||||
},
|
||||
{
|
||||
id: 'endPublishedDate',
|
||||
title: 'End Published Date',
|
||||
type: 'short-input',
|
||||
placeholder: '2024-12-31 or 2024-12-31T23:59:59.999Z',
|
||||
condition: { field: 'operation', value: 'exa_search' },
|
||||
mode: 'advanced',
|
||||
},
|
||||
{
|
||||
id: 'startCrawlDate',
|
||||
title: 'Start Crawl Date',
|
||||
type: 'short-input',
|
||||
placeholder: '2024-01-01 or 2024-01-01T00:00:00.000Z',
|
||||
condition: { field: 'operation', value: 'exa_search' },
|
||||
mode: 'advanced',
|
||||
},
|
||||
{
|
||||
id: 'endCrawlDate',
|
||||
title: 'End Crawl Date',
|
||||
type: 'short-input',
|
||||
placeholder: '2024-12-31 or 2024-12-31T23:59:59.999Z',
|
||||
condition: { field: 'operation', value: 'exa_search' },
|
||||
mode: 'advanced',
|
||||
},
|
||||
// Get Contents operation inputs
|
||||
{
|
||||
id: 'urls',
|
||||
@@ -385,6 +417,10 @@ export const ExaBlock: BlockConfig<ExaResponse> = {
|
||||
highlights: { type: 'boolean', description: 'Include highlights' },
|
||||
summary: { type: 'boolean', description: 'Include summary' },
|
||||
livecrawl: { type: 'string', description: 'Live crawl mode' },
|
||||
startCrawlDate: { type: 'string', description: 'Earliest crawl date (ISO 8601)' },
|
||||
endCrawlDate: { type: 'string', description: 'Latest crawl date (ISO 8601)' },
|
||||
startPublishedDate: { type: 'string', description: 'Earliest published date (ISO 8601)' },
|
||||
endPublishedDate: { type: 'string', description: 'Latest published date (ISO 8601)' },
|
||||
// Get Contents operation
|
||||
urls: { type: 'string', description: 'URLs to retrieve' },
|
||||
summaryQuery: { type: 'string', description: 'Summary query guidance' },
|
||||
|
||||
@@ -79,6 +79,31 @@ export const searchTool: ToolConfig<ExaSearchParams, ExaSearchResponse> = {
|
||||
description:
|
||||
'Live crawling mode: never (default), fallback, always, or preferred (always try livecrawl, fall back to cache if fails)',
|
||||
},
|
||||
startCrawlDate: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Only include results crawled on or after this ISO 8601 date (e.g., "2024-01-01" or "2024-01-01T00:00:00.000Z")',
|
||||
},
|
||||
endCrawlDate: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Only include results crawled on or before this ISO 8601 date',
|
||||
},
|
||||
startPublishedDate: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Only include results published on or after this ISO 8601 date',
|
||||
},
|
||||
endPublishedDate: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Only include results published on or before this ISO 8601 date',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
@@ -140,6 +165,12 @@ export const searchTool: ToolConfig<ExaSearchParams, ExaSearchResponse> = {
|
||||
// Category filtering
|
||||
if (params.category) body.category = params.category
|
||||
|
||||
// Date filtering
|
||||
if (params.startCrawlDate) body.startCrawlDate = params.startCrawlDate
|
||||
if (params.endCrawlDate) body.endCrawlDate = params.endCrawlDate
|
||||
if (params.startPublishedDate) body.startPublishedDate = params.startPublishedDate
|
||||
if (params.endPublishedDate) body.endPublishedDate = params.endPublishedDate
|
||||
|
||||
// Build contents object for content options
|
||||
const contents: Record<string, any> = {}
|
||||
|
||||
|
||||
@@ -37,6 +37,11 @@ export interface ExaSearchParams extends ExaBaseParams {
|
||||
summary?: boolean | { query?: string }
|
||||
// Live crawl mode
|
||||
livecrawl?: 'always' | 'fallback' | 'never'
|
||||
// Date filters (ISO 8601)
|
||||
startCrawlDate?: string
|
||||
endCrawlDate?: string
|
||||
startPublishedDate?: string
|
||||
endPublishedDate?: string
|
||||
}
|
||||
|
||||
export interface ExaSearchResult {
|
||||
|
||||
Reference in New Issue
Block a user