node-DeepResearch/src/tools/__tests__/error-analyzer.test.ts
devin-ai-integration[bot] 50dff0863c
feat: add OpenAI provider with structured output support (#28)
* feat: add OpenAI provider with structured output support

Co-Authored-By: Han Xiao <han.xiao@jina.ai>

* fix: add @ai-sdk/openai dependency and fix modelConfigs access

Co-Authored-By: Han Xiao <han.xiao@jina.ai>

* fix: correct indentation in agent.ts

Co-Authored-By: Han Xiao <han.xiao@jina.ai>

* refactor: centralize model initialization in config.ts

Co-Authored-By: Han Xiao <han.xiao@jina.ai>

* refactor: improve model config access patterns

Co-Authored-By: Han Xiao <han.xiao@jina.ai>

* fix: remove unused imports

Co-Authored-By: Han Xiao <han.xiao@jina.ai>

* refactor: clean up

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Han Xiao <han.xiao@jina.ai>
2025-02-06 15:05:38 +08:00

32 lines
878 B
TypeScript

import { analyzeSteps } from '../error-analyzer';
import { LLMProvider } from '../../config';
describe('analyzeSteps', () => {
const providers: Array<LLMProvider> = ['openai', 'gemini'];
const originalEnv = process.env;
beforeEach(() => {
jest.resetModules();
process.env = { ...originalEnv };
});
afterEach(() => {
process.env = originalEnv;
});
providers.forEach(provider => {
describe(`with ${provider} provider`, () => {
beforeEach(() => {
process.env.LLM_PROVIDER = provider;
});
it('should analyze error steps', async () => {
const { response } = await analyzeSteps(['Step 1: Search failed', 'Step 2: Invalid query']);
expect(response).toHaveProperty('recap');
expect(response).toHaveProperty('blame');
expect(response).toHaveProperty('improvement');
});
});
});
});