chatgpt-api/scratch/examples/tools.ts

20 wiersze
496 B
TypeScript
Czysty Zwykły widok Historia

import { OpenAIClient } from '@agentic/openai-fetch'
2023-06-01 01:53:09 +00:00
import 'dotenv/config'
2023-05-26 23:50:45 +00:00
import { z } from 'zod'
2023-06-07 19:13:01 +00:00
import { Agentic, MetaphorSearchTool } from '@/index'
2023-05-26 23:50:45 +00:00
async function main() {
const openai = new OpenAIClient({ apiKey: process.env.OPENAI_API_KEY! })
const $ = new Agentic({ openai })
2023-06-07 19:13:01 +00:00
const metaphorSearch = new MetaphorSearchTool({ agentic: $ })
2023-05-27 00:36:52 +00:00
const results = await metaphorSearch.call({
query: 'probability of AI doom:',
numResults: 5
})
2023-05-26 23:50:45 +00:00
console.log(results)
}
main()