kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
rodzic
6c43838782
commit
34b9322ba0
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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()
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
Ładowanie…
Reference in New Issue