test-provider.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Shared provider config for tests that need kirincode to talk to a fake LLM
  2. // over a real HTTP endpoint. Registers a single provider `test` with a single
  3. // model `test-model` (i.e. `--model test/test-model`), pointed at the URL the
  4. // caller supplies (typically a TestLLMServer instance).
  5. //
  6. // Used by:
  7. // - test/lib/run-process.ts (subprocess CLI tests)
  8. // - test/server/httpapi-sdk.test.ts (in-process SDK tests)
  9. export function testProviderConfig(llmUrl: string) {
  10. return {
  11. formatter: false,
  12. lsp: false,
  13. provider: {
  14. test: {
  15. name: "Test",
  16. id: "test",
  17. env: [],
  18. npm: "@ai-sdk/openai-compatible",
  19. models: {
  20. "test-model": {
  21. id: "test-model",
  22. name: "Test Model",
  23. attachment: false,
  24. reasoning: false,
  25. temperature: false,
  26. tool_call: true,
  27. release_date: "2025-01-01",
  28. limit: { context: 100_000, output: 10_000 },
  29. cost: { input: 0, output: 0 },
  30. options: {},
  31. },
  32. },
  33. options: { apiKey: "test-key", baseURL: llmUrl },
  34. },
  35. },
  36. }
  37. }