kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
22 wiersze
562 B
TypeScript
22 wiersze
562 B
TypeScript
![]() |
import { type AIFunctionLike, AIFunctionSet } from '@agentic/core'
|
||
![]() |
import { tool } from 'ai'
|
||
|
|
||
![]() |
/**
|
||
|
* Converts a set of Agentic stdlib AI functions to an object compatible with
|
||
|
* the Vercel AI SDK's `tools` parameter.
|
||
|
*/
|
||
![]() |
export function createAISDKTools(...aiFunctionLikeTools: AIFunctionLike[]) {
|
||
|
const fns = new AIFunctionSet(aiFunctionLikeTools)
|
||
![]() |
|
||
|
return Object.fromEntries(
|
||
![]() |
fns.map((fn) => [
|
||
![]() |
fn.spec.name,
|
||
|
tool({
|
||
|
description: fn.spec.description,
|
||
|
parameters: fn.inputSchema,
|
||
|
execute: fn.impl
|
||
|
})
|
||
|
])
|
||
|
)
|
||
|
}
|