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 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)
}

Wyświetl plik

@ -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
}

Wyświetl plik

@ -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

Wyświetl plik

@ -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()
})
)