Travis Fischer 2023-05-26 17:36:52 -07:00
rodzic 6c43838782
commit 34b9322ba0
4 zmienionych plików z 17 dodań i 5 usunięć

Wyświetl plik

@ -11,7 +11,10 @@ async function main() {
const $ = new Agentic({ openai }) const $ = new Agentic({ openai })
const metaphorSearch = new MetaphorSearchTool() 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) console.log(results)
} }

Wyświetl plik

@ -1,10 +1,10 @@
import ky from 'ky' import ky from 'ky'
export type MetaphorSearchResult = { export type MetaphorSearchResult = {
author?: string | null author: string | null
dateCreated?: string dateCreated: string | null
title: string | null
score: number score: number
title: string
url: string url: string
} }

Wyświetl plik

@ -2,6 +2,15 @@ import { ZodRawShape, ZodTypeAny, z } from 'zod'
import * as types from './types' 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< export abstract class BaseTaskCallBuilder<
TInput extends ZodRawShape | ZodTypeAny = ZodTypeAny, TInput extends ZodRawShape | ZodTypeAny = ZodTypeAny,
TOutput extends ZodRawShape | ZodTypeAny = z.ZodTypeAny TOutput extends ZodRawShape | ZodTypeAny = z.ZodTypeAny

Wyświetl plik

@ -17,8 +17,8 @@ export const MetaphorSearchToolOutputSchema = z.object({
z.object({ z.object({
author: z.string().nullable(), author: z.string().nullable(),
dateCreated: z.string().nullable(), dateCreated: z.string().nullable(),
title: z.string().nullable(),
score: z.number(), score: z.number(),
title: z.string(),
url: z.string() url: z.string()
}) })
) )