kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
feat: update core deps and third-party frameworks
rodzic
27599b781a
commit
b7bc0e94b9
|
@ -1,12 +1,13 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
import 'dotenv/config'
|
import 'dotenv/config'
|
||||||
|
|
||||||
import { openai } from '@ai-sdk/openai'
|
import { createOpenAI } from '@ai-sdk/openai'
|
||||||
import { Browserbase, BrowserbaseAISDK } from '@browserbasehq/sdk'
|
import { Browserbase, BrowserbaseAISDK } from '@browserbasehq/sdk'
|
||||||
import { generateText } from 'ai'
|
import { generateText } from 'ai'
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const browserbase = new Browserbase()
|
const browserbase = new Browserbase()
|
||||||
|
const openai = createOpenAI({ compatibility: 'strict' })
|
||||||
|
|
||||||
const browserTool = BrowserbaseAISDK(browserbase, { textContent: true })
|
const browserTool = BrowserbaseAISDK(browserbase, { textContent: true })
|
||||||
console.log(browserTool.parameters)
|
console.log(browserTool.parameters)
|
||||||
|
|
|
@ -3,11 +3,12 @@ import 'dotenv/config'
|
||||||
|
|
||||||
import { createAISDKTools } from '@agentic/ai-sdk'
|
import { createAISDKTools } from '@agentic/ai-sdk'
|
||||||
import { WeatherClient } from '@agentic/weather'
|
import { WeatherClient } from '@agentic/weather'
|
||||||
import { openai } from '@ai-sdk/openai'
|
import { createOpenAI } from '@ai-sdk/openai'
|
||||||
import { generateText } from 'ai'
|
import { generateText } from 'ai'
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const weather = new WeatherClient()
|
const weather = new WeatherClient()
|
||||||
|
const openai = createOpenAI({ compatibility: 'strict' })
|
||||||
|
|
||||||
const result = await generateText({
|
const result = await generateText({
|
||||||
model: openai('gpt-4o-mini'),
|
model: openai('gpt-4o-mini'),
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
"@agentic/ai-sdk": "workspace:*",
|
"@agentic/ai-sdk": "workspace:*",
|
||||||
"@agentic/core": "workspace:*",
|
"@agentic/core": "workspace:*",
|
||||||
"@agentic/weather": "workspace:*",
|
"@agentic/weather": "workspace:*",
|
||||||
"@ai-sdk/openai": "^0.0.24",
|
"@ai-sdk/openai": "^0.0.68",
|
||||||
"@browserbasehq/sdk": "^1.4.2",
|
"@browserbasehq/sdk": "^1.4.2",
|
||||||
"ai": "^3.1.30",
|
"ai": "^3.4.16",
|
||||||
"openai": "^4.49.0",
|
"openai": "^4.49.0",
|
||||||
"zod": "^3.23.8"
|
"zod": "^3.23.8"
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
"@agentic/core": "workspace:*",
|
"@agentic/core": "workspace:*",
|
||||||
"@agentic/genkit": "workspace:*",
|
"@agentic/genkit": "workspace:*",
|
||||||
"@agentic/stdlib": "workspace:*",
|
"@agentic/stdlib": "workspace:*",
|
||||||
"@genkit-ai/ai": "^0.5.9",
|
"@genkit-ai/ai": "^0.5.16",
|
||||||
"@genkit-ai/core": "^0.5.9",
|
"@genkit-ai/core": "^0.5.16",
|
||||||
"genkitx-openai": "^0.10.0",
|
"genkitx-openai": "^0.10.0",
|
||||||
"zod": "^3.23.8"
|
"zod": "^3.23.8"
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
"@agentic/core": "workspace:*",
|
"@agentic/core": "workspace:*",
|
||||||
"@agentic/langchain": "workspace:*",
|
"@agentic/langchain": "workspace:*",
|
||||||
"@agentic/stdlib": "workspace:*",
|
"@agentic/stdlib": "workspace:*",
|
||||||
"@langchain/core": "^0.2.20",
|
"@langchain/core": "^0.3.13",
|
||||||
"@langchain/openai": "^0.2.5",
|
"@langchain/openai": "^0.3.11",
|
||||||
"langchain": "^0.2.12",
|
"langchain": "^0.3.3",
|
||||||
"zod": "^3.23.8"
|
"zod": "^3.23.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
"@agentic/core": "workspace:*",
|
"@agentic/core": "workspace:*",
|
||||||
"@agentic/llamaindex": "workspace:*",
|
"@agentic/llamaindex": "workspace:*",
|
||||||
"@agentic/stdlib": "workspace:*",
|
"@agentic/stdlib": "workspace:*",
|
||||||
"llamaindex": "^0.5.13",
|
"llamaindex": "^0.7.3",
|
||||||
"zod": "^3.23.8"
|
"zod": "^3.23.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
26
package.json
26
package.json
|
@ -33,23 +33,23 @@
|
||||||
"prepare": "husky"
|
"prepare": "husky"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@changesets/cli": "^2.27.7",
|
"@changesets/cli": "^2.27.9",
|
||||||
"@fisch0920/eslint-config": "^1.4.0",
|
"@fisch0920/eslint-config": "^1.4.0",
|
||||||
"@total-typescript/ts-reset": "^0.5.1",
|
"@total-typescript/ts-reset": "^0.6.1",
|
||||||
"@types/node": "^22.4.0",
|
"@types/node": "^22.7.6",
|
||||||
"del-cli": "^5.1.0",
|
"del-cli": "^6.0.0",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.1",
|
||||||
"husky": "^9.1.4",
|
"husky": "^9.1.6",
|
||||||
"lint-staged": "^15.2.9",
|
"lint-staged": "^15.2.10",
|
||||||
"npm-run-all2": "^6.2.2",
|
"npm-run-all2": "^6.2.4",
|
||||||
"only-allow": "^1.2.1",
|
"only-allow": "^1.2.1",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"tsup": "^8.2.4",
|
"tsup": "^8.3.0",
|
||||||
"tsx": "^4.17.0",
|
"tsx": "^4.19.1",
|
||||||
"turbo": "^2.0.14",
|
"turbo": "^2.2.0",
|
||||||
"typescript": "^5.5.4",
|
"typescript": "^5.6.3",
|
||||||
"vitest": "2.0.5",
|
"vitest": "2.1.3",
|
||||||
"zod": "^3.23.8"
|
"zod": "^3.23.8"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
"test:unit": "vitest run"
|
"test:unit": "vitest run"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sindresorhus/is": "^7.0.0",
|
|
||||||
"dedent": "^1.5.3",
|
"dedent": "^1.5.3",
|
||||||
"delay": "^6.0.0",
|
"delay": "^6.0.0",
|
||||||
"hash-object": "^5.0.1",
|
"hash-object": "^5.0.1",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { isError } from '@sindresorhus/is'
|
export function assert(
|
||||||
|
value: unknown,
|
||||||
function assertImpl(value: unknown, message?: string | Error): asserts value {
|
message?: string | Error
|
||||||
|
): asserts value {
|
||||||
if (value) {
|
if (value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -9,22 +10,5 @@ function assertImpl(value: unknown, message?: string | Error): asserts value {
|
||||||
throw new Error('Assertion failed')
|
throw new Error('Assertion failed')
|
||||||
}
|
}
|
||||||
|
|
||||||
throw isError(message) ? message : new Error(message)
|
throw typeof message === 'string' ? new Error(message) : message
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Assertion function that defaults to Node.js's `assert` module if it's
|
|
||||||
* available, with a basic backup if not.
|
|
||||||
*/
|
|
||||||
let assert: (value: unknown, message?: string | Error) => asserts value =
|
|
||||||
assertImpl
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Default to the Node.js assert module if it's available
|
|
||||||
const assertImport = await import('node:assert')
|
|
||||||
if (assertImport?.default) {
|
|
||||||
assert = assertImport.default
|
|
||||||
}
|
|
||||||
} catch {}
|
|
||||||
|
|
||||||
export { assert }
|
|
||||||
|
|
|
@ -15,5 +15,5 @@ export function extractObject<Result extends types.AIChainResult = string>(
|
||||||
args: ExtractObjectParams<Result>
|
args: ExtractObjectParams<Result>
|
||||||
): Promise<Result> {
|
): Promise<Result> {
|
||||||
const chain = createAIChain(args)
|
const chain = createAIChain(args)
|
||||||
return chain()
|
return chain() as Promise<Result>
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,13 +32,13 @@
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@agentic/core": "workspace:*",
|
"@agentic/core": "workspace:*",
|
||||||
"@e2b/code-interpreter": "^0.0.8",
|
"@e2b/code-interpreter": "^1.0.2",
|
||||||
"zod": "^3.23.8"
|
"zod": "^3.23.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@agentic/core": "workspace:*",
|
"@agentic/core": "workspace:*",
|
||||||
"@agentic/tsconfig": "workspace:*",
|
"@agentic/tsconfig": "workspace:*",
|
||||||
"@e2b/code-interpreter": "^0.0.8"
|
"@e2b/code-interpreter": "^1.0.2"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { createAIFunction, getEnv } from '@agentic/core'
|
import { createAIFunction, getEnv } from '@agentic/core'
|
||||||
import { CodeInterpreter, type ProcessMessage } from '@e2b/code-interpreter'
|
import { Sandbox } from '@e2b/code-interpreter'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,17 +26,17 @@ Execute python code in a Jupyter notebook cell and returns any result, stdout, s
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async ({ code }) => {
|
async ({ code }) => {
|
||||||
const sandbox = await CodeInterpreter.create({
|
const sandbox = await Sandbox.create({
|
||||||
apiKey: getEnv('E2B_API_KEY')
|
apiKey: getEnv('E2B_API_KEY')
|
||||||
})
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const exec = await sandbox.notebook.execCell(code, {
|
const exec = await sandbox.runCode(code, {
|
||||||
onStderr: (msg: ProcessMessage) => {
|
onStderr: (msg) => {
|
||||||
console.warn('[Code Interpreter stderr]', msg)
|
console.warn('[Code Interpreter stderr]', msg)
|
||||||
},
|
},
|
||||||
|
|
||||||
onStdout: (stdout: ProcessMessage) => {
|
onStdout: (stdout) => {
|
||||||
console.log('[Code Interpreter stdout]', stdout)
|
console.log('[Code Interpreter stdout]', stdout)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -48,7 +48,7 @@ Execute python code in a Jupyter notebook cell and returns any result, stdout, s
|
||||||
|
|
||||||
return exec.results.map((result) => result.toJSON())
|
return exec.results.map((result) => result.toJSON())
|
||||||
} finally {
|
} finally {
|
||||||
await sandbox.close()
|
await sandbox.kill()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
{
|
{
|
||||||
"extends": "@agentic/tsconfig/base.json",
|
"extends": "@agentic/tsconfig/base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"noImplicitAny": false
|
||||||
|
},
|
||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,12 +33,12 @@
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@agentic/core": "workspace:*",
|
"@agentic/core": "workspace:*",
|
||||||
"@genkit-ai/ai": "^0.5.9"
|
"@genkit-ai/ai": "^0.5.16"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@agentic/core": "workspace:*",
|
"@agentic/core": "workspace:*",
|
||||||
"@agentic/tsconfig": "workspace:*",
|
"@agentic/tsconfig": "workspace:*",
|
||||||
"@genkit-ai/ai": "^0.5.9"
|
"@genkit-ai/ai": "^0.5.16"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { defineConfig } from 'vitest/config'
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
test: {
|
||||||
|
server: {
|
||||||
|
deps: {
|
||||||
|
inline: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
|
@ -33,12 +33,12 @@
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@agentic/core": "workspace:*",
|
"@agentic/core": "workspace:*",
|
||||||
"@langchain/core": "^0.2.20"
|
"@langchain/core": "^0.3.13"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@agentic/core": "workspace:*",
|
"@agentic/core": "workspace:*",
|
||||||
"@agentic/tsconfig": "workspace:*",
|
"@agentic/tsconfig": "workspace:*",
|
||||||
"@langchain/core": "^0.2.20"
|
"@langchain/core": "^0.3.13"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|
|
@ -33,12 +33,12 @@
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@agentic/core": "workspace:*",
|
"@agentic/core": "workspace:*",
|
||||||
"llamaindex": "^0.5.13"
|
"llamaindex": "^0.7.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@agentic/core": "workspace:*",
|
"@agentic/core": "workspace:*",
|
||||||
"@agentic/tsconfig": "workspace:*",
|
"@agentic/tsconfig": "workspace:*",
|
||||||
"llamaindex": "^0.5.13"
|
"llamaindex": "^0.7.3"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
"@agentic/wikidata": "workspace:*",
|
"@agentic/wikidata": "workspace:*",
|
||||||
"@agentic/wikipedia": "workspace:*",
|
"@agentic/wikipedia": "workspace:*",
|
||||||
"@agentic/wolfram-alpha": "workspace:*",
|
"@agentic/wolfram-alpha": "workspace:*",
|
||||||
"@e2b/code-interpreter": "^0.0.8"
|
"@e2b/code-interpreter": "^1.0.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@agentic/core": "workspace:*",
|
"@agentic/core": "workspace:*",
|
||||||
|
|
6652
pnpm-lock.yaml
6652
pnpm-lock.yaml
Plik diff jest za duży
Load Diff
Ładowanie…
Reference in New Issue