diff --git a/examples/tools.ts b/examples/tools.ts index aebaabc6..10592ebc 100644 --- a/examples/tools.ts +++ b/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/src/services/metaphor.ts b/src/services/metaphor.ts index 0702f109..dde3ac20 100644 --- a/src/services/metaphor.ts +++ b/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/src/task.ts b/src/task.ts index 4170d2a4..06133b18 100644 --- a/src/task.ts +++ b/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/src/tools/metaphor.ts b/src/tools/metaphor.ts index ed07950c..4f5666ba 100644 --- a/src/tools/metaphor.ts +++ b/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() }) )