2024-06-02 07:30:50 +00:00
|
|
|
import 'dotenv/config'
|
|
|
|
|
2024-08-04 06:32:30 +00:00
|
|
|
import { createGenkitTools } from '@agentic/genkit'
|
2024-08-04 10:34:47 +00:00
|
|
|
import { WeatherClient } from '@agentic/stdlib'
|
2025-02-19 14:16:07 +00:00
|
|
|
import { genkit } from 'genkit'
|
|
|
|
import { gpt4oMini, openAI } from 'genkitx-openai'
|
2024-06-02 07:30:50 +00:00
|
|
|
|
|
|
|
async function main() {
|
|
|
|
const weather = new WeatherClient()
|
|
|
|
|
2025-02-19 14:16:07 +00:00
|
|
|
const ai = genkit({
|
2024-06-02 07:30:50 +00:00
|
|
|
plugins: [openAI()]
|
|
|
|
})
|
|
|
|
|
2025-02-19 14:16:07 +00:00
|
|
|
const result = await ai.generate({
|
|
|
|
model: gpt4oMini,
|
|
|
|
tools: createGenkitTools(ai, weather),
|
|
|
|
system: 'You are a helpful assistant. Be as concise as possible.',
|
2024-06-02 08:06:45 +00:00
|
|
|
prompt: 'What is the weather in San Francisco?'
|
2024-06-02 07:30:50 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
console.log(result)
|
|
|
|
}
|
|
|
|
|
|
|
|
await main()
|