chatgpt-api/examples/tools.ts

22 wiersze
499 B
TypeScript
Czysty Zwykły widok Historia

2023-05-26 23:50:45 +00:00
import dotenv from 'dotenv-safe'
import { OpenAIClient } from 'openai-fetch'
import { z } from 'zod'
import { Agentic, MetaphorSearchTool } from '../src'
dotenv.config()
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()