chatgpt-api/scratch/examples/tools.ts

20 wiersze
472 B
TypeScript
Czysty Zwykły widok Historia

2023-06-01 01:53:09 +00:00
import 'dotenv/config'
2023-05-26 23:50:45 +00:00
import { OpenAIClient } from 'openai-fetch'
import { z } from 'zod'
import { Agentic, MetaphorSearchTool } from '../src'
async function main() {
const openai = new OpenAIClient({ apiKey: process.env.OPENAI_API_KEY! })
const $ = new Agentic({ openai })
const metaphorSearch = new MetaphorSearchTool()
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()