chatgpt-api/examples/dexter/bin/weather.ts

25 wiersze
660 B
TypeScript
Czysty Zwykły widok Historia

2024-06-02 00:34:25 +00:00
#!/usr/bin/env node
import 'dotenv/config'
import { createDexterFunctions } from '@agentic/dexter'
import { WeatherClient } from '@agentic/weather'
2024-06-02 08:16:23 +00:00
import { ChatModel, createAIRunner } from '@dexaai/dexter'
2024-06-02 00:34:25 +00:00
async function main() {
2024-06-02 08:16:23 +00:00
const weather = new WeatherClient()
2024-06-02 00:34:25 +00:00
2024-06-02 08:16:23 +00:00
const runner = createAIRunner({
2024-06-03 22:09:28 +00:00
chatModel: new ChatModel({
2024-08-04 10:55:47 +00:00
params: { model: 'gpt-4o-mini', temperature: 0 }
2024-06-03 22:09:28 +00:00
// debug: true
}),
2024-06-02 08:16:23 +00:00
functions: createDexterFunctions(weather),
2024-06-02 22:30:39 +00:00
systemMessage: 'You are a helpful assistant. Be as concise as possible.'
2024-06-02 00:34:25 +00:00
})
2024-06-02 08:16:23 +00:00
const result = await runner('What is the weather in San Francisco?')
console.log(result)
2024-06-02 00:34:25 +00:00
}
2024-06-02 02:04:13 +00:00
await main()