kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
Rename `createXSAISDKTools` to `createXSAITools`
rodzic
7660fdc7ed
commit
8f06052bf9
|
@ -4,7 +4,7 @@ description: Agentic adapter for the xsAI SDK.
|
|||
---
|
||||
|
||||
- package: `@agentic/xsai`
|
||||
- exports: `function createXSAISDKTools`
|
||||
- exports: `function createXSAITools`
|
||||
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/xsai/src/xsai.ts)
|
||||
- [xsAI SDK docs](https://xsai.js.org)
|
||||
|
||||
|
@ -28,7 +28,7 @@ pnpm add @agentic/xsai xsai @xsai/tool
|
|||
## Usage
|
||||
|
||||
<Note>
|
||||
Note that `createXSAISDKTools` is `async` because `xsai`'s underlying
|
||||
Note that `createXSAITools` is `async` because `xsai`'s underlying
|
||||
`xsschema.toJsonSchema` is async.
|
||||
</Note>
|
||||
|
||||
|
@ -36,7 +36,7 @@ pnpm add @agentic/xsai xsai @xsai/tool
|
|||
import 'dotenv/config'
|
||||
|
||||
import { WeatherClient } from '@agentic/weather'
|
||||
import { createXSAISDKTools } from '@agentic/xsai'
|
||||
import { createXSAITools } from '@agentic/xsai'
|
||||
import { generateText } from 'xsai'
|
||||
|
||||
async function main() {
|
||||
|
@ -46,7 +46,7 @@ async function main() {
|
|||
apiKey: process.env.OPENAI_API_KEY!,
|
||||
baseURL: 'https://api.openai.com/v1/',
|
||||
model: 'gpt-4o-mini',
|
||||
tools: await createXSAISDKTools(weather),
|
||||
tools: await createXSAITools(weather),
|
||||
toolChoice: 'required',
|
||||
temperature: 0,
|
||||
messages: [
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import 'dotenv/config'
|
||||
|
||||
import { WeatherClient } from '@agentic/weather'
|
||||
import { createXSAISDKTools } from '@agentic/xsai'
|
||||
import { createXSAITools } from '@agentic/xsai'
|
||||
import { generateText } from 'xsai'
|
||||
|
||||
async function main() {
|
||||
|
@ -12,7 +12,7 @@ async function main() {
|
|||
apiKey: process.env.OPENAI_API_KEY!,
|
||||
baseURL: 'https://api.openai.com/v1/',
|
||||
model: 'gpt-4o-mini',
|
||||
tools: await createXSAISDKTools(weather),
|
||||
tools: await createXSAITools(weather),
|
||||
toolChoice: 'required',
|
||||
temperature: 0,
|
||||
messages: [
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { EchoAITool } from '@agentic/core'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
|
||||
import { createXSAISDKTools } from './xsai'
|
||||
import { createXSAITools } from './xsai'
|
||||
|
||||
describe('xsai', () => {
|
||||
test('createXSAISDKTools', async () => {
|
||||
const tools = await createXSAISDKTools(new EchoAITool())
|
||||
test('createXSAITools', async () => {
|
||||
const tools = await createXSAITools(new EchoAITool())
|
||||
expect(tools).toHaveLength(1)
|
||||
expect(tools[0]!.function.name).toBe('echo')
|
||||
})
|
||||
|
|
|
@ -5,7 +5,7 @@ import { tool, type ToolResult } from '@xsai/tool'
|
|||
* Converts a set of Agentic stdlib AI functions to an object compatible with
|
||||
* [the xsAI SDK's](https://github.com/moeru-ai/xsai) `tools` parameter.
|
||||
*/
|
||||
export function createXSAISDKTools(
|
||||
export function createXSAITools(
|
||||
...aiFunctionLikeTools: AIFunctionLike[]
|
||||
): Promise<ToolResult[]> {
|
||||
const fns = new AIFunctionSet(aiFunctionLikeTools)
|
||||
|
|
Ładowanie…
Reference in New Issue