kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
27 wiersze
574 B
TypeScript
27 wiersze
574 B
TypeScript
![]() |
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.`)
|
||
|
.tools([new SearchAndCrawlTool()])
|
||
|
.input(
|
||
|
z.object({
|
||
|
topic: z.string()
|
||
|
})
|
||
|
)
|
||
|
.call({
|
||
|
topic: 'OpenAI'
|
||
|
})
|
||
|
|
||
|
console.log(res)
|
||
|
}
|
||
|
|
||
|
main()
|