chore: import upstream snapshot with attribution
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:20:55 +08:00
commit d25d482dc2
13754 changed files with 4996608 additions and 0 deletions
+106
View File
@@ -0,0 +1,106 @@
import type { ExaAnswerParams, ExaAnswerResponse } from '@/tools/exa/types'
import type { ToolConfig } from '@/tools/types'
export const answerTool: ToolConfig<ExaAnswerParams, ExaAnswerResponse> = {
id: 'exa_answer',
name: 'Exa Answer',
description: 'Get an AI-generated answer to a question with citations from the web using Exa AI.',
version: '1.0.0',
params: {
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The question to answer',
},
text: {
type: 'boolean',
required: false,
visibility: 'user-only',
description: 'Whether to include the full text of the answer',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Exa AI API Key',
},
},
hosting: {
envKeyPrefix: 'EXA_API_KEY',
apiKeyParam: 'apiKey',
byokProviderId: 'exa',
pricing: {
type: 'custom',
getCost: (_params, output) => {
const costDollars = output.__costDollars as { total?: number } | undefined
if (costDollars?.total == null) {
throw new Error('Exa answer response missing costDollars field')
}
return { cost: costDollars.total, metadata: { costDollars } }
},
},
rateLimit: {
mode: 'per_request',
requestsPerMinute: 5,
},
},
request: {
url: 'https://api.exa.ai/answer',
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
'x-api-key': params.apiKey,
}),
body: (params) => {
const body: Record<string, any> = {
query: params.query,
}
// Add optional parameters if provided
if (params.text) body.text = params.text
return body
},
},
transformResponse: async (response: Response) => {
const data = await response.json()
return {
success: true,
output: {
query: data.query || '',
answer: data.answer || '',
citations:
data.citations?.map((citation: any) => ({
title: citation.title || '',
url: citation.url,
text: citation.text || '',
})) || [],
__costDollars: data.costDollars,
},
}
},
outputs: {
answer: {
type: 'string',
description: 'AI-generated answer to the question',
},
citations: {
type: 'array',
description: 'Sources and citations for the answer',
items: {
type: 'object',
properties: {
title: { type: 'string', description: 'The title of the cited source' },
url: { type: 'string', description: 'The URL of the cited source' },
text: { type: 'string', description: 'Relevant text from the cited source' },
},
},
},
},
}
+188
View File
@@ -0,0 +1,188 @@
import type { ExaFindSimilarLinksParams, ExaFindSimilarLinksResponse } from '@/tools/exa/types'
import type { ToolConfig } from '@/tools/types'
export const findSimilarLinksTool: ToolConfig<
ExaFindSimilarLinksParams,
ExaFindSimilarLinksResponse
> = {
id: 'exa_find_similar_links',
name: 'Exa Find Similar Links',
description:
'Find webpages similar to a given URL using Exa AI. Returns a list of similar links with titles and text snippets.',
version: '1.0.0',
params: {
url: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The URL to find similar links for',
},
numResults: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of similar links to return (e.g., 5, 10, 25). Default: 10, max: 25',
},
text: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Whether to include the full text of the similar pages',
},
includeDomains: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of domains to include in results (e.g., "github.com, stackoverflow.com")',
},
excludeDomains: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of domains to exclude from results (e.g., "reddit.com, pinterest.com")',
},
excludeSourceDomain: {
type: 'boolean',
required: false,
visibility: 'user-only',
description: 'Exclude the source domain from results (default: false)',
},
highlights: {
type: 'boolean',
required: false,
visibility: 'user-only',
description: 'Include highlighted snippets in results (default: false)',
},
summary: {
type: 'boolean',
required: false,
visibility: 'user-only',
description: 'Include AI-generated summaries in results (default: false)',
},
livecrawl: {
type: 'string',
required: false,
visibility: 'user-only',
description:
'Live crawling mode: never (default), fallback, always, or preferred (always try livecrawl, fall back to cache if fails)',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Exa AI API Key',
},
},
hosting: {
envKeyPrefix: 'EXA_API_KEY',
apiKeyParam: 'apiKey',
byokProviderId: 'exa',
pricing: {
type: 'custom',
getCost: (_params, output) => {
const costDollars = output.__costDollars as { total?: number } | undefined
if (costDollars?.total == null) {
throw new Error('Exa find_similar_links response missing costDollars field')
}
return { cost: costDollars.total, metadata: { costDollars } }
},
},
rateLimit: {
mode: 'per_request',
requestsPerMinute: 10,
},
},
request: {
url: 'https://api.exa.ai/findSimilar',
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
'x-api-key': params.apiKey,
}),
body: (params) => {
const body: Record<string, any> = {
url: params.url,
}
// Add optional parameters if provided
if (params.numResults) body.numResults = Number(params.numResults)
// Domain filtering
if (params.includeDomains) {
body.includeDomains = params.includeDomains
.split(',')
.map((d: string) => d.trim())
.filter((d: string) => d.length > 0)
}
if (params.excludeDomains) {
body.excludeDomains = params.excludeDomains
.split(',')
.map((d: string) => d.trim())
.filter((d: string) => d.length > 0)
}
if (params.excludeSourceDomain !== undefined) {
body.excludeSourceDomain = params.excludeSourceDomain
}
// Content options - build contents object
const contents: Record<string, any> = {}
if (params.text !== undefined) contents.text = params.text
if (params.highlights !== undefined) contents.highlights = params.highlights
if (params.summary !== undefined) contents.summary = params.summary
// Live crawl mode should be inside contents
if (params.livecrawl) contents.livecrawl = params.livecrawl
if (Object.keys(contents).length > 0) {
body.contents = contents
}
return body
},
},
transformResponse: async (response: Response) => {
const data = await response.json()
return {
success: true,
output: {
similarLinks: data.results.map((result: any) => ({
title: result.title || '',
url: result.url,
text: result.text || '',
summary: result.summary,
highlights: result.highlights,
score: result.score || 0,
})),
__costDollars: data.costDollars,
},
}
},
outputs: {
similarLinks: {
type: 'array',
description: 'Similar links found with titles, URLs, and text snippets',
items: {
type: 'object',
properties: {
title: { type: 'string', description: 'The title of the similar webpage' },
url: { type: 'string', description: 'The URL of the similar webpage' },
text: {
type: 'string',
description: 'Text snippet or full content from the similar webpage',
},
score: {
type: 'number',
description: 'Similarity score indicating how similar the page is',
},
},
},
},
},
}
+174
View File
@@ -0,0 +1,174 @@
import type { ExaGetContentsParams, ExaGetContentsResponse } from '@/tools/exa/types'
import type { ToolConfig } from '@/tools/types'
export const getContentsTool: ToolConfig<ExaGetContentsParams, ExaGetContentsResponse> = {
id: 'exa_get_contents',
name: 'Exa Get Contents',
description:
'Retrieve the contents of webpages using Exa AI. Returns the title, text content, and optional summaries for each URL.',
version: '1.0.0',
params: {
urls: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Comma-separated list of URLs to retrieve content from',
},
text: {
type: 'boolean',
required: false,
visibility: 'user-only',
description:
'If true, returns full page text with default settings. If false, disables text return.',
},
summaryQuery: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Query to guide the summary generation',
},
subpages: {
type: 'number',
required: false,
visibility: 'user-only',
description: 'Number of subpages to crawl from the provided URLs',
},
subpageTarget: {
type: 'string',
required: false,
visibility: 'user-only',
description:
'Comma-separated keywords to target specific subpages (e.g., "docs,tutorial,about")',
},
highlights: {
type: 'boolean',
required: false,
visibility: 'user-only',
description: 'Include highlighted snippets in results (default: false)',
},
livecrawl: {
type: 'string',
required: false,
visibility: 'user-only',
description:
'Live crawling mode: never (default), fallback, always, or preferred (always try livecrawl, fall back to cache if fails)',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Exa AI API Key',
},
},
hosting: {
envKeyPrefix: 'EXA_API_KEY',
apiKeyParam: 'apiKey',
byokProviderId: 'exa',
pricing: {
type: 'custom',
getCost: (_params, output) => {
const costDollars = output.__costDollars as { total?: number } | undefined
if (costDollars?.total == null) {
throw new Error('Exa get_contents response missing costDollars field')
}
return { cost: costDollars.total, metadata: { costDollars } }
},
},
rateLimit: {
mode: 'per_request',
requestsPerMinute: 10,
},
},
request: {
url: 'https://api.exa.ai/contents',
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
'x-api-key': params.apiKey,
}),
body: (params) => {
// Parse the comma-separated URLs into an array
const urlsString = params.urls
const urlArray = urlsString
.split(',')
.map((url: string) => url.trim())
.filter((url: string) => url.length > 0)
const body: Record<string, any> = {
urls: urlArray,
}
// Add optional parameters if provided
if (params.text !== undefined) {
body.text = params.text
}
// Add summary with query if provided
if (params.summaryQuery) {
body.summary = {
query: params.summaryQuery,
}
}
// Subpages crawling
if (params.subpages !== undefined) {
body.subpages = Number(params.subpages)
}
if (params.subpageTarget) {
body.subpageTarget = params.subpageTarget
.split(',')
.map((target: string) => target.trim())
.filter((target: string) => target.length > 0)
}
// Content options
if (params.highlights !== undefined) {
body.highlights = params.highlights
}
// Live crawl mode
if (params.livecrawl) {
body.livecrawl = params.livecrawl
}
return body
},
},
transformResponse: async (response: Response) => {
const data = await response.json()
return {
success: true,
output: {
results: data.results.map((result: any) => ({
url: result.url,
title: result.title || '',
text: result.text || '',
summary: result.summary || '',
highlights: result.highlights,
})),
__costDollars: data.costDollars,
},
}
},
outputs: {
results: {
type: 'array',
description: 'Retrieved content from URLs with title, text, and summaries',
items: {
type: 'object',
properties: {
url: { type: 'string', description: 'The URL that content was retrieved from' },
title: { type: 'string', description: 'The title of the webpage' },
text: { type: 'string', description: 'The full text content of the webpage' },
summary: { type: 'string', description: 'AI-generated summary of the webpage content' },
},
},
},
},
}
+11
View File
@@ -0,0 +1,11 @@
import { answerTool } from '@/tools/exa/answer'
import { findSimilarLinksTool } from '@/tools/exa/find_similar_links'
import { getContentsTool } from '@/tools/exa/get_contents'
import { researchTool } from '@/tools/exa/research'
import { searchTool } from '@/tools/exa/search'
export const exaAnswerTool = answerTool
export const exaFindSimilarLinksTool = findSimilarLinksTool
export const exaGetContentsTool = getContentsTool
export const exaSearchTool = searchTool
export const exaResearchTool = researchTool
+171
View File
@@ -0,0 +1,171 @@
import { createLogger } from '@sim/logger'
import { sleep } from '@sim/utils/helpers'
import { DEFAULT_EXECUTION_TIMEOUT_MS } from '@/lib/core/execution-limits'
import type { ExaResearchParams, ExaResearchResponse } from '@/tools/exa/types'
import type { ToolConfig } from '@/tools/types'
const logger = createLogger('ExaResearchTool')
const POLL_INTERVAL_MS = 5000
const MAX_POLL_TIME_MS = DEFAULT_EXECUTION_TIMEOUT_MS
export const researchTool: ToolConfig<ExaResearchParams, ExaResearchResponse> = {
id: 'exa_research',
name: 'Exa Research',
description:
'Perform comprehensive research using AI to generate detailed reports with citations',
version: '1.0.0',
params: {
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Research query or topic',
},
model: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Research model: exa-research-fast, exa-research (default), or exa-research-pro',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Exa AI API Key',
},
},
request: {
url: 'https://api.exa.ai/research/v1',
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
'x-api-key': params.apiKey,
}),
body: (params) => {
const body: any = {
instructions: params.query,
}
// Add model if specified, otherwise use default
if (params.model) {
body.model = params.model
}
return body
},
},
transformResponse: async (response: Response) => {
const data = await response.json()
return {
success: true,
output: {
taskId: data.researchId,
research: [],
},
}
},
postProcess: async (result, params) => {
if (!result.success) {
return result
}
const taskId = result.output.taskId
logger.info(`Exa research task ${taskId} created, polling for completion...`)
let elapsedTime = 0
while (elapsedTime < MAX_POLL_TIME_MS) {
try {
const statusResponse = await fetch(`https://api.exa.ai/research/v1/${taskId}`, {
method: 'GET',
headers: {
'x-api-key': params.apiKey,
'Content-Type': 'application/json',
},
})
if (!statusResponse.ok) {
throw new Error(`Failed to get task status: ${statusResponse.statusText}`)
}
const taskData = await statusResponse.json()
logger.info(`Exa research task ${taskId} status: ${taskData.status}`)
if (taskData.status === 'completed') {
// The completed response contains output.content (text) and output.parsed (structured data)
const content =
taskData.output?.content || taskData.output?.parsed || 'Research completed successfully'
result.output = {
research: [
{
title: 'Research Complete',
url: '',
summary: typeof content === 'string' ? content : JSON.stringify(content, null, 2),
text: typeof content === 'string' ? content : JSON.stringify(content, null, 2),
publishedDate: undefined,
author: undefined,
score: 1.0,
},
],
}
return result
}
if (taskData.status === 'failed' || taskData.status === 'canceled') {
return {
...result,
success: false,
error: `Research task ${taskData.status}: ${taskData.error || 'Unknown error'}`,
}
}
await sleep(POLL_INTERVAL_MS)
elapsedTime += POLL_INTERVAL_MS
} catch (error: any) {
logger.error('Error polling for research task status:', {
message: error.message || 'Unknown error',
taskId,
})
return {
...result,
success: false,
error: `Error polling for research task status: ${error.message || 'Unknown error'}`,
}
}
}
logger.warn(
`Research task ${taskId} did not complete within the maximum polling time (${MAX_POLL_TIME_MS / 1000}s)`
)
return {
...result,
success: false,
error: `Research task did not complete within the maximum polling time (${MAX_POLL_TIME_MS / 1000}s)`,
}
},
outputs: {
research: {
type: 'array',
description: 'Comprehensive research findings with citations and summaries',
items: {
type: 'object',
properties: {
title: { type: 'string' },
url: { type: 'string' },
summary: { type: 'string' },
text: { type: 'string' },
publishedDate: { type: 'string' },
author: { type: 'string' },
score: { type: 'number' },
},
},
},
},
}
+245
View File
@@ -0,0 +1,245 @@
import type { ExaSearchParams, ExaSearchResponse } from '@/tools/exa/types'
import type { ToolConfig } from '@/tools/types'
export const searchTool: ToolConfig<ExaSearchParams, ExaSearchResponse> = {
id: 'exa_search',
name: 'Exa Search',
description:
'Search the web using Exa AI. Returns relevant search results with titles, URLs, and text snippets.',
version: '1.0.0',
params: {
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The search query to execute',
},
numResults: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to return (e.g., 5, 10, 25). Default: 10, max: 25',
},
useAutoprompt: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Whether to use autoprompt to improve the query (true or false). Default: false',
},
type: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Search type: "neural", "keyword", "auto", or "fast". Default: "auto"',
},
includeDomains: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of domains to include in results (e.g., "github.com, stackoverflow.com")',
},
excludeDomains: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of domains to exclude from results (e.g., "reddit.com, pinterest.com")',
},
category: {
type: 'string',
required: false,
visibility: 'user-only',
description:
'Filter by category: company, research paper, news, pdf, github, tweet, personal site, linkedin profile, financial report',
},
text: {
type: 'boolean',
required: false,
visibility: 'user-only',
description: 'Include full text content in results (default: false)',
},
highlights: {
type: 'boolean',
required: false,
visibility: 'user-only',
description: 'Include highlighted snippets in results (default: false)',
},
summary: {
type: 'boolean',
required: false,
visibility: 'user-only',
description: 'Include AI-generated summaries in results (default: false)',
},
livecrawl: {
type: 'string',
required: false,
visibility: 'user-only',
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,
visibility: 'user-only',
description: 'Exa AI API Key',
},
},
hosting: {
envKeyPrefix: 'EXA_API_KEY',
apiKeyParam: 'apiKey',
byokProviderId: 'exa',
pricing: {
type: 'custom',
getCost: (_params, output) => {
const costDollars = output.__costDollars as { total?: number } | undefined
if (costDollars?.total == null) {
throw new Error('Exa search response missing costDollars field')
}
return { cost: costDollars.total, metadata: { costDollars } }
},
},
rateLimit: {
mode: 'per_request',
requestsPerMinute: 60,
},
},
request: {
url: 'https://api.exa.ai/search',
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
'x-api-key': params.apiKey,
}),
body: (params) => {
const body: Record<string, any> = {
query: params.query,
}
// Add optional parameters if provided
if (params.numResults) body.numResults = Number(params.numResults)
if (params.useAutoprompt !== undefined) body.useAutoprompt = params.useAutoprompt
if (params.type) body.type = params.type
// Domain filtering
if (params.includeDomains) {
body.includeDomains = params.includeDomains
.split(',')
.map((d: string) => d.trim())
.filter((d: string) => d.length > 0)
}
if (params.excludeDomains) {
body.excludeDomains = params.excludeDomains
.split(',')
.map((d: string) => d.trim())
.filter((d: string) => d.length > 0)
}
// 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> = {}
if (params.text !== undefined) {
contents.text = params.text
}
if (params.highlights !== undefined) {
contents.highlights = params.highlights
}
if (params.summary !== undefined) {
contents.summary = params.summary
}
if (params.livecrawl) {
contents.livecrawl = params.livecrawl
}
// Add contents to body if not empty
if (Object.keys(contents).length > 0) {
body.contents = contents
}
return body
},
},
transformResponse: async (response: Response) => {
const data = await response.json()
return {
success: true,
output: {
results: data.results.map((result: any) => ({
title: result.title || '',
url: result.url,
publishedDate: result.publishedDate,
author: result.author,
summary: result.summary,
favicon: result.favicon,
image: result.image,
text: result.text,
highlights: result.highlights,
score: result.score,
})),
__costDollars: data.costDollars,
},
}
},
outputs: {
results: {
type: 'array',
description: 'Search results with titles, URLs, and text snippets',
items: {
type: 'object',
properties: {
title: { type: 'string', description: 'The title of the search result' },
url: { type: 'string', description: 'The URL of the search result' },
publishedDate: { type: 'string', description: 'Date when the content was published' },
author: { type: 'string', description: 'The author of the content' },
summary: { type: 'string', description: 'A brief summary of the content' },
favicon: { type: 'string', description: "URL of the site's favicon" },
image: { type: 'string', description: 'URL of a representative image from the page' },
text: { type: 'string', description: 'Text snippet or full content from the page' },
score: { type: 'number', description: 'Relevance score for the search result' },
},
},
},
},
}
+183
View File
@@ -0,0 +1,183 @@
// Common types for Exa AI tools
import type { ToolResponse } from '@/tools/types'
// Common parameters for all Exa AI tools
interface ExaBaseParams {
apiKey: string
}
/** Cost breakdown returned by Exa API responses */
interface ExaCostDollars {
total: number
}
// Search tool types
export interface ExaSearchParams extends ExaBaseParams {
query: string
numResults?: number
useAutoprompt?: boolean
type?: 'auto' | 'neural' | 'keyword' | 'fast'
// Domain filtering
includeDomains?: string
excludeDomains?: string
// Category filtering
category?:
| 'company'
| 'research_paper'
| 'news_article'
| 'pdf'
| 'github'
| 'tweet'
| 'movie'
| 'song'
| 'personal_site'
// Content options
text?: boolean | { maxCharacters?: number }
highlights?: boolean | { query?: string; numSentences?: number; highlightsPerUrl?: number }
summary?: boolean | { query?: string }
// Live crawl mode
livecrawl?: 'always' | 'fallback' | 'never'
// Date filters (ISO 8601)
startCrawlDate?: string
endCrawlDate?: string
startPublishedDate?: string
endPublishedDate?: string
}
interface ExaSearchResult {
title: string
url: string
publishedDate?: string
author?: string
summary?: string
favicon?: string
image?: string
text?: string
highlights?: string[]
score: number
}
export interface ExaSearchResponse extends ToolResponse {
output: {
results: ExaSearchResult[]
__costDollars?: ExaCostDollars
}
}
// Get Contents tool types
export interface ExaGetContentsParams extends ExaBaseParams {
urls: string
text?: boolean | { maxCharacters?: number }
summaryQuery?: string
// Subpages crawling
subpages?: number
subpageTarget?: string
// Content options
highlights?: boolean | { query?: string; numSentences?: number; highlightsPerUrl?: number }
// Live crawl mode
livecrawl?: 'always' | 'fallback' | 'never'
}
interface ExaGetContentsResult {
url: string
title: string
text?: string
summary?: string
highlights?: string[]
}
export interface ExaGetContentsResponse extends ToolResponse {
output: {
results: ExaGetContentsResult[]
__costDollars?: ExaCostDollars
}
}
// Find Similar Links tool types
export interface ExaFindSimilarLinksParams extends ExaBaseParams {
url: string
numResults?: number
text?: boolean | { maxCharacters?: number }
// Domain filtering
includeDomains?: string
excludeDomains?: string
excludeSourceDomain?: boolean
// Category filtering
category?:
| 'company'
| 'research_paper'
| 'news_article'
| 'pdf'
| 'github'
| 'tweet'
| 'movie'
| 'song'
| 'personal_site'
// Content options
highlights?: boolean | { query?: string; numSentences?: number; highlightsPerUrl?: number }
summary?: boolean | { query?: string }
// Live crawl mode
livecrawl?: 'always' | 'fallback' | 'never'
}
interface ExaSimilarLink {
title: string
url: string
text?: string
summary?: string
highlights?: string[]
score: number
}
export interface ExaFindSimilarLinksResponse extends ToolResponse {
output: {
similarLinks: ExaSimilarLink[]
__costDollars?: ExaCostDollars
}
}
// Answer tool types
export interface ExaAnswerParams extends ExaBaseParams {
query: string
text?: boolean
}
export interface ExaAnswerResponse extends ToolResponse {
output: {
answer: string
citations: {
title: string
url: string
text: string
}[]
__costDollars?: ExaCostDollars
}
}
// Research tool types
export interface ExaResearchParams extends ExaBaseParams {
query: string
model?: 'exa-research-fast' | 'exa-research' | 'exa-research-pro'
}
export interface ExaResearchResponse extends ToolResponse {
output: {
taskId?: string
research: {
title: string
url: string
summary: string
text?: string
publishedDate?: string
author?: string
score: number
}[]
}
}
export type ExaResponse =
| ExaSearchResponse
| ExaGetContentsResponse
| ExaFindSimilarLinksResponse
| ExaAnswerResponse
| ExaResearchResponse