BREAKING CHANGE(vercel-ai-sdk): migrate to Vercel AI SDK v6 and introduce provider registry (getModel) returning LanguageModelV3
This commit is contained in:
31
test/test.research.ts
Normal file
31
test/test.research.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import * as qenv from '@push.rocks/qenv';
|
||||
import { research } from '../ts_research/index.js';
|
||||
|
||||
const testQenv = new qenv.Qenv('./', './.nogit/');
|
||||
|
||||
tap.test('research should return answer and sources', async () => {
|
||||
const apiKey = await testQenv.getEnvVarOnDemand('ANTHROPIC_TOKEN');
|
||||
if (!apiKey) {
|
||||
console.log('ANTHROPIC_TOKEN not set, skipping test');
|
||||
return;
|
||||
}
|
||||
|
||||
const result = await research({
|
||||
apiKey,
|
||||
query: 'What is the current version of Node.js?',
|
||||
searchDepth: 'basic',
|
||||
});
|
||||
|
||||
console.log('Research answer:', result.answer.substring(0, 200));
|
||||
console.log('Research sources:', result.sources.length);
|
||||
if (result.searchQueries) {
|
||||
console.log('Search queries:', result.searchQueries);
|
||||
}
|
||||
|
||||
expect(result.answer).toBeTruthy();
|
||||
expect(result.answer.length).toBeGreaterThan(10);
|
||||
expect(result.sources).toBeArray();
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
Reference in New Issue
Block a user