2023-06-16 22:50:38 +00:00
|
|
|
import { OpenAIClient } from '@agentic/openai-fetch'
|
|
|
|
import 'dotenv/config'
|
|
|
|
import { z } from 'zod'
|
|
|
|
|
|
|
|
import { Agentic, SearchAndCrawlTool } from '@/index'
|
|
|
|
|
|
|
|
async function main() {
|
|
|
|
const openai = new OpenAIClient({ apiKey: process.env.OPENAI_API_KEY! })
|
|
|
|
const agentic = new Agentic({ openai })
|
|
|
|
|
|
|
|
const res = await agentic
|
|
|
|
.gpt4(`Summarize the latest news on {{topic}} using markdown.`)
|
2023-06-16 23:09:33 +00:00
|
|
|
.modelParams({
|
|
|
|
model: 'gpt-4-32k'
|
|
|
|
})
|
2023-06-16 22:50:38 +00:00
|
|
|
.tools([new SearchAndCrawlTool()])
|
|
|
|
.input(
|
|
|
|
z.object({
|
|
|
|
topic: z.string()
|
|
|
|
})
|
|
|
|
)
|
|
|
|
.call({
|
|
|
|
topic: 'OpenAI'
|
|
|
|
})
|
|
|
|
|
|
|
|
console.log(res)
|
|
|
|
}
|
|
|
|
|
|
|
|
main()
|