deepseek.e2e.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. import { describe, expect, it } from 'vitest'
  2. import {
  3. DeepSeekSearchProvider,
  4. DEEPSEEK_DEFAULT_API_VERSION,
  5. DEEPSEEK_DEFAULT_BASE_URL,
  6. DEEPSEEK_DEFAULT_MAX_TOKENS,
  7. DEEPSEEK_DEFAULT_MAX_USES,
  8. DEEPSEEK_DEFAULT_MODEL,
  9. } from '@deepseek-ai/dsh-web-search-deepseek'
  10. /**
  11. * Disabled real-API probe for the DeepSeek search provider. The live endpoint
  12. * can complete without structured source blocks, so this is not a reliable
  13. * merge signal. Its body remains because mocks cannot confirm the wire shape.
  14. */
  15. const apiKey = process.env.DEEPSEEK_API_KEY
  16. const maybe = apiKey !== undefined && apiKey.length > 0 ? describe : describe.skip
  17. maybe('DeepSeekSearchProvider real API', () => {
  18. it.skip('returns citeable sources for a live query via native web_search', async () => {
  19. const provider = new DeepSeekSearchProvider({
  20. apiKey: apiKey!,
  21. baseURL: process.env.DEEPSEEK_SEARCH_BASE_URL ?? DEEPSEEK_DEFAULT_BASE_URL,
  22. model: process.env.DEEPSEEK_SEARCH_MODEL ?? DEEPSEEK_DEFAULT_MODEL,
  23. apiVersion: DEEPSEEK_DEFAULT_API_VERSION,
  24. maxTokens: DEEPSEEK_DEFAULT_MAX_TOKENS,
  25. maxUses: DEEPSEEK_DEFAULT_MAX_USES,
  26. })
  27. const result = await provider.search({ query: 'What is the DeepSeek Harness SDK?', maxResults: 5 })
  28. expect(result.sources.length).toBeGreaterThan(0)
  29. for (const source of result.sources) expect(source.url).toMatch(/^https?:\/\//)
  30. }, 60_000)
  31. })