Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/docs/content/docs/integrations/tavily.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Perform AI-powered web searches using Tavily's search API. Returns structured re
| ↳ `content` | string | Brief description or content snippet |
| ↳ `score` | number | Relevance score |
| ↳ `raw_content` | string | Full parsed HTML content \(if requested\) |
| ↳ `published_date` | string | Source publication or update date estimated by Tavily, when available |
| ↳ `favicon` | string | Favicon URL for the domain |
| `answer` | string | LLM-generated answer to the query \(if requested\) |
| `images` | array | Query-related images \(if requested\) |
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/tools/generated/tool-outputs.ts

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions apps/sim/tools/tavily/search.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { jsonResponse } from '@sim/testing'
import { expect, it } from 'vitest'
import { isPathInSchema } from '@/executor/utils/block-reference'
import { searchTool } from '@/tools/tavily/search'

it('makes the source date from a news result available to downstream blocks', async () => {
if (!searchTool.transformResponse) throw new Error('Missing response transform')
const article = { title: 'Bulletin', url: 'https://example.com/bulletin', content: 'Update' }
const date = 'Tue, 11 Mar 2025 17:00:00 GMT'
const result = await searchTool.transformResponse(
jsonResponse({
results: [
{ ...article, published_date: date },
{ ...article, published_date: null },
article,
],
})
)

expect(result.output.results).toStrictEqual([
{ ...article, published_date: date },
article,
article,
])
expect(isPathInSchema(searchTool.outputs, ['results[0]', 'published_date'])).toBe(true)
})
1 change: 1 addition & 0 deletions apps/sim/tools/tavily/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ export const searchTool: ToolConfig<TavilySearchParams, TavilySearchResponse> =
content: result.content,
...(result.score !== undefined && { score: result.score }),
...(result.raw_content && { raw_content: result.raw_content }),
...(result.published_date && { published_date: result.published_date }),
...(result.favicon && { favicon: result.favicon }),
})),
...(data.answer && { answer: data.answer }),
Expand Down
6 changes: 6 additions & 0 deletions apps/sim/tools/tavily/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export const TAVILY_SEARCH_RESULT_OUTPUT_PROPERTIES = {
description: 'Full parsed HTML content (if requested)',
optional: true,
},
published_date: {
type: 'string',
description: 'Source publication or update date estimated by Tavily, when available',
optional: true,
},
favicon: { type: 'string', description: 'Favicon URL for the domain', optional: true },
} as const satisfies Record<string, OutputProperty>

Expand Down Expand Up @@ -73,6 +78,7 @@ interface TavilySearchResult {
url: string
content: string
score?: number
published_date?: string
raw_content?: string
favicon?: string
}
Expand Down