old-agentic-v1^2
Travis Fischer 2023-05-31 18:56:21 -07:00
rodzic ed4ea41c51
commit 7850c96f52
2 zmienionych plików z 17 dodań i 12 usunięć

Wyświetl plik

@ -11,7 +11,10 @@ async function main() {
const out = await ai
.gpt3(`Give me {{numFacts}} random facts about {{topic}}`)
.input(
z.object({ topic: z.string(), numFacts: z.number().int().default(5) })
z.object({
topic: z.string(),
numFacts: z.number().int().default(5).optional()
})
)
.output(z.object({ facts: z.array(z.string()) }))
.modelParams({ temperature: 0.9 })

Wyświetl plik

@ -3,7 +3,8 @@ import { OpenAIClient } from 'openai-fetch'
import { z } from 'zod'
import { Agentic } from '../src'
import { summaryAgent } from './summary'
// import { summaryAgent } from './summary'
async function main() {
const openai = new OpenAIClient({ apiKey: process.env.OPENAI_API_KEY! })
@ -45,17 +46,18 @@ async function main() {
dietaryRestrictions: ['vegan', 'vegetarian', 'gluten-free']
})
const article = await $.browse(foodAgent.linkToLearnMore)
const summary = await summaryAgent.call({ article })
// TODO
// const article = await $.browse(foodAgent.linkToLearnMore)
// const summary = await summaryAgent.call({ article })
const email = await $.gpt4(
`Here is a summary of an article about food: {{summary}}.
Here is some more information about the food: {{foodInfo}}.
Write a nice email that I can send to myself that includes the summary and the food info.
Make it fun and interesting.`
)
.input(z.object({ summary: z.string(), foodInfo: foodSchema }))
.output(z.string())
// const email = await $.gpt4(
// `Here is a summary of an article about food: {{summary}}.
// Here is some more information about the food: {{foodInfo}}.
// Write a nice email that I can send to myself that includes the summary and the food info.
// Make it fun and interesting.`
// )
// .input(z.object({ summary: z.string(), foodInfo: foodSchema }))
// .output(z.string())
// sendEmail(email)
}