chatgpt-api/examples/dexter/bin/analyze.ts

30 wiersze
917 B
TypeScript
Czysty Zwykły widok Historia

2024-06-05 06:46:52 +00:00
#!/usr/bin/env node
import 'dotenv/config'
import { createDexterFunctions } from '@agentic/dexter'
import { DiffbotClient, SearchAndCrawl, SerpAPIClient } from '@agentic/stdlib'
2024-06-05 06:46:52 +00:00
import { ChatModel, createAIRunner } from '@dexaai/dexter'
async function main() {
const serpapi = new SerpAPIClient()
const diffbot = new DiffbotClient()
2024-06-05 06:46:52 +00:00
const searchAndCrawl = new SearchAndCrawl({ serpapi, diffbot })
const runner = createAIRunner({
chatModel: new ChatModel({
2024-08-04 10:55:47 +00:00
params: { model: 'gpt-4o-mini', temperature: 0 }
2024-06-05 06:46:52 +00:00
// debug: true
}),
functions: createDexterFunctions(searchAndCrawl),
systemMessage:
'You are a McKinsey analyst who is an expert at writing executive summaries. Always cite your sources and respond using Markdown.'
})
const topic = 'the 2024 olympics'
const result = await runner(`Summarize the latest news on ${topic}`)
console.log(result)
}
await main()