Files
deepseek-harness/packages/web/web-search-exa/tests/exa.e2e.ts
Dudu-0223 580496b72a feat(web): expose exa/perplexity search tuning as config
The Exa and Perplexity providers hard-coded request parameters that
deployments should control while defaults are still unsettled. Exa gains
searchType, numResults, and highlightsPerResult; Perplexity gains
maxTokens (it previously sent none) and an optional searchRecency. Each
follows the deepseek provider's shape: a defaulted Config field, a
DEFAULT_* constant, and a positive-integer status() check for numeric
limits. The call-level maxResults still flows through WebSearchRequest
and wins over the configured default, keeping the seam layering intact.

Addresses tianyicui's "make everything configurable" review comment.
2026-07-03 16:21:12 +08:00

25 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { ExaSearchProvider, EXA_DEFAULT_BASE_URL, EXA_DEFAULT_HIGHLIGHTS_PER_RESULT, EXA_DEFAULT_SEARCH_TYPE } from '@deepseek-ai/dsh-web-search-exa'
/**
* Real-API smoke for the Exa search provider. Self-skips without `$EXA_API_KEY`
* (CI has no secrets), per the with-key e2e policy in AGENTS.md § Secrets.
*/
const apiKey = process.env.EXA_API_KEY
const maybe = apiKey !== undefined && apiKey.length > 0 ? describe : describe.skip
maybe('ExaSearchProvider real API', () => {
it('returns sources for a live query', async () => {
const provider = new ExaSearchProvider({
apiKey: apiKey!,
baseURL: process.env.EXA_BASE_URL ?? EXA_DEFAULT_BASE_URL,
searchType: EXA_DEFAULT_SEARCH_TYPE,
highlightsPerResult: EXA_DEFAULT_HIGHLIGHTS_PER_RESULT,
})
const result = await provider.search({ query: 'DeepSeek coding agent', maxResults: 5 })
expect(result.providerId).toBe('exa')
expect(result.sources.length).toBeGreaterThan(0)
for (const source of result.sources) expect(source.url).toMatch(/^https?:\/\//)
}, 30_000)
})