kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
33 wiersze
870 B
TypeScript
33 wiersze
870 B
TypeScript
![]() |
#!/usr/bin/env node
|
||
|
import 'dotenv/config'
|
||
|
|
||
|
import { ChatModel, createAIRunner } from '@dexaai/dexter'
|
||
|
|
||
|
import { PerigonClient, SerperClient } from '../../src/index.js'
|
||
|
import { createDexterFunctions } from '../../src/sdks/dexter.js'
|
||
|
|
||
|
async function main() {
|
||
|
const perigon = new PerigonClient()
|
||
|
const serper = new SerperClient()
|
||
|
|
||
|
const runner = createAIRunner({
|
||
|
chatModel: new ChatModel({
|
||
|
params: { model: 'gpt-4o', temperature: 0 }
|
||
|
// debug: true
|
||
|
}),
|
||
|
functions: createDexterFunctions(
|
||
|
perigon.functions.pick('search_news_stories'),
|
||
|
serper
|
||
|
),
|
||
|
systemMessage:
|
||
|
'You are a helpful assistant. Be as concise as possible. Respond in markdown. Always cite your sources.'
|
||
|
})
|
||
|
|
||
|
const result = await runner(
|
||
|
'Summarize the latest news stories about the upcoming US election.'
|
||
|
)
|
||
|
console.log(result)
|
||
|
}
|
||
|
|
||
|
await main()
|