Skip to content

Commit

Permalink
fix: llm teset
Browse files Browse the repository at this point in the history
  • Loading branch information
LarchLiu committed Apr 3, 2024
1 parent 7561532 commit eb2df50
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
16 changes: 7 additions & 9 deletions packages/core/test/googleai.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'

// import { summarizeContent } from '../src/llm/googleai'
import { summarizeContent } from '../src/llm/googleai'
import type { WebInfoData } from '../src/types'

const webInfo: WebInfoData = {
Expand All @@ -15,17 +15,15 @@ const webInfo: WebInfoData = {
}
describe('googleai', () => {
it('summarize in zh-CN', async () => {
// const res = await summarizeContent({ apiKey: import.meta.env.VITE_GOOGLE_API_KEY, lang: 'zh-CN' }, webInfo)
// expect(res.summary).toBeDefined()
// expect(res.categories).toBeDefined()
const res = await summarizeContent({ apiKey: import.meta.env.VITE_GOOGLE_API_KEY, lang: 'zh-CN' }, webInfo)
expect(res.summary).toBeDefined()
expect(res.categories).toBeDefined()
// expect(res)?.toMatchSnapshot()
expect(webInfo.title).toBeDefined()
})
it('summarize in en', async () => {
// const res = await summarizeContent({ apiKey: import.meta.env.VITE_GOOGLE_API_KEY, lang: 'en' }, webInfo)
// expect(res.summary).toBeDefined()
// expect(res.categories).toBeDefined()
const res = await summarizeContent({ apiKey: import.meta.env.VITE_GOOGLE_API_KEY, lang: 'en' }, webInfo)
expect(res.summary).toBeDefined()
expect(res.categories).toBeDefined()
// expect(res)?.toMatchSnapshot()
expect(webInfo.title).toBeDefined()
})
})
4 changes: 2 additions & 2 deletions packages/core/test/openai.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ const webInfo: WebInfoData = {
}
describe('openai', () => {
it('summarize in zh-CN', async () => {
const res = await summarizeContent(import.meta.env.VITE_OPENAI_API_KEY, webInfo, 'zh-CN', 'https://aihubmix.com/v1')
const res = await summarizeContent(import.meta.env.VITE_OPENAI_API_KEY, webInfo, 'zh-CN', 'https://aihubmix.com')
expect(res.summary).toBeDefined()
expect(res.categories).toBeDefined()
// expect(res)?.toMatchSnapshot()
})
it('summarize in en', async () => {
const res = await summarizeContent(import.meta.env.VITE_OPENAI_API_KEY, webInfo, 'en', 'https://aihubmix.com/v1')
const res = await summarizeContent(import.meta.env.VITE_OPENAI_API_KEY, webInfo, 'en', 'https://aihubmix.com')
expect(res.summary).toBeDefined()
expect(res.categories).toBeDefined()
// expect(res)?.toMatchSnapshot()
Expand Down

0 comments on commit eb2df50

Please sign in to comment.