kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
feat: fix mastra tools adapter; move e2b and xsai back to legacy for now
rodzic
816bcf5b6f
commit
593af9b1d6
|
@ -46,8 +46,12 @@ export const tsFrameworkTargetLabels = {
|
|||
langchain: 'LangChain',
|
||||
llamaindex: 'LlamaIndex',
|
||||
mastra: 'Mastra',
|
||||
'firebase-genkit': 'Firebase GenKit',
|
||||
xsai: 'xsAI'
|
||||
'firebase-genkit': 'Firebase GenKit'
|
||||
|
||||
// TODO: add https://github.com/googleapis/js-genai
|
||||
|
||||
// TODO: get xsai adapter working with JSON schemas (currently only standard schemas)
|
||||
// xsai: 'xsAI'
|
||||
} as const
|
||||
export const tsFrameworkTargets = Object.keys(
|
||||
tsFrameworkTargetLabels
|
||||
|
@ -319,32 +323,32 @@ console.log(result)`.trim(),
|
|||
lang: 'ts'
|
||||
}
|
||||
|
||||
case 'xsai':
|
||||
return {
|
||||
code: `
|
||||
import { AgenticToolClient } from '@agentic/platform-tool-client'
|
||||
import { createXSAITools } from '@agentic/xsai'
|
||||
import { generateText } from 'xsai'
|
||||
// case 'xsai':
|
||||
// return {
|
||||
// code: `
|
||||
// import { AgenticToolClient } from '@agentic/platform-tool-client'
|
||||
// import { createXSAITools } from '@agentic/xsai'
|
||||
// import { generateText } from 'xsai'
|
||||
|
||||
const searchTool = await AgenticToolClient.fromIdentifier('${identifier}')
|
||||
// const searchTool = await AgenticToolClient.fromIdentifier('${identifier}')
|
||||
|
||||
const result = await generateText({
|
||||
apiKey: process.env.OPENAI_API_KEY!,
|
||||
baseURL: 'https://api.openai.com/v1/',
|
||||
model: 'gpt-4o-mini',
|
||||
tools: await createXSAITools(searchTool),
|
||||
toolChoice: 'required',
|
||||
messages: [
|
||||
{
|
||||
role: 'user',
|
||||
content: '${prompt}'
|
||||
}
|
||||
]
|
||||
})
|
||||
// const result = await generateText({
|
||||
// apiKey: process.env.OPENAI_API_KEY!,
|
||||
// baseURL: 'https://api.openai.com/v1/',
|
||||
// model: 'gpt-4o-mini',
|
||||
// tools: await createXSAITools(searchTool),
|
||||
// toolChoice: 'required',
|
||||
// messages: [
|
||||
// {
|
||||
// role: 'user',
|
||||
// content: '${prompt}'
|
||||
// }
|
||||
// ]
|
||||
// })
|
||||
|
||||
console.log(JSON.stringify(result, null, 2))`.trim(),
|
||||
lang: 'ts'
|
||||
}
|
||||
// console.log(JSON.stringify(result, null, 2))`.trim(),
|
||||
// lang: 'ts'
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ export default [
|
|||
}
|
||||
},
|
||||
{
|
||||
files: ['apps/e2e/**/*.ts', 'apps/web/src/**/*.{tsx,ts}'],
|
||||
files: ['apps/e2e/**/*.ts', 'apps/web/src/**/*.{tsx,ts}', 'stdlib'],
|
||||
rules: {
|
||||
'no-console': 'off'
|
||||
}
|
||||
|
|
1309
pnpm-lock.yaml
1309
pnpm-lock.yaml
Plik diff jest za duży
Load Diff
|
@ -6,73 +6,76 @@ packages:
|
|||
- packages/fixtures/valid/*
|
||||
- docs
|
||||
ignoredBuiltDependencies:
|
||||
- "@fisch0920/config"
|
||||
- '@fisch0920/config'
|
||||
- puppeteer
|
||||
onlyBuiltDependencies:
|
||||
- "@sentry/cli"
|
||||
- '@sentry/cli'
|
||||
- protobufjs
|
||||
- tree-sitter
|
||||
catalog:
|
||||
"@agentic/core": ^7.6.9
|
||||
"@agentic/serper": ^7.6.9
|
||||
"@ai-sdk/openai": ^1.3.22
|
||||
"@apideck/better-ajv-errors": ^0.3.6
|
||||
"@clack/prompts": ^0.11.0
|
||||
"@cloudflare/workers-types": ^4.20250620.0
|
||||
"@commander-js/extra-typings": ^14.0.0
|
||||
"@date-fns/utc": ^2.1.0
|
||||
"@dicebear/collection": ^9.2.3
|
||||
"@dicebear/core": ^9.2.3
|
||||
"@dotenvx/dotenvx": ^1.45.1
|
||||
"@edge-runtime/vm": ^5.0.0
|
||||
"@fisch0920/config": ^1.1.4
|
||||
"@fisch0920/drizzle-orm": ^0.43.7
|
||||
"@fisch0920/drizzle-zod": ^0.7.9
|
||||
"@hono/mcp": ^0.1.0
|
||||
"@hono/node-server": ^1.14.4
|
||||
"@hono/sentry": ^1.2.2
|
||||
"@hono/zod-openapi": ^0.19.9
|
||||
"@hono/zod-validator": ^0.7.0
|
||||
"@langchain/core": ^0.3.60
|
||||
"@langchain/openai": ^0.5.14
|
||||
"@llamaindex/openai": ^0.4.4
|
||||
"@llamaindex/workflow": ^1.1.9
|
||||
"@mastra/core": ^0.10.6
|
||||
"@modelcontextprotocol/sdk": ^1.13.2
|
||||
"@number-flow/react": ^0.5.10
|
||||
"@paralleldrive/cuid2": ^2.2.2
|
||||
"@pmndrs/assets": ^1.7.0
|
||||
"@radix-ui/react-dropdown-menu": ^2.1.15
|
||||
"@radix-ui/react-label": ^2.1.7
|
||||
"@radix-ui/react-slot": ^1.2.3
|
||||
"@radix-ui/react-tabs": ^1.1.12
|
||||
"@radix-ui/react-tooltip": ^1.2.7
|
||||
"@react-email/components": ^0.1.1
|
||||
"@react-three/cannon": ^6.6.0
|
||||
"@react-three/drei": ^10.2.0
|
||||
"@react-three/fiber": ^9.1.2
|
||||
"@react-three/postprocessing": ^3.0.4
|
||||
"@react-three/rapier": ^2.1.0
|
||||
"@redocly/openapi-core": ^1.34.3
|
||||
"@sentry/cli": ^2.46.0
|
||||
"@sentry/cloudflare": ^9.33.0
|
||||
"@sentry/core": ^9.33.0
|
||||
"@sentry/node": ^9.33.0
|
||||
"@sindresorhus/slugify": ^2.2.1
|
||||
"@standard-schema/spec": ^1.0.0
|
||||
"@tailwindcss/postcss": ^4.1.11
|
||||
"@tailwindcss/typography": ^0.5.16
|
||||
"@tanstack/react-form": ^1.12.3
|
||||
"@tanstack/react-query": ^5.81.5
|
||||
"@tanstack/react-query-devtools": ^5.81.5
|
||||
"@types/canvas-confetti": ^1.9.0
|
||||
"@types/ms": ^2.1.0
|
||||
"@types/node": ^24.0.7
|
||||
"@types/react": ^19.1.8
|
||||
"@types/react-dom": ^19.1.6
|
||||
"@types/semver": ^7.7.0
|
||||
"@types/three": ^0.177.0
|
||||
"@xsai/tool": ^0.3.0-beta.4
|
||||
'@agentic/core': ^7.6.9
|
||||
'@agentic/serper': ^7.6.9
|
||||
'@ai-sdk/openai': ^1.3.22
|
||||
'@apideck/better-ajv-errors': ^0.3.6
|
||||
'@clack/prompts': ^0.11.0
|
||||
'@cloudflare/workers-types': ^4.20250620.0
|
||||
'@commander-js/extra-typings': ^14.0.0
|
||||
'@date-fns/utc': ^2.1.0
|
||||
'@dicebear/collection': ^9.2.3
|
||||
'@dicebear/core': ^9.2.3
|
||||
'@dotenvx/dotenvx': ^1.45.1
|
||||
'@edge-runtime/vm': ^5.0.0
|
||||
'@fisch0920/config': ^1.1.4
|
||||
'@fisch0920/drizzle-orm': ^0.43.7
|
||||
'@fisch0920/drizzle-zod': ^0.7.9
|
||||
'@googleapis/customsearch': ^4.0.1
|
||||
'@hono/mcp': ^0.1.0
|
||||
'@hono/node-server': ^1.14.4
|
||||
'@hono/sentry': ^1.2.2
|
||||
'@hono/zod-openapi': ^0.19.9
|
||||
'@hono/zod-validator': ^0.7.0
|
||||
'@langchain/core': ^0.3.60
|
||||
'@langchain/openai': ^0.5.14
|
||||
'@llamaindex/openai': ^0.4.4
|
||||
'@llamaindex/workflow': ^1.1.9
|
||||
'@mastra/core': ^0.10.6
|
||||
'@modelcontextprotocol/sdk': ^1.13.2
|
||||
'@nangohq/node': 0.42.22
|
||||
'@number-flow/react': ^0.5.10
|
||||
'@paralleldrive/cuid2': ^2.2.2
|
||||
'@pmndrs/assets': ^1.7.0
|
||||
'@radix-ui/react-dropdown-menu': ^2.1.15
|
||||
'@radix-ui/react-label': ^2.1.7
|
||||
'@radix-ui/react-slot': ^1.2.3
|
||||
'@radix-ui/react-tabs': ^1.1.12
|
||||
'@radix-ui/react-tooltip': ^1.2.7
|
||||
'@react-email/components': ^0.1.1
|
||||
'@react-three/cannon': ^6.6.0
|
||||
'@react-three/drei': ^10.2.0
|
||||
'@react-three/fiber': ^9.1.2
|
||||
'@react-three/postprocessing': ^3.0.4
|
||||
'@react-three/rapier': ^2.1.0
|
||||
'@redocly/openapi-core': ^1.34.3
|
||||
'@sentry/cli': ^2.46.0
|
||||
'@sentry/cloudflare': ^9.33.0
|
||||
'@sentry/core': ^9.33.0
|
||||
'@sentry/node': ^9.33.0
|
||||
'@sindresorhus/slugify': ^2.2.1
|
||||
'@standard-schema/spec': ^1.0.0
|
||||
'@tailwindcss/postcss': ^4.1.11
|
||||
'@tailwindcss/typography': ^0.5.16
|
||||
'@tanstack/react-form': ^1.12.3
|
||||
'@tanstack/react-query': ^5.81.5
|
||||
'@tanstack/react-query-devtools': ^5.81.5
|
||||
'@types/canvas-confetti': ^1.9.0
|
||||
'@types/jsrsasign': ^10.5.15
|
||||
'@types/ms': ^2.1.0
|
||||
'@types/node': ^24.0.7
|
||||
'@types/react': ^19.1.8
|
||||
'@types/react-dom': ^19.1.6
|
||||
'@types/semver': ^7.7.0
|
||||
'@types/three': ^0.177.0
|
||||
'@xsai/tool': ^0.3.0-beta.4
|
||||
agents: ^0.0.99
|
||||
ai: ^4.3.15
|
||||
ajv: ^8.17.1
|
||||
|
@ -96,6 +99,7 @@ catalog:
|
|||
dotenv: ^16.5.0
|
||||
drizzle-kit: ^0.31.4
|
||||
drizzle-orm: ^0.44.2
|
||||
duck-duck-scrape: ^2.2.7
|
||||
email-validator: ^2.0.4
|
||||
eslint: ^9.30.0
|
||||
eslint-plugin-drizzle: ^0.2.3
|
||||
|
@ -103,22 +107,27 @@ catalog:
|
|||
exit-hook: ^4.0.0
|
||||
fast-content-type-parse: ^3.0.0
|
||||
fast-uri: ^3.0.6
|
||||
fast-xml-parser: ^5.2.5
|
||||
fastmcp: ^3.6.2
|
||||
genkit: ^1.13.0
|
||||
genkitx-openai: ^0.22.3
|
||||
get-port: ^7.1.0
|
||||
google-auth-library: ^9.15.1
|
||||
googleapis: ^150.0.1
|
||||
hash-object: ^5.0.1
|
||||
hast-util-to-jsx-runtime: ^2.3.6
|
||||
hono: ^4.8.3
|
||||
is-obj: ^3.0.0
|
||||
is-relative-url: ^4.0.0
|
||||
jsonrepair: ^3.12.0
|
||||
jsrsasign: ^10.9.0
|
||||
knip: ^5.61.3
|
||||
ky: ^1.8.1
|
||||
langchain: ^0.3.29
|
||||
lint-staged: ^16.1.2
|
||||
llamaindex: ^0.11.8
|
||||
lucide-react: ^0.525.0
|
||||
mathjs: ^13.2.3
|
||||
mint: ^4.1.97
|
||||
motion: ^12.19.2
|
||||
ms: ^2.1.3
|
||||
|
@ -156,6 +165,7 @@ catalog:
|
|||
simple-git-hooks: ^2.13.0
|
||||
sonner: ^2.0.5
|
||||
sort-keys: ^5.1.0
|
||||
string-strip-html: ^13.4.12
|
||||
stripe: ^18.2.1
|
||||
suspend-react: ^0.1.3
|
||||
tailwind-merge: ^3.3.1
|
||||
|
@ -165,13 +175,20 @@ catalog:
|
|||
tsx: ^4.20.3
|
||||
turbo: ^2.5.4
|
||||
tw-animate-css: ^1.3.4
|
||||
twitter-api-sdk: ^1.2.1
|
||||
type-fest: ^4.41.0
|
||||
typescript: ^5.8.3
|
||||
unconfig: ^7.3.2
|
||||
vite-tsconfig-paths: ^5.1.4
|
||||
vitest: ^3.2.4
|
||||
wikibase-sdk: ^10.2.3
|
||||
wrangler: ^4.22.0
|
||||
xsai: ^0.3.0-beta.4
|
||||
zod: ^3.25.67
|
||||
zod-to-json-schema: ^3.24.5
|
||||
zod-validation-error: ^3.5.2
|
||||
zoominfo-api-auth-client: ^1.0.1
|
||||
updateConfig:
|
||||
ignoreDependencies:
|
||||
- p-throttle
|
||||
- '@nangohq/node'
|
||||
|
|
|
@ -13,5 +13,5 @@ test('createGenkitToolsFromIdentifier', async () => {
|
|||
const genkit = new Genkit()
|
||||
const tools = await createGenkitToolsFromIdentifier(genkit, '@agentic/search')
|
||||
expect(tools).toHaveLength(1)
|
||||
expect(tools[0]!.name).toBe('search')
|
||||
expect(tools[0]!.__action.name).toBe('search')
|
||||
})
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@agentic/core": "workspace:*",
|
||||
"@agentic/platform-tool-client": "workspace:*"
|
||||
"@agentic/platform-tool-client": "workspace:*",
|
||||
"@mastra/schema-compat": "^0.10.3",
|
||||
"ai": "catalog:"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@mastra/core": "catalog:"
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
import { type AIFunctionLike, AIFunctionSet, isZodSchema } from '@agentic/core'
|
||||
import {
|
||||
type AIFunctionLike,
|
||||
AIFunctionSet,
|
||||
asAgenticSchema,
|
||||
isZodSchema
|
||||
} from '@agentic/core'
|
||||
import {
|
||||
AgenticToolClient,
|
||||
type AgenticToolClientOptions
|
||||
} from '@agentic/platform-tool-client'
|
||||
import { createTool } from '@mastra/core/tools'
|
||||
import { convertSchemaToZod } from '@mastra/schema-compat'
|
||||
import { jsonSchema } from 'ai'
|
||||
|
||||
export type MastraTool = ReturnType<typeof createTool>
|
||||
|
||||
|
@ -18,18 +25,18 @@ export function createMastraTools(
|
|||
|
||||
return Object.fromEntries(
|
||||
fns.map((fn) => {
|
||||
if (!isZodSchema(fn.inputSchema)) {
|
||||
throw new Error(
|
||||
`Mastra tools only support Zod schemas: ${fn.spec.name} tool uses a custom JSON Schema, which is currently not supported.`
|
||||
)
|
||||
}
|
||||
// https://github.com/mastra-ai/mastra/tree/main/packages/schema-compat
|
||||
const aiSchema = isZodSchema(fn.inputSchema)
|
||||
? fn.inputSchema
|
||||
: jsonSchema(asAgenticSchema(fn.inputSchema).jsonSchema)
|
||||
const inputSchema = convertSchemaToZod(aiSchema)
|
||||
|
||||
return [
|
||||
fn.spec.name,
|
||||
createTool({
|
||||
id: fn.spec.name,
|
||||
description: fn.spec.description,
|
||||
inputSchema: fn.inputSchema,
|
||||
inputSchema,
|
||||
execute: (ctx) => fn.execute(ctx.context)
|
||||
})
|
||||
]
|
||||
|
|
|
@ -31,10 +31,8 @@
|
|||
"@agentic/calculator": "workspace:*",
|
||||
"@agentic/clearbit": "workspace:*",
|
||||
"@agentic/core": "workspace:*",
|
||||
"@agentic/dexa": "workspace:*",
|
||||
"@agentic/diffbot": "workspace:*",
|
||||
"@agentic/duck-duck-go": "workspace:*",
|
||||
"@agentic/e2b": "workspace:*",
|
||||
"@agentic/exa": "workspace:*",
|
||||
"@agentic/firecrawl": "workspace:*",
|
||||
"@agentic/github": "workspace:*",
|
||||
|
@ -72,8 +70,7 @@
|
|||
"@agentic/wikipedia": "workspace:*",
|
||||
"@agentic/wolfram-alpha": "workspace:*",
|
||||
"@agentic/youtube": "workspace:*",
|
||||
"@agentic/zoominfo": "workspace:*",
|
||||
"@e2b/code-interpreter": "catalog:"
|
||||
"@agentic/zoominfo": "workspace:*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"zod": "catalog:"
|
||||
|
|
|
@ -5,10 +5,8 @@ export * from '@agentic/bing'
|
|||
export * from '@agentic/brave-search'
|
||||
export * from '@agentic/calculator'
|
||||
export * from '@agentic/clearbit'
|
||||
export * from '@agentic/dexa'
|
||||
export * from '@agentic/diffbot'
|
||||
export * from '@agentic/duck-duck-go'
|
||||
export * from '@agentic/e2b'
|
||||
export * from '@agentic/exa'
|
||||
export * from '@agentic/firecrawl'
|
||||
export * from '@agentic/github'
|
||||
|
|
1
todo.md
1
todo.md
|
@ -24,6 +24,7 @@
|
|||
- create agentic products for legacy tools
|
||||
- add basic legal terms and privacy policy (and update links in stripe)
|
||||
- add caching to public projects api endpoints
|
||||
- add support for [`@google/genai`](https://github.com/googleapis/js-genai) tools adapter and examples
|
||||
|
||||
## TODO: Post-MVP
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue