From dec316aed76dd2db5d4faf54a686b299ac006bcd Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Fri, 26 May 2023 17:36:52 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- legacy/examples/tools.ts | 5 ++++- legacy/src/services/metaphor.ts | 6 +++--- legacy/src/task.ts | 9 +++++++++ legacy/src/tools/metaphor.ts | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/legacy/examples/tools.ts b/legacy/examples/tools.ts index aebaabc6..10592ebc 100644 --- a/legacy/examples/tools.ts +++ b/legacy/examples/tools.ts @@ -11,7 +11,10 @@ async function main() { const $ = new Agentic({ openai }) const metaphorSearch = new MetaphorSearchTool() - const results = await metaphorSearch.call({ query: 'kittens', numResults: 5 }) + const results = await metaphorSearch.call({ + query: 'probability of AI doom:', + numResults: 5 + }) console.log(results) } diff --git a/legacy/src/services/metaphor.ts b/legacy/src/services/metaphor.ts index 0702f109..dde3ac20 100644 --- a/legacy/src/services/metaphor.ts +++ b/legacy/src/services/metaphor.ts @@ -1,10 +1,10 @@ import ky from 'ky' export type MetaphorSearchResult = { - author?: string | null - dateCreated?: string + author: string | null + dateCreated: string | null + title: string | null score: number - title: string url: string } diff --git a/legacy/src/task.ts b/legacy/src/task.ts index 4170d2a4..06133b18 100644 --- a/legacy/src/task.ts +++ b/legacy/src/task.ts @@ -2,6 +2,15 @@ import { ZodRawShape, ZodTypeAny, z } from 'zod' import * as types from './types' +/** + * A `Task` is a typed, async function call that may be non-deterministic. + * + * Examples of tasks include: + * - LLM calls with structured input and output + * - API calls + * - Native function execution + * - Invoking sub-agents + */ export abstract class BaseTaskCallBuilder< TInput extends ZodRawShape | ZodTypeAny = ZodTypeAny, TOutput extends ZodRawShape | ZodTypeAny = z.ZodTypeAny diff --git a/legacy/src/tools/metaphor.ts b/legacy/src/tools/metaphor.ts index ed07950c..4f5666ba 100644 --- a/legacy/src/tools/metaphor.ts +++ b/legacy/src/tools/metaphor.ts @@ -17,8 +17,8 @@ export const MetaphorSearchToolOutputSchema = z.object({ z.object({ author: z.string().nullable(), dateCreated: z.string().nullable(), + title: z.string().nullable(), score: z.number(), - title: z.string(), url: z.string() }) )