From 882942b78b1557b5e2e7f498f853c7227012ce06 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Fri, 26 May 2023 17:47:59 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- legacy/examples/llmWithSearch.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/legacy/examples/llmWithSearch.ts b/legacy/examples/llmWithSearch.ts index aa98697a..456ddf62 100644 --- a/legacy/examples/llmWithSearch.ts +++ b/legacy/examples/llmWithSearch.ts @@ -17,29 +17,26 @@ async function main() { const $ = new Agentic({ openai }) - const searchResults = await metaphorSearch - .call({ - query: 'news from today', - numResults: 5 - }) - .map((r) => r.result.title) + const { results: searchResults } = await metaphorSearch.call({ + query: 'news from today, 2023', + numResults: 5 + }) console.log('searchResults', searchResults) const foodAgent = await $.gpt4( - `Give me a summary of today's news. Here is what I got back from a search engine: {{searchResults.results}}` + `Give me a summary of today's news. Here is what I got back from a search engine: \n{{#searchResults}}{{title}}\n{{/searchResults}}` ) .input( z.object({ - searchResults: MetaphorSearchToolOutputSchema, - afaf: z.string() + searchResults: z.any() // TODO }) ) .output( z.object({ summary: z.string(), linkToLearnMore: z.string(), - metaData: z.object({ + metadata: z.object({ title: z.string(), keyTopics: z.string().array(), datePublished: z.string()