From c1d992db28b0fd6a2b449618125d2f57663527e5 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Wed, 31 May 2023 18:56:21 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=96=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- legacy/examples/facts.ts | 5 ++++- legacy/examples/food-expert.ts | 24 +++++++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/legacy/examples/facts.ts b/legacy/examples/facts.ts index 4003fe5d..54c33e53 100644 --- a/legacy/examples/facts.ts +++ b/legacy/examples/facts.ts @@ -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 }) diff --git a/legacy/examples/food-expert.ts b/legacy/examples/food-expert.ts index 956eff67..360b909b 100644 --- a/legacy/examples/food-expert.ts +++ b/legacy/examples/food-expert.ts @@ -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) }