@coro-ai/runner 0.1.32 → 0.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard-dist/assets/{index--JceWwKS.js → index-C7l2FOsX.js} +9 -3
- package/dashboard-dist/index.html +1 -1
- package/dist/src/clients/tracker/jira.js +6 -0
- package/dist/src/clients/tracker/jira.js.map +1 -1
- package/dist/src/clients/tracker/linear.js +6 -2
- package/dist/src/clients/tracker/linear.js.map +1 -1
- package/dist/src/clients/tracker/types.d.ts +11 -0
- package/dist/src/config/local-config.d.ts +3 -0
- package/dist/src/config/local-config.js +2 -0
- package/dist/src/config/local-config.js.map +1 -1
- package/dist/src/intake/handler.js +27 -9
- package/dist/src/intake/handler.js.map +1 -1
- package/dist/src/intake/system-prompt.d.ts +1 -0
- package/dist/src/intake/system-prompt.js +8 -1
- package/dist/src/intake/system-prompt.js.map +1 -1
- package/dist/src/intake/tools.js +5 -0
- package/dist/src/intake/tools.js.map +1 -1
- package/dist/src/jobs/runner.d.ts +6 -0
- package/dist/src/jobs/runner.js +7 -0
- package/dist/src/jobs/runner.js.map +1 -1
- package/dist/src/mcp-handlers.d.ts +1 -0
- package/dist/src/mcp-handlers.js +6 -2
- package/dist/src/mcp-handlers.js.map +1 -1
- package/dist/src/mcp-server.js +6 -1
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/plugins/builtin/github-tracker/intelligence/snippets/github-issues-keys.md +4 -1
- package/dist/src/plugins/builtin/jira/index.js +12 -0
- package/dist/src/plugins/builtin/jira/index.js.map +1 -1
- package/dist/src/plugins/builtin/jira/intelligence/snippets/jira-transitions.md +6 -1
- package/dist/src/plugins/builtin/linear/index.js +12 -0
- package/dist/src/plugins/builtin/linear/index.js.map +1 -1
- package/dist/src/plugins/builtin/linear/intelligence/snippets/linear-keys.md +6 -2
- package/dist/src/plugins/types.d.ts +12 -0
- package/node_modules/@coro-ai/cloud-protocol/package.json +1 -1
- package/node_modules/@coro-ai/intelligence-base/package.json +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/chat-via-sdk.d.ts +2 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/chat-via-sdk.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/chat-via-sdk.js +25 -46
- package/node_modules/@coro-ai/llm-anthropic/dist/chat-via-sdk.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/executor.d.ts +7 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/executor.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/executor.js +76 -6
- package/node_modules/@coro-ai/llm-anthropic/dist/executor.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/http-routes.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/http-routes.js +3 -2
- package/node_modules/@coro-ai/llm-anthropic/dist/http-routes.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/index.d.ts +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/index.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/index.js +2 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/index.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/login.d.ts +3 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/login.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/login.js +5 -2
- package/node_modules/@coro-ai/llm-anthropic/dist/login.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/test-connection.d.ts +2 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/test-connection.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/test-connection.js +8 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/test-connection.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/package.json +1 -1
- package/node_modules/@coro-ai/llm-openai/README.md +3 -3
- package/node_modules/@coro-ai/llm-openai/dist/executor.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-openai/dist/executor.js +129 -87
- package/node_modules/@coro-ai/llm-openai/dist/executor.js.map +1 -1
- package/node_modules/@coro-ai/llm-openai/dist/models.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-openai/dist/models.js +24 -0
- package/node_modules/@coro-ai/llm-openai/dist/models.js.map +1 -1
- package/node_modules/@coro-ai/llm-openai/package.json +1 -1
- package/node_modules/@coro-ai/plugin-sdk/dist/chat-mcp.d.ts +30 -0
- package/node_modules/@coro-ai/plugin-sdk/dist/chat-mcp.d.ts.map +1 -0
- package/node_modules/@coro-ai/plugin-sdk/dist/chat-mcp.js +85 -0
- package/node_modules/@coro-ai/plugin-sdk/dist/chat-mcp.js.map +1 -0
- package/node_modules/@coro-ai/plugin-sdk/dist/index.d.ts +1 -0
- package/node_modules/@coro-ai/plugin-sdk/dist/index.d.ts.map +1 -1
- package/node_modules/@coro-ai/plugin-sdk/dist/index.js +1 -0
- package/node_modules/@coro-ai/plugin-sdk/dist/index.js.map +1 -1
- package/node_modules/@coro-ai/plugin-sdk/dist/types.d.ts +20 -0
- package/node_modules/@coro-ai/plugin-sdk/dist/types.d.ts.map +1 -1
- package/node_modules/@coro-ai/plugin-sdk/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/utf32.js +10 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/package.json +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/types/encodings.d.ts +2 -0
- package/node_modules/body-parser/HISTORY.md +7 -1
- package/node_modules/body-parser/lib/types/json.js +7 -3
- package/node_modules/body-parser/lib/types/raw.js +7 -3
- package/node_modules/body-parser/lib/types/text.js +7 -3
- package/node_modules/body-parser/lib/types/urlencoded.js +7 -3
- package/node_modules/body-parser/package.json +1 -1
- package/node_modules/express-rate-limit/dist/index.cjs +69 -5
- package/node_modules/express-rate-limit/dist/index.d.cts +18 -0
- package/node_modules/express-rate-limit/dist/index.d.mts +18 -0
- package/node_modules/express-rate-limit/dist/index.d.ts +18 -0
- package/node_modules/express-rate-limit/dist/index.mjs +55 -5
- package/node_modules/express-rate-limit/node_modules/debug/LICENSE +20 -0
- package/node_modules/express-rate-limit/node_modules/debug/README.md +481 -0
- package/node_modules/express-rate-limit/node_modules/debug/package.json +64 -0
- package/node_modules/express-rate-limit/node_modules/debug/src/browser.js +272 -0
- package/node_modules/express-rate-limit/node_modules/debug/src/common.js +292 -0
- package/node_modules/express-rate-limit/node_modules/debug/src/index.js +10 -0
- package/node_modules/express-rate-limit/node_modules/debug/src/node.js +263 -0
- package/node_modules/express-rate-limit/node_modules/ms/index.js +162 -0
- package/node_modules/express-rate-limit/node_modules/ms/license.md +21 -0
- package/node_modules/express-rate-limit/node_modules/ms/package.json +38 -0
- package/node_modules/express-rate-limit/node_modules/ms/readme.md +59 -0
- package/node_modules/express-rate-limit/package.json +11 -8
- package/node_modules/express-rate-limit/readme.md +2 -2
- package/node_modules/fast-copy/README.md +46 -46
- package/node_modules/fast-copy/dist/cjs/index.cjs +13 -19
- package/node_modules/fast-copy/dist/cjs/index.cjs.map +1 -1
- package/node_modules/fast-copy/dist/cjs/index.d.cts +40 -6
- package/node_modules/fast-copy/dist/es/index.d.mts +40 -6
- package/node_modules/fast-copy/dist/es/index.mjs +13 -19
- package/node_modules/fast-copy/dist/es/index.mjs.map +1 -1
- package/node_modules/fast-copy/dist/umd/index.d.ts +40 -6
- package/node_modules/fast-copy/dist/umd/index.js +13 -19
- package/node_modules/fast-copy/dist/umd/index.js.map +1 -1
- package/node_modules/fast-copy/index.d.ts +22 -22
- package/node_modules/fast-copy/package.json +30 -23
- package/node_modules/fast-uri/index.js +1 -1
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/security.test.js +28 -0
- package/node_modules/hono/dist/adapter/aws-lambda/handler.js +11 -22
- package/node_modules/hono/dist/adapter/bun/websocket.js +3 -1
- package/node_modules/hono/dist/adapter/lambda-edge/handler.js +12 -2
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +11 -22
- package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +3 -1
- package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +12 -2
- package/node_modules/hono/dist/cjs/client/client.js +10 -1
- package/node_modules/hono/dist/cjs/client/utils.js +1 -1
- package/node_modules/hono/dist/cjs/helper/css/common.js +3 -1
- package/node_modules/hono/dist/cjs/helper/css/index.js +9 -1
- package/node_modules/hono/dist/cjs/jsx/base.js +8 -14
- package/node_modules/hono/dist/cjs/jsx/components.js +41 -21
- package/node_modules/hono/dist/cjs/jsx/context.js +131 -5
- package/node_modules/hono/dist/cjs/jsx/streaming.js +9 -7
- package/node_modules/hono/dist/cjs/middleware/cache/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/compress/index.js +2 -1
- package/node_modules/hono/dist/cjs/middleware/etag/index.js +2 -1
- package/node_modules/hono/dist/cjs/middleware/method-override/index.js +5 -3
- package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +1 -1
- package/node_modules/hono/dist/cjs/router/trie-router/node.js +9 -0
- package/node_modules/hono/dist/cjs/utils/body.js +12 -4
- package/node_modules/hono/dist/cjs/utils/buffer.js +2 -1
- package/node_modules/hono/dist/cjs/validator/validator.js +3 -3
- package/node_modules/hono/dist/client/client.js +10 -1
- package/node_modules/hono/dist/client/utils.js +1 -1
- package/node_modules/hono/dist/helper/css/common.js +3 -1
- package/node_modules/hono/dist/helper/css/index.js +9 -1
- package/node_modules/hono/dist/jsx/base.js +15 -15
- package/node_modules/hono/dist/jsx/components.js +42 -22
- package/node_modules/hono/dist/jsx/context.js +129 -5
- package/node_modules/hono/dist/jsx/streaming.js +10 -8
- package/node_modules/hono/dist/middleware/cache/index.js +1 -1
- package/node_modules/hono/dist/middleware/compress/index.js +2 -1
- package/node_modules/hono/dist/middleware/etag/index.js +2 -1
- package/node_modules/hono/dist/middleware/method-override/index.js +5 -3
- package/node_modules/hono/dist/middleware/serve-static/index.js +1 -1
- package/node_modules/hono/dist/router/trie-router/node.js +9 -0
- package/node_modules/hono/dist/types/adapter/lambda-edge/handler.d.ts +1 -1
- package/node_modules/hono/dist/types/helper/websocket/index.d.ts +1 -1
- package/node_modules/hono/dist/types/jsx/base.d.ts +1 -3
- package/node_modules/hono/dist/types/jsx/context.d.ts +39 -0
- package/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +2 -2
- package/node_modules/hono/dist/types/middleware/language/language.d.ts +18 -0
- package/node_modules/hono/dist/types/utils/body.d.ts +1 -1
- package/node_modules/hono/dist/types/utils/types.d.ts +1 -1
- package/node_modules/hono/dist/utils/body.js +12 -4
- package/node_modules/hono/dist/utils/buffer.js +2 -1
- package/node_modules/hono/dist/validator/validator.js +3 -3
- package/node_modules/hono/package.json +11 -10
- package/node_modules/js-yaml/README.md +5 -3
- package/node_modules/js-yaml/dist/js-yaml.js +3009 -2402
- package/node_modules/js-yaml/dist/js-yaml.js.map +1 -1
- package/node_modules/js-yaml/dist/js-yaml.min.js +2 -33
- package/node_modules/js-yaml/dist/js-yaml.min.js.map +1 -1
- package/node_modules/js-yaml/dist/js-yaml.mjs +3073 -2381
- package/node_modules/js-yaml/dist/js-yaml.mjs.map +1 -1
- package/node_modules/js-yaml/lib/loader.js +7 -11
- package/node_modules/js-yaml/lib/type/float.js +1 -1
- package/node_modules/js-yaml/lib/type/int.js +4 -4
- package/node_modules/js-yaml/package.json +10 -4
- package/node_modules/node-abi/abi_registry.json +8 -1
- package/node_modules/node-abi/package.json +1 -1
- package/node_modules/openai/CHANGELOG.md +117 -0
- package/node_modules/openai/README.md +94 -104
- package/node_modules/openai/_vendor/zod-to-json-schema/parseDef.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parseDef.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parseDef.js +41 -15
- package/node_modules/openai/_vendor/zod-to-json-schema/parseDef.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parseDef.mjs +41 -15
- package/node_modules/openai/_vendor/zod-to-json-schema/parseDef.mjs.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.d.mts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.d.ts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.js +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.mjs +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/branded.mjs.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.d.mts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.d.ts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.js +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.mjs +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.mjs.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.d.mts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.d.ts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.js +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.mjs +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/default.mjs.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.d.mts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.d.ts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.js +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.mjs +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.mjs.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.d.mts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.d.ts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.js +3 -3
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.mjs +3 -3
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.mjs.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.d.mts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.d.ts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.js +3 -3
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.mjs +3 -3
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/pipeline.mjs.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.d.mts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.d.ts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.js +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.mjs +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/promise.mjs.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.d.mts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.d.mts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.d.ts +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.d.ts.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.js +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.js.map +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.mjs +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.mjs.map +1 -1
- package/node_modules/openai/auth/workload-identity-auth.d.mts.map +1 -1
- package/node_modules/openai/auth/workload-identity-auth.d.ts.map +1 -1
- package/node_modules/openai/auth/workload-identity-auth.js +12 -4
- package/node_modules/openai/auth/workload-identity-auth.js.map +1 -1
- package/node_modules/openai/auth/workload-identity-auth.mjs +13 -5
- package/node_modules/openai/auth/workload-identity-auth.mjs.map +1 -1
- package/node_modules/openai/azure.d.mts +3 -1
- package/node_modules/openai/azure.d.mts.map +1 -1
- package/node_modules/openai/azure.d.ts +3 -1
- package/node_modules/openai/azure.d.ts.map +1 -1
- package/node_modules/openai/azure.js.map +1 -1
- package/node_modules/openai/azure.mjs.map +1 -1
- package/node_modules/openai/beta/realtime/internal-base.d.mts +14 -1
- package/node_modules/openai/beta/realtime/internal-base.d.mts.map +1 -1
- package/node_modules/openai/beta/realtime/internal-base.d.ts +14 -1
- package/node_modules/openai/beta/realtime/internal-base.d.ts.map +1 -1
- package/node_modules/openai/beta/realtime/internal-base.js +21 -5
- package/node_modules/openai/beta/realtime/internal-base.js.map +1 -1
- package/node_modules/openai/beta/realtime/internal-base.mjs +21 -5
- package/node_modules/openai/beta/realtime/internal-base.mjs.map +1 -1
- package/node_modules/openai/beta/realtime/websocket.d.mts +3 -5
- package/node_modules/openai/beta/realtime/websocket.d.mts.map +1 -1
- package/node_modules/openai/beta/realtime/websocket.d.ts +3 -5
- package/node_modules/openai/beta/realtime/websocket.d.ts.map +1 -1
- package/node_modules/openai/beta/realtime/websocket.js +2 -3
- package/node_modules/openai/beta/realtime/websocket.js.map +1 -1
- package/node_modules/openai/beta/realtime/websocket.mjs +3 -4
- package/node_modules/openai/beta/realtime/websocket.mjs.map +1 -1
- package/node_modules/openai/beta/realtime/ws.d.mts +3 -5
- package/node_modules/openai/beta/realtime/ws.d.mts.map +1 -1
- package/node_modules/openai/beta/realtime/ws.d.ts +3 -5
- package/node_modules/openai/beta/realtime/ws.d.ts.map +1 -1
- package/node_modules/openai/beta/realtime/ws.js +2 -3
- package/node_modules/openai/beta/realtime/ws.js.map +1 -1
- package/node_modules/openai/beta/realtime/ws.mjs +3 -4
- package/node_modules/openai/beta/realtime/ws.mjs.map +1 -1
- package/node_modules/openai/client.d.mts +10 -1
- package/node_modules/openai/client.d.mts.map +1 -1
- package/node_modules/openai/client.d.ts +10 -1
- package/node_modules/openai/client.d.ts.map +1 -1
- package/node_modules/openai/client.js +67 -14
- package/node_modules/openai/client.js.map +1 -1
- package/node_modules/openai/client.mjs +67 -14
- package/node_modules/openai/client.mjs.map +1 -1
- package/node_modules/openai/core/streaming.d.mts.map +1 -1
- package/node_modules/openai/core/streaming.d.ts.map +1 -1
- package/node_modules/openai/core/streaming.js +38 -6
- package/node_modules/openai/core/streaming.js.map +1 -1
- package/node_modules/openai/core/streaming.mjs +38 -6
- package/node_modules/openai/core/streaming.mjs.map +1 -1
- package/node_modules/openai/core/uploads.d.mts +1 -1
- package/node_modules/openai/core/uploads.d.mts.map +1 -1
- package/node_modules/openai/core/uploads.d.ts +1 -1
- package/node_modules/openai/core/uploads.d.ts.map +1 -1
- package/node_modules/openai/core/uploads.js +3 -1
- package/node_modules/openai/core/uploads.js.map +1 -1
- package/node_modules/openai/core/uploads.mjs +1 -0
- package/node_modules/openai/core/uploads.mjs.map +1 -1
- package/node_modules/openai/helpers/audio.d.mts.map +1 -1
- package/node_modules/openai/helpers/audio.d.ts.map +1 -1
- package/node_modules/openai/helpers/audio.js +16 -3
- package/node_modules/openai/helpers/audio.js.map +1 -1
- package/node_modules/openai/helpers/audio.mjs +17 -4
- package/node_modules/openai/helpers/audio.mjs.map +1 -1
- package/node_modules/openai/helpers/zod.d.mts +20 -7
- package/node_modules/openai/helpers/zod.d.mts.map +1 -1
- package/node_modules/openai/helpers/zod.d.ts +20 -7
- package/node_modules/openai/helpers/zod.d.ts.map +1 -1
- package/node_modules/openai/helpers/zod.js +36 -12
- package/node_modules/openai/helpers/zod.js.map +1 -1
- package/node_modules/openai/helpers/zod.mjs +36 -12
- package/node_modules/openai/helpers/zod.mjs.map +1 -1
- package/node_modules/openai/index.d.mts +1 -1
- package/node_modules/openai/index.d.mts.map +1 -1
- package/node_modules/openai/index.d.ts +1 -1
- package/node_modules/openai/index.d.ts.map +1 -1
- package/node_modules/openai/index.js +2 -1
- package/node_modules/openai/index.js.map +1 -1
- package/node_modules/openai/index.mjs +1 -1
- package/node_modules/openai/index.mjs.map +1 -1
- package/node_modules/openai/internal/bedrock.d.mts +34 -0
- package/node_modules/openai/internal/bedrock.d.mts.map +1 -0
- package/node_modules/openai/internal/bedrock.d.ts +34 -0
- package/node_modules/openai/internal/bedrock.d.ts.map +1 -0
- package/node_modules/openai/internal/bedrock.js +107 -0
- package/node_modules/openai/internal/bedrock.js.map +1 -0
- package/node_modules/openai/internal/bedrock.mjs +99 -0
- package/node_modules/openai/internal/bedrock.mjs.map +1 -0
- package/node_modules/openai/internal/headers.d.mts.map +1 -1
- package/node_modules/openai/internal/headers.d.ts.map +1 -1
- package/node_modules/openai/internal/headers.js +7 -3
- package/node_modules/openai/internal/headers.js.map +1 -1
- package/node_modules/openai/internal/headers.mjs +7 -3
- package/node_modules/openai/internal/headers.mjs.map +1 -1
- package/node_modules/openai/internal/provider.d.mts +23 -0
- package/node_modules/openai/internal/provider.d.mts.map +1 -0
- package/node_modules/openai/internal/provider.d.ts +23 -0
- package/node_modules/openai/internal/provider.d.ts.map +1 -0
- package/node_modules/openai/internal/provider.js +36 -0
- package/node_modules/openai/internal/provider.js.map +1 -0
- package/node_modules/openai/internal/provider.mjs +32 -0
- package/node_modules/openai/internal/provider.mjs.map +1 -0
- package/node_modules/openai/internal/uploads.d.mts +26 -1
- package/node_modules/openai/internal/uploads.d.mts.map +1 -1
- package/node_modules/openai/internal/uploads.d.ts +26 -1
- package/node_modules/openai/internal/uploads.d.ts.map +1 -1
- package/node_modules/openai/internal/uploads.js +169 -1
- package/node_modules/openai/internal/uploads.js.map +1 -1
- package/node_modules/openai/internal/uploads.mjs +169 -2
- package/node_modules/openai/internal/uploads.mjs.map +1 -1
- package/node_modules/openai/internal/utils/log.d.mts.map +1 -1
- package/node_modules/openai/internal/utils/log.d.ts.map +1 -1
- package/node_modules/openai/internal/utils/log.js +1 -0
- package/node_modules/openai/internal/utils/log.js.map +1 -1
- package/node_modules/openai/internal/utils/log.mjs +1 -0
- package/node_modules/openai/internal/utils/log.mjs.map +1 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.d.mts +15 -4
- package/node_modules/openai/lib/AbstractChatCompletionRunner.d.mts.map +1 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.d.ts +15 -4
- package/node_modules/openai/lib/AbstractChatCompletionRunner.d.ts.map +1 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.js +79 -41
- package/node_modules/openai/lib/AbstractChatCompletionRunner.js.map +1 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.mjs +79 -41
- package/node_modules/openai/lib/AbstractChatCompletionRunner.mjs.map +1 -1
- package/node_modules/openai/lib/AssistantStream.d.mts.map +1 -1
- package/node_modules/openai/lib/AssistantStream.d.ts.map +1 -1
- package/node_modules/openai/lib/AssistantStream.js +8 -27
- package/node_modules/openai/lib/AssistantStream.js.map +1 -1
- package/node_modules/openai/lib/AssistantStream.mjs +8 -27
- package/node_modules/openai/lib/AssistantStream.mjs.map +1 -1
- package/node_modules/openai/lib/ChatCompletionRunner.d.mts +26 -2
- package/node_modules/openai/lib/ChatCompletionRunner.d.mts.map +1 -1
- package/node_modules/openai/lib/ChatCompletionRunner.d.ts +26 -2
- package/node_modules/openai/lib/ChatCompletionRunner.d.ts.map +1 -1
- package/node_modules/openai/lib/ChatCompletionRunner.js +1 -1
- package/node_modules/openai/lib/ChatCompletionRunner.js.map +1 -1
- package/node_modules/openai/lib/ChatCompletionRunner.mjs +1 -1
- package/node_modules/openai/lib/ChatCompletionRunner.mjs.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStream.d.mts +14 -1
- package/node_modules/openai/lib/ChatCompletionStream.d.mts.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStream.d.ts +14 -1
- package/node_modules/openai/lib/ChatCompletionStream.d.ts.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStream.js +79 -29
- package/node_modules/openai/lib/ChatCompletionStream.js.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStream.mjs +78 -29
- package/node_modules/openai/lib/ChatCompletionStream.mjs.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.d.mts +25 -2
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.d.mts.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.d.ts +25 -2
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.d.ts.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.js +78 -1
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.js.map +1 -1
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.mjs +79 -2
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.mjs.map +1 -1
- package/node_modules/openai/lib/EventEmitter.d.mts.map +1 -1
- package/node_modules/openai/lib/EventEmitter.d.ts.map +1 -1
- package/node_modules/openai/lib/EventEmitter.js +12 -2
- package/node_modules/openai/lib/EventEmitter.js.map +1 -1
- package/node_modules/openai/lib/EventEmitter.mjs +12 -2
- package/node_modules/openai/lib/EventEmitter.mjs.map +1 -1
- package/node_modules/openai/lib/EventStream.d.mts +14 -0
- package/node_modules/openai/lib/EventStream.d.mts.map +1 -1
- package/node_modules/openai/lib/EventStream.d.ts +14 -0
- package/node_modules/openai/lib/EventStream.d.ts.map +1 -1
- package/node_modules/openai/lib/EventStream.js +126 -4
- package/node_modules/openai/lib/EventStream.js.map +1 -1
- package/node_modules/openai/lib/EventStream.mjs +126 -4
- package/node_modules/openai/lib/EventStream.mjs.map +1 -1
- package/node_modules/openai/lib/ResponsesParser.d.mts.map +1 -1
- package/node_modules/openai/lib/ResponsesParser.d.ts.map +1 -1
- package/node_modules/openai/lib/ResponsesParser.js +12 -4
- package/node_modules/openai/lib/ResponsesParser.js.map +1 -1
- package/node_modules/openai/lib/ResponsesParser.mjs +12 -4
- package/node_modules/openai/lib/ResponsesParser.mjs.map +1 -1
- package/node_modules/openai/lib/RunnableFunction.d.mts +38 -21
- package/node_modules/openai/lib/RunnableFunction.d.mts.map +1 -1
- package/node_modules/openai/lib/RunnableFunction.d.ts +38 -21
- package/node_modules/openai/lib/RunnableFunction.d.ts.map +1 -1
- package/node_modules/openai/lib/RunnableFunction.js.map +1 -1
- package/node_modules/openai/lib/RunnableFunction.mjs.map +1 -1
- package/node_modules/openai/lib/parser.d.mts +2 -2
- package/node_modules/openai/lib/parser.d.mts.map +1 -1
- package/node_modules/openai/lib/parser.d.ts +2 -2
- package/node_modules/openai/lib/parser.d.ts.map +1 -1
- package/node_modules/openai/lib/parser.js.map +1 -1
- package/node_modules/openai/lib/parser.mjs.map +1 -1
- package/node_modules/openai/lib/responses/ResponseAccumulator.d.mts +15 -0
- package/node_modules/openai/lib/responses/ResponseAccumulator.d.mts.map +1 -0
- package/node_modules/openai/lib/responses/ResponseAccumulator.d.ts +15 -0
- package/node_modules/openai/lib/responses/ResponseAccumulator.d.ts.map +1 -0
- package/node_modules/openai/lib/responses/ResponseAccumulator.js +403 -0
- package/node_modules/openai/lib/responses/ResponseAccumulator.js.map +1 -0
- package/node_modules/openai/lib/responses/ResponseAccumulator.mjs +400 -0
- package/node_modules/openai/lib/responses/ResponseAccumulator.mjs.map +1 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.d.mts +19 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.d.mts.map +1 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.d.ts +19 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.d.ts.map +1 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.js +104 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.js.map +1 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.mjs +100 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.mjs.map +1 -0
- package/node_modules/openai/lib/responses/ResponseStream.d.mts +6 -1
- package/node_modules/openai/lib/responses/ResponseStream.d.mts.map +1 -1
- package/node_modules/openai/lib/responses/ResponseStream.d.ts +6 -1
- package/node_modules/openai/lib/responses/ResponseStream.d.ts.map +1 -1
- package/node_modules/openai/lib/responses/ResponseStream.js +26 -90
- package/node_modules/openai/lib/responses/ResponseStream.js.map +1 -1
- package/node_modules/openai/lib/responses/ResponseStream.mjs +26 -90
- package/node_modules/openai/lib/responses/ResponseStream.mjs.map +1 -1
- package/node_modules/openai/package.json +24 -1
- package/node_modules/openai/providers/bedrock/aws.d.mts +24 -0
- package/node_modules/openai/providers/bedrock/aws.d.mts.map +1 -0
- package/node_modules/openai/providers/bedrock/aws.d.ts +24 -0
- package/node_modules/openai/providers/bedrock/aws.d.ts.map +1 -0
- package/node_modules/openai/providers/bedrock/aws.js +170 -0
- package/node_modules/openai/providers/bedrock/aws.js.map +1 -0
- package/node_modules/openai/providers/bedrock/aws.mjs +166 -0
- package/node_modules/openai/providers/bedrock/aws.mjs.map +1 -0
- package/node_modules/openai/providers/bedrock.d.mts +7 -0
- package/node_modules/openai/providers/bedrock.d.mts.map +1 -0
- package/node_modules/openai/providers/bedrock.d.ts +7 -0
- package/node_modules/openai/providers/bedrock.d.ts.map +1 -0
- package/node_modules/openai/providers/bedrock.js +26 -0
- package/node_modules/openai/providers/bedrock.js.map +1 -0
- package/node_modules/openai/providers/bedrock.mjs +22 -0
- package/node_modules/openai/providers/bedrock.mjs.map +1 -0
- package/node_modules/openai/realtime/internal-base.d.mts +28 -1
- package/node_modules/openai/realtime/internal-base.d.mts.map +1 -1
- package/node_modules/openai/realtime/internal-base.d.ts +28 -1
- package/node_modules/openai/realtime/internal-base.d.ts.map +1 -1
- package/node_modules/openai/realtime/internal-base.js +50 -7
- package/node_modules/openai/realtime/internal-base.js.map +1 -1
- package/node_modules/openai/realtime/internal-base.mjs +49 -7
- package/node_modules/openai/realtime/internal-base.mjs.map +1 -1
- package/node_modules/openai/realtime/websocket.d.mts +4 -7
- package/node_modules/openai/realtime/websocket.d.mts.map +1 -1
- package/node_modules/openai/realtime/websocket.d.ts +4 -7
- package/node_modules/openai/realtime/websocket.d.ts.map +1 -1
- package/node_modules/openai/realtime/websocket.js +4 -8
- package/node_modules/openai/realtime/websocket.js.map +1 -1
- package/node_modules/openai/realtime/websocket.mjs +5 -9
- package/node_modules/openai/realtime/websocket.mjs.map +1 -1
- package/node_modules/openai/realtime/ws.d.mts +4 -7
- package/node_modules/openai/realtime/ws.d.mts.map +1 -1
- package/node_modules/openai/realtime/ws.d.ts +4 -7
- package/node_modules/openai/realtime/ws.d.ts.map +1 -1
- package/node_modules/openai/realtime/ws.js +4 -8
- package/node_modules/openai/realtime/ws.js.map +1 -1
- package/node_modules/openai/realtime/ws.mjs +5 -9
- package/node_modules/openai/realtime/ws.mjs.map +1 -1
- package/node_modules/openai/resources/admin/organization/audit-logs.d.mts +2 -2
- package/node_modules/openai/resources/admin/organization/audit-logs.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/audit-logs.d.ts +2 -2
- package/node_modules/openai/resources/admin/organization/audit-logs.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/api-keys.d.mts +12 -0
- package/node_modules/openai/resources/admin/organization/projects/api-keys.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/api-keys.d.ts +12 -0
- package/node_modules/openai/resources/admin/organization/projects/api-keys.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.d.mts +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.d.ts +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.js +4 -4
- package/node_modules/openai/resources/admin/organization/projects/index.js.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.mjs.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.d.mts +2 -2
- package/node_modules/openai/resources/admin/organization/projects/projects.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.d.ts +2 -2
- package/node_modules/openai/resources/admin/organization/projects/projects.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.js +2 -2
- package/node_modules/openai/resources/admin/organization/projects/projects.js.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.mjs +2 -2
- package/node_modules/openai/resources/admin/organization/projects/projects.mjs.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.d.mts +58 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.d.mts.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.d.ts +58 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.d.ts.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.js +26 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.js.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.mjs +22 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.mjs.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.d.mts +3 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.d.mts.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.d.ts +3 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.d.ts.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.js +9 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.js.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.mjs +4 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.mjs.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.d.mts +177 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.d.mts.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.d.ts +177 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.d.ts.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.js +109 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.js.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.mjs +104 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.mjs.map +1 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.d.mts +1 -167
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.d.ts +1 -167
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.js +2 -97
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.js.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.mjs +1 -95
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.mjs.map +1 -1
- package/node_modules/openai/resources/admin/organization/usage.d.mts +517 -88
- package/node_modules/openai/resources/admin/organization/usage.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/usage.d.ts +517 -88
- package/node_modules/openai/resources/admin/organization/usage.d.ts.map +1 -1
- package/node_modules/openai/resources/beta/assistants.d.mts +12 -26
- package/node_modules/openai/resources/beta/assistants.d.mts.map +1 -1
- package/node_modules/openai/resources/beta/assistants.d.ts +12 -26
- package/node_modules/openai/resources/beta/assistants.d.ts.map +1 -1
- package/node_modules/openai/resources/beta/beta.d.mts +6 -1
- package/node_modules/openai/resources/beta/beta.d.mts.map +1 -1
- package/node_modules/openai/resources/beta/beta.d.ts +6 -1
- package/node_modules/openai/resources/beta/beta.d.ts.map +1 -1
- package/node_modules/openai/resources/beta/beta.js +4 -0
- package/node_modules/openai/resources/beta/beta.js.map +1 -1
- package/node_modules/openai/resources/beta/beta.mjs +4 -0
- package/node_modules/openai/resources/beta/beta.mjs.map +1 -1
- package/node_modules/openai/resources/beta/index.d.mts +1 -0
- package/node_modules/openai/resources/beta/index.d.mts.map +1 -1
- package/node_modules/openai/resources/beta/index.d.ts +1 -0
- package/node_modules/openai/resources/beta/index.d.ts.map +1 -1
- package/node_modules/openai/resources/beta/index.js +5 -3
- package/node_modules/openai/resources/beta/index.js.map +1 -1
- package/node_modules/openai/resources/beta/index.mjs +1 -0
- package/node_modules/openai/resources/beta/index.mjs.map +1 -1
- package/node_modules/openai/resources/beta/responses/index.d.mts +6 -0
- package/node_modules/openai/resources/beta/responses/index.d.mts.map +1 -0
- package/node_modules/openai/resources/beta/responses/index.d.ts +6 -0
- package/node_modules/openai/resources/beta/responses/index.d.ts.map +1 -0
- package/node_modules/openai/resources/beta/responses/index.js +11 -0
- package/node_modules/openai/resources/beta/responses/index.js.map +1 -0
- package/node_modules/openai/resources/beta/responses/index.mjs +5 -0
- package/node_modules/openai/resources/beta/responses/index.mjs.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-items.d.mts +69 -0
- package/node_modules/openai/resources/beta/responses/input-items.d.mts.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-items.d.ts +69 -0
- package/node_modules/openai/resources/beta/responses/input-items.d.ts.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-items.js +37 -0
- package/node_modules/openai/resources/beta/responses/input-items.js.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-items.mjs +33 -0
- package/node_modules/openai/resources/beta/responses/input-items.mjs.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.d.mts +191 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.d.mts.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.d.ts +191 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.d.ts.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.js +34 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.js.map +1 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.mjs +30 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.mjs.map +1 -0
- package/node_modules/openai/resources/beta/responses/internal-base.d.mts +71 -0
- package/node_modules/openai/resources/beta/responses/internal-base.d.mts.map +1 -0
- package/node_modules/openai/resources/beta/responses/internal-base.d.ts +71 -0
- package/node_modules/openai/resources/beta/responses/internal-base.d.ts.map +1 -0
- package/node_modules/openai/resources/beta/responses/internal-base.js +48 -0
- package/node_modules/openai/resources/beta/responses/internal-base.js.map +1 -0
- package/node_modules/openai/resources/beta/responses/internal-base.mjs +42 -0
- package/node_modules/openai/resources/beta/responses/internal-base.mjs.map +1 -0
- package/node_modules/openai/resources/beta/responses/responses.d.mts +9986 -0
- package/node_modules/openai/resources/beta/responses/responses.d.mts.map +1 -0
- package/node_modules/openai/resources/beta/responses/responses.d.ts +9986 -0
- package/node_modules/openai/resources/beta/responses/responses.d.ts.map +1 -0
- package/node_modules/openai/resources/beta/responses/responses.js +121 -0
- package/node_modules/openai/resources/beta/responses/responses.js.map +1 -0
- package/node_modules/openai/resources/beta/responses/responses.mjs +116 -0
- package/node_modules/openai/resources/beta/responses/responses.mjs.map +1 -0
- package/node_modules/openai/resources/beta/responses/ws-base.d.mts +106 -0
- package/node_modules/openai/resources/beta/responses/ws-base.d.mts.map +1 -0
- package/node_modules/openai/resources/beta/responses/ws-base.d.ts +106 -0
- package/node_modules/openai/resources/beta/responses/ws-base.d.ts.map +1 -0
- package/node_modules/openai/resources/beta/responses/ws-base.js +476 -0
- package/node_modules/openai/resources/beta/responses/ws-base.js.map +1 -0
- package/node_modules/openai/resources/beta/responses/ws-base.mjs +472 -0
- package/node_modules/openai/resources/beta/responses/ws-base.mjs.map +1 -0
- package/node_modules/openai/resources/beta/responses/ws.d.mts +13 -0
- package/node_modules/openai/resources/beta/responses/ws.d.mts.map +1 -0
- package/node_modules/openai/resources/beta/responses/ws.d.ts +13 -0
- package/node_modules/openai/resources/beta/responses/ws.d.ts.map +1 -0
- package/node_modules/openai/resources/beta/responses/ws.js +31 -0
- package/node_modules/openai/resources/beta/responses/ws.js.map +1 -0
- package/node_modules/openai/resources/beta/responses/ws.mjs +26 -0
- package/node_modules/openai/resources/beta/responses/ws.mjs.map +1 -0
- package/node_modules/openai/resources/beta/responses.d.mts +2 -0
- package/node_modules/openai/resources/beta/responses.d.mts.map +1 -0
- package/node_modules/openai/resources/beta/responses.d.ts +2 -0
- package/node_modules/openai/resources/beta/responses.d.ts.map +1 -0
- package/node_modules/openai/resources/beta/responses.js +6 -0
- package/node_modules/openai/resources/beta/responses.js.map +1 -0
- package/node_modules/openai/resources/beta/responses.mjs +3 -0
- package/node_modules/openai/resources/beta/responses.mjs.map +1 -0
- package/node_modules/openai/resources/beta/threads/runs/runs.d.mts +6 -13
- package/node_modules/openai/resources/beta/threads/runs/runs.d.mts.map +1 -1
- package/node_modules/openai/resources/beta/threads/runs/runs.d.ts +6 -13
- package/node_modules/openai/resources/beta/threads/runs/runs.d.ts.map +1 -1
- package/node_modules/openai/resources/beta/threads/runs/runs.js.map +1 -1
- package/node_modules/openai/resources/beta/threads/runs/runs.mjs.map +1 -1
- package/node_modules/openai/resources/chat/completions/completions.d.mts +170 -20
- package/node_modules/openai/resources/chat/completions/completions.d.mts.map +1 -1
- package/node_modules/openai/resources/chat/completions/completions.d.ts +170 -20
- package/node_modules/openai/resources/chat/completions/completions.d.ts.map +1 -1
- package/node_modules/openai/resources/chat/completions/completions.js.map +1 -1
- package/node_modules/openai/resources/chat/completions/completions.mjs.map +1 -1
- package/node_modules/openai/resources/completions.d.mts +4 -0
- package/node_modules/openai/resources/completions.d.mts.map +1 -1
- package/node_modules/openai/resources/completions.d.ts +4 -0
- package/node_modules/openai/resources/completions.d.ts.map +1 -1
- package/node_modules/openai/resources/conversations/conversations.d.mts +19 -0
- package/node_modules/openai/resources/conversations/conversations.d.mts.map +1 -1
- package/node_modules/openai/resources/conversations/conversations.d.ts +19 -0
- package/node_modules/openai/resources/conversations/conversations.d.ts.map +1 -1
- package/node_modules/openai/resources/conversations/conversations.js.map +1 -1
- package/node_modules/openai/resources/conversations/conversations.mjs.map +1 -1
- package/node_modules/openai/resources/conversations/items.d.mts +45 -1
- package/node_modules/openai/resources/conversations/items.d.mts.map +1 -1
- package/node_modules/openai/resources/conversations/items.d.ts +45 -1
- package/node_modules/openai/resources/conversations/items.d.ts.map +1 -1
- package/node_modules/openai/resources/evals/runs/runs.d.mts +66 -143
- package/node_modules/openai/resources/evals/runs/runs.d.mts.map +1 -1
- package/node_modules/openai/resources/evals/runs/runs.d.ts +66 -143
- package/node_modules/openai/resources/evals/runs/runs.d.ts.map +1 -1
- package/node_modules/openai/resources/evals/runs/runs.js.map +1 -1
- package/node_modules/openai/resources/evals/runs/runs.mjs.map +1 -1
- package/node_modules/openai/resources/graders/grader-models.d.mts +6 -13
- package/node_modules/openai/resources/graders/grader-models.d.mts.map +1 -1
- package/node_modules/openai/resources/graders/grader-models.d.ts +6 -13
- package/node_modules/openai/resources/graders/grader-models.d.ts.map +1 -1
- package/node_modules/openai/resources/realtime/calls.d.mts +1 -1
- package/node_modules/openai/resources/realtime/calls.d.mts.map +1 -1
- package/node_modules/openai/resources/realtime/calls.d.ts +1 -1
- package/node_modules/openai/resources/realtime/calls.d.ts.map +1 -1
- package/node_modules/openai/resources/realtime/client-secrets.d.mts +5 -1
- package/node_modules/openai/resources/realtime/client-secrets.d.mts.map +1 -1
- package/node_modules/openai/resources/realtime/client-secrets.d.ts +5 -1
- package/node_modules/openai/resources/realtime/client-secrets.d.ts.map +1 -1
- package/node_modules/openai/resources/realtime/realtime.d.mts +9 -1
- package/node_modules/openai/resources/realtime/realtime.d.mts.map +1 -1
- package/node_modules/openai/resources/realtime/realtime.d.ts +9 -1
- package/node_modules/openai/resources/realtime/realtime.d.ts.map +1 -1
- package/node_modules/openai/resources/realtime/realtime.js.map +1 -1
- package/node_modules/openai/resources/realtime/realtime.mjs.map +1 -1
- package/node_modules/openai/resources/responses/input-tokens.d.mts +7 -1
- package/node_modules/openai/resources/responses/input-tokens.d.mts.map +1 -1
- package/node_modules/openai/resources/responses/input-tokens.d.ts +7 -1
- package/node_modules/openai/resources/responses/input-tokens.d.ts.map +1 -1
- package/node_modules/openai/resources/responses/responses.d.mts +819 -26
- package/node_modules/openai/resources/responses/responses.d.mts.map +1 -1
- package/node_modules/openai/resources/responses/responses.d.ts +819 -26
- package/node_modules/openai/resources/responses/responses.d.ts.map +1 -1
- package/node_modules/openai/resources/responses/responses.js +1 -1
- package/node_modules/openai/resources/responses/responses.js.map +1 -1
- package/node_modules/openai/resources/responses/responses.mjs +1 -1
- package/node_modules/openai/resources/responses/responses.mjs.map +1 -1
- package/node_modules/openai/resources/shared.d.mts +20 -28
- package/node_modules/openai/resources/shared.d.mts.map +1 -1
- package/node_modules/openai/resources/shared.d.ts +20 -28
- package/node_modules/openai/resources/shared.d.ts.map +1 -1
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parseDef.ts +44 -16
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/branded.ts +2 -2
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/catch.ts +2 -2
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/default.ts +6 -2
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/nullable.ts +13 -5
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/optional.ts +14 -6
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/pipeline.ts +3 -2
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/promise.ts +6 -2
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/readonly.ts +2 -2
- package/node_modules/openai/src/auth/workload-identity-auth.ts +16 -5
- package/node_modules/openai/src/azure.ts +4 -1
- package/node_modules/openai/src/beta/realtime/internal-base.ts +43 -5
- package/node_modules/openai/src/beta/realtime/websocket.ts +10 -7
- package/node_modules/openai/src/beta/realtime/ws.ts +10 -7
- package/node_modules/openai/src/client.ts +93 -23
- package/node_modules/openai/src/core/streaming.ts +36 -8
- package/node_modules/openai/src/core/uploads.ts +6 -1
- package/node_modules/openai/src/helpers/audio.ts +18 -4
- package/node_modules/openai/src/helpers/zod.ts +78 -23
- package/node_modules/openai/src/index.ts +1 -1
- package/node_modules/openai/src/internal/bedrock.ts +153 -0
- package/node_modules/openai/src/internal/headers.ts +7 -3
- package/node_modules/openai/src/internal/provider.ts +60 -0
- package/node_modules/openai/src/internal/uploads.ts +214 -4
- package/node_modules/openai/src/internal/utils/log.ts +1 -0
- package/node_modules/openai/src/lib/AbstractChatCompletionRunner.ts +124 -50
- package/node_modules/openai/src/lib/AssistantStream.ts +8 -23
- package/node_modules/openai/src/lib/ChatCompletionRunner.ts +47 -7
- package/node_modules/openai/src/lib/ChatCompletionStream.ts +119 -28
- package/node_modules/openai/src/lib/ChatCompletionStreamingRunner.ts +145 -8
- package/node_modules/openai/src/lib/EventEmitter.ts +11 -2
- package/node_modules/openai/src/lib/EventStream.ts +134 -4
- package/node_modules/openai/src/lib/ResponsesParser.ts +18 -4
- package/node_modules/openai/src/lib/RunnableFunction.ts +60 -31
- package/node_modules/openai/src/lib/parser.ts +4 -0
- package/node_modules/openai/src/lib/responses/ResponseAccumulator.ts +421 -0
- package/node_modules/openai/src/lib/responses/ResponseInputItems.ts +129 -0
- package/node_modules/openai/src/lib/responses/ResponseStream.ts +29 -90
- package/node_modules/openai/src/providers/bedrock/aws.ts +255 -0
- package/node_modules/openai/src/providers/bedrock.ts +33 -0
- package/node_modules/openai/src/realtime/internal-base.ts +90 -7
- package/node_modules/openai/src/realtime/websocket.ts +15 -13
- package/node_modules/openai/src/realtime/ws.ts +15 -13
- package/node_modules/openai/src/resources/admin/organization/audit-logs.ts +169 -1
- package/node_modules/openai/src/resources/admin/organization/projects/api-keys.ts +15 -1
- package/node_modules/openai/src/resources/admin/organization/projects/index.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/projects/projects.ts +13 -13
- package/node_modules/openai/src/resources/admin/organization/projects/service-accounts/api-keys.ts +80 -0
- package/node_modules/openai/src/resources/admin/organization/projects/service-accounts/index.ts +15 -0
- package/node_modules/openai/src/resources/admin/organization/projects/service-accounts/service-accounts.ts +284 -0
- package/node_modules/openai/src/resources/admin/organization/projects/service-accounts.ts +1 -264
- package/node_modules/openai/src/resources/admin/organization/usage.ts +616 -88
- package/node_modules/openai/src/resources/beta/assistants.ts +12 -26
- package/node_modules/openai/src/resources/beta/beta.ts +330 -2
- package/node_modules/openai/src/resources/beta/index.ts +163 -0
- package/node_modules/openai/src/resources/beta/responses/index.ts +169 -0
- package/node_modules/openai/src/resources/beta/responses/input-items.ts +105 -0
- package/node_modules/openai/src/resources/beta/responses/input-tokens.ts +245 -0
- package/node_modules/openai/src/resources/beta/responses/internal-base.ts +117 -0
- package/node_modules/openai/src/resources/beta/responses/responses.ts +12633 -0
- package/node_modules/openai/src/resources/beta/responses/ws-base.ts +615 -0
- package/node_modules/openai/src/resources/beta/responses/ws.ts +38 -0
- package/node_modules/openai/src/resources/beta/responses.ts +3 -0
- package/node_modules/openai/src/resources/beta/threads/runs/runs.ts +6 -13
- package/node_modules/openai/src/resources/chat/completions/completions.ts +237 -23
- package/node_modules/openai/src/resources/completions.ts +5 -0
- package/node_modules/openai/src/resources/conversations/conversations.ts +21 -0
- package/node_modules/openai/src/resources/conversations/items.ts +56 -0
- package/node_modules/openai/src/resources/evals/runs/runs.ts +66 -143
- package/node_modules/openai/src/resources/graders/grader-models.ts +6 -13
- package/node_modules/openai/src/resources/realtime/calls.ts +2 -0
- package/node_modules/openai/src/resources/realtime/client-secrets.ts +7 -0
- package/node_modules/openai/src/resources/realtime/realtime.ts +12 -0
- package/node_modules/openai/src/resources/responses/input-tokens.ts +8 -0
- package/node_modules/openai/src/resources/responses/responses.ts +953 -17
- package/node_modules/openai/src/resources/shared.ts +23 -27
- package/node_modules/openai/src/version.ts +1 -1
- package/node_modules/openai/version.d.mts +1 -1
- package/node_modules/openai/version.d.ts +1 -1
- package/node_modules/openai/version.js +1 -1
- package/node_modules/openai/version.mjs +1 -1
- package/node_modules/qs/CHANGELOG.md +11 -0
- package/node_modules/qs/dist/qs.js +17 -17
- package/node_modules/qs/lib/parse.js +19 -8
- package/node_modules/qs/lib/utils.js +47 -8
- package/node_modules/qs/package.json +6 -5
- package/node_modules/qs/test/parse.js +230 -0
- package/node_modules/qs/test/utils.js +194 -0
- package/node_modules/tar-fs/index.js +39 -10
- package/node_modules/tar-fs/package.json +6 -1
- package/node_modules/tar-fs/test/index.js +111 -0
- package/node_modules/ws/lib/receiver.js +15 -32
- package/node_modules/ws/lib/websocket-server.js +4 -4
- package/node_modules/ws/lib/websocket.js +4 -4
- package/node_modules/ws/package.json +5 -1
- package/package.json +6 -6
- package/node_modules/fast-copy/CHANGELOG.md +0 -176
- package/node_modules/fast-copy/dist/cjs/copier.d.cts +0 -75
- package/node_modules/fast-copy/dist/cjs/options.d.cts +0 -69
- package/node_modules/fast-copy/dist/cjs/utils.d.cts +0 -13
- package/node_modules/fast-copy/dist/es/copier.d.mts +0 -75
- package/node_modules/fast-copy/dist/es/options.d.mts +0 -69
- package/node_modules/fast-copy/dist/es/utils.d.mts +0 -13
- package/node_modules/fast-copy/dist/umd/copier.d.ts +0 -72
- package/node_modules/fast-copy/dist/umd/options.d.ts +0 -65
- package/node_modules/fast-copy/dist/umd/utils.d.ts +0 -13
- package/node_modules/hono/dist/tsconfig.build.tsbuildinfo +0 -1
|
@@ -7,10 +7,12 @@ import {
|
|
|
7
7
|
type ResponseStreamEvent,
|
|
8
8
|
} from '../../resources/responses/responses';
|
|
9
9
|
import { RequestOptions } from '../../internal/request-options';
|
|
10
|
+
import { type ReadableStream } from '../../internal/shim-types';
|
|
10
11
|
import { APIUserAbortError, OpenAIError } from '../../error';
|
|
11
12
|
import OpenAI from '../../index';
|
|
12
13
|
import { type BaseEvents, EventStream } from '../EventStream';
|
|
13
14
|
import { type ResponseFunctionCallArgumentsDeltaEvent, type ResponseTextDeltaEvent } from './EventTypes';
|
|
15
|
+
import { accumulateResponse } from './ResponseAccumulator';
|
|
14
16
|
import { maybeParseResponse, ParseableToolsParams } from '../ResponsesParser';
|
|
15
17
|
import { Stream } from '../../streaming';
|
|
16
18
|
|
|
@@ -26,7 +28,9 @@ export type ResponseStreamByIdParams = {
|
|
|
26
28
|
*/
|
|
27
29
|
response_id: string;
|
|
28
30
|
/**
|
|
29
|
-
* If provided,
|
|
31
|
+
* If provided, events with a sequence number less than or equal to this value
|
|
32
|
+
* will not be emitted. The helper still replays them internally to build a
|
|
33
|
+
* complete snapshot for later events and `finalResponse()`.
|
|
30
34
|
*/
|
|
31
35
|
starting_after?: number;
|
|
32
36
|
/**
|
|
@@ -89,6 +93,12 @@ export class ResponseStream<ParsedT = null>
|
|
|
89
93
|
return runner;
|
|
90
94
|
}
|
|
91
95
|
|
|
96
|
+
static fromReadableStream(stream: ReadableStream): ResponseStream<null> {
|
|
97
|
+
const runner = new ResponseStream(null);
|
|
98
|
+
runner._run(() => runner._fromReadableStream(stream));
|
|
99
|
+
return runner;
|
|
100
|
+
}
|
|
101
|
+
|
|
92
102
|
#beginRequest() {
|
|
93
103
|
if (this.ended) return;
|
|
94
104
|
this.#currentResponseSnapshot = undefined;
|
|
@@ -103,7 +113,8 @@ export class ResponseStream<ParsedT = null>
|
|
|
103
113
|
}
|
|
104
114
|
};
|
|
105
115
|
|
|
106
|
-
const response =
|
|
116
|
+
const response = accumulateResponse(event, this.#currentResponseSnapshot);
|
|
117
|
+
this.#currentResponseSnapshot = response;
|
|
107
118
|
maybeEmit('event', event);
|
|
108
119
|
|
|
109
120
|
switch (event.type) {
|
|
@@ -167,16 +178,14 @@ export class ResponseStream<ParsedT = null>
|
|
|
167
178
|
params: ResponseStreamParams,
|
|
168
179
|
options?: RequestOptions,
|
|
169
180
|
): Promise<ParsedResponse<ParsedT>> {
|
|
170
|
-
|
|
171
|
-
if (signal) {
|
|
172
|
-
if (signal.aborted) this.controller.abort();
|
|
173
|
-
signal.addEventListener('abort', () => this.controller.abort());
|
|
174
|
-
}
|
|
181
|
+
this._listenForAbort(options?.signal);
|
|
175
182
|
this.#beginRequest();
|
|
176
183
|
|
|
177
184
|
let stream: Stream<ResponseStreamEvent> | undefined;
|
|
178
185
|
let starting_after: number | null = null;
|
|
179
186
|
if ('response_id' in params) {
|
|
187
|
+
// Keep the full replay so that `accumulateResponse()` sees `response.created` and can build
|
|
188
|
+
// complete snapshots before locally filtering events at `starting_after`.
|
|
180
189
|
stream = await client.responses.retrieve(
|
|
181
190
|
params.response_id,
|
|
182
191
|
{ stream: true },
|
|
@@ -200,91 +209,21 @@ export class ResponseStream<ParsedT = null>
|
|
|
200
209
|
return this.#endRequest();
|
|
201
210
|
}
|
|
202
211
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
212
|
+
protected async _fromReadableStream(
|
|
213
|
+
readableStream: ReadableStream,
|
|
214
|
+
options?: RequestOptions,
|
|
215
|
+
): Promise<ParsedResponse<ParsedT>> {
|
|
216
|
+
this._listenForAbort(options?.signal);
|
|
217
|
+
this.#beginRequest();
|
|
218
|
+
this._connected();
|
|
219
|
+
const stream = Stream.fromReadableStream<ResponseStreamEvent>(readableStream, this.controller);
|
|
220
|
+
for await (const event of stream) {
|
|
221
|
+
this.#addEvent(event, null);
|
|
213
222
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
case 'response.output_item.added': {
|
|
217
|
-
snapshot.output.push(event.item);
|
|
218
|
-
break;
|
|
219
|
-
}
|
|
220
|
-
case 'response.content_part.added': {
|
|
221
|
-
const output = snapshot.output[event.output_index];
|
|
222
|
-
if (!output) {
|
|
223
|
-
throw new OpenAIError(`missing output at index ${event.output_index}`);
|
|
224
|
-
}
|
|
225
|
-
const type = output.type;
|
|
226
|
-
const part = event.part;
|
|
227
|
-
if (type === 'message' && part.type !== 'reasoning_text') {
|
|
228
|
-
output.content.push(part);
|
|
229
|
-
} else if (type === 'reasoning' && part.type === 'reasoning_text') {
|
|
230
|
-
if (!output.content) {
|
|
231
|
-
output.content = [];
|
|
232
|
-
}
|
|
233
|
-
output.content.push(part);
|
|
234
|
-
}
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
case 'response.output_text.delta': {
|
|
238
|
-
const output = snapshot.output[event.output_index];
|
|
239
|
-
if (!output) {
|
|
240
|
-
throw new OpenAIError(`missing output at index ${event.output_index}`);
|
|
241
|
-
}
|
|
242
|
-
if (output.type === 'message') {
|
|
243
|
-
const content = output.content[event.content_index];
|
|
244
|
-
if (!content) {
|
|
245
|
-
throw new OpenAIError(`missing content at index ${event.content_index}`);
|
|
246
|
-
}
|
|
247
|
-
if (content.type !== 'output_text') {
|
|
248
|
-
throw new OpenAIError(`expected content to be 'output_text', got ${content.type}`);
|
|
249
|
-
}
|
|
250
|
-
content.text += event.delta;
|
|
251
|
-
}
|
|
252
|
-
break;
|
|
253
|
-
}
|
|
254
|
-
case 'response.function_call_arguments.delta': {
|
|
255
|
-
const output = snapshot.output[event.output_index];
|
|
256
|
-
if (!output) {
|
|
257
|
-
throw new OpenAIError(`missing output at index ${event.output_index}`);
|
|
258
|
-
}
|
|
259
|
-
if (output.type === 'function_call') {
|
|
260
|
-
output.arguments += event.delta;
|
|
261
|
-
}
|
|
262
|
-
break;
|
|
263
|
-
}
|
|
264
|
-
case 'response.reasoning_text.delta': {
|
|
265
|
-
const output = snapshot.output[event.output_index];
|
|
266
|
-
if (!output) {
|
|
267
|
-
throw new OpenAIError(`missing output at index ${event.output_index}`);
|
|
268
|
-
}
|
|
269
|
-
if (output.type === 'reasoning') {
|
|
270
|
-
const content = output.content?.[event.content_index];
|
|
271
|
-
if (!content) {
|
|
272
|
-
throw new OpenAIError(`missing content at index ${event.content_index}`);
|
|
273
|
-
}
|
|
274
|
-
if (content.type !== 'reasoning_text') {
|
|
275
|
-
throw new OpenAIError(`expected content to be 'reasoning_text', got ${content.type}`);
|
|
276
|
-
}
|
|
277
|
-
content.text += event.delta;
|
|
278
|
-
}
|
|
279
|
-
break;
|
|
280
|
-
}
|
|
281
|
-
case 'response.completed': {
|
|
282
|
-
this.#currentResponseSnapshot = event.response;
|
|
283
|
-
break;
|
|
284
|
-
}
|
|
223
|
+
if (stream.controller.signal?.aborted) {
|
|
224
|
+
throw new APIUserAbortError();
|
|
285
225
|
}
|
|
286
|
-
|
|
287
|
-
return snapshot;
|
|
226
|
+
return this.#endRequest();
|
|
288
227
|
}
|
|
289
228
|
|
|
290
229
|
[Symbol.asyncIterator](this: ResponseStream<ParsedT>): AsyncIterator<ResponseStreamEvent> {
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { defaultProvider } from '@aws-sdk/credential-provider-node';
|
|
2
|
+
import { Hash } from '@smithy/hash-node';
|
|
3
|
+
import { SignatureV4 } from '@smithy/signature-v4';
|
|
4
|
+
|
|
5
|
+
import * as Errors from '../../error';
|
|
6
|
+
import type { BodyInit } from '../../internal/builtin-types';
|
|
7
|
+
import {
|
|
8
|
+
assertProviderOwnsAuthorization,
|
|
9
|
+
errorWithCause,
|
|
10
|
+
normalizeOptionalString,
|
|
11
|
+
resolveBedrockBearerAuth,
|
|
12
|
+
resolveBedrockEndpoint,
|
|
13
|
+
type BedrockBearerOptions,
|
|
14
|
+
type BedrockEndpointOptions,
|
|
15
|
+
type BedrockRequestAuth,
|
|
16
|
+
} from '../../internal/bedrock';
|
|
17
|
+
import { createProvider, type Provider, type ProviderRequestContext } from '../../internal/provider';
|
|
18
|
+
import type { FinalizedRequestInit } from '../../internal/types';
|
|
19
|
+
|
|
20
|
+
const BEDROCK_SERVICE = 'bedrock-mantle';
|
|
21
|
+
|
|
22
|
+
export interface AwsCredentialIdentity {
|
|
23
|
+
accessKeyId: string;
|
|
24
|
+
secretAccessKey: string;
|
|
25
|
+
sessionToken?: string;
|
|
26
|
+
expiration?: Date;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type AwsCredentialsProvider = () => AwsCredentialIdentity | Promise<AwsCredentialIdentity>;
|
|
30
|
+
|
|
31
|
+
export interface BedrockProviderOptions extends BedrockEndpointOptions, BedrockBearerOptions {
|
|
32
|
+
/** Explicit AWS access key ID. Must be paired with secretAccessKey. */
|
|
33
|
+
accessKeyId?: string | undefined;
|
|
34
|
+
|
|
35
|
+
/** Explicit AWS secret access key. Must be paired with accessKeyId. */
|
|
36
|
+
secretAccessKey?: string | undefined;
|
|
37
|
+
|
|
38
|
+
/** Optional session token for explicit temporary AWS credentials. */
|
|
39
|
+
sessionToken?: string | undefined;
|
|
40
|
+
|
|
41
|
+
/** Explicit AWS shared-config profile. */
|
|
42
|
+
profile?: string | undefined;
|
|
43
|
+
|
|
44
|
+
/** A refreshable provider returning AWS credentials. */
|
|
45
|
+
credentialProvider?: AwsCredentialsProvider | undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function validateStaticCredentials(options: BedrockProviderOptions): AwsCredentialIdentity | undefined {
|
|
49
|
+
const hasAccessKey = options.accessKeyId !== undefined;
|
|
50
|
+
const hasSecretKey = options.secretAccessKey !== undefined;
|
|
51
|
+
if (hasAccessKey !== hasSecretKey || (options.sessionToken !== undefined && !hasAccessKey)) {
|
|
52
|
+
throw new Errors.OpenAIError(
|
|
53
|
+
'The `accessKeyId` and `secretAccessKey` options must be provided together. A `sessionToken` may only be used with both.',
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
if (!hasAccessKey) return undefined;
|
|
57
|
+
|
|
58
|
+
if (
|
|
59
|
+
typeof options.accessKeyId !== 'string' ||
|
|
60
|
+
!options.accessKeyId.trim() ||
|
|
61
|
+
typeof options.secretAccessKey !== 'string' ||
|
|
62
|
+
!options.secretAccessKey.trim()
|
|
63
|
+
) {
|
|
64
|
+
throw new Errors.OpenAIError(
|
|
65
|
+
'Static AWS credentials require non-empty `accessKeyId` and `secretAccessKey` values.',
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
if (
|
|
69
|
+
options.sessionToken !== undefined &&
|
|
70
|
+
(typeof options.sessionToken !== 'string' || !options.sessionToken.trim())
|
|
71
|
+
) {
|
|
72
|
+
throw new Errors.OpenAIError('A static AWS `sessionToken` must not be empty when provided.');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
accessKeyId: options.accessKeyId,
|
|
77
|
+
secretAccessKey: options.secretAccessKey,
|
|
78
|
+
...(options.sessionToken ? { sessionToken: options.sessionToken } : {}),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function requestTarget(parsedURL: URL): { path: string; query: Record<string, string | string[]> } {
|
|
83
|
+
const query: Record<string, string | string[]> = {};
|
|
84
|
+
for (const [name, value] of parsedURL.searchParams) {
|
|
85
|
+
const existing = query[name];
|
|
86
|
+
query[name] =
|
|
87
|
+
existing === undefined ? value
|
|
88
|
+
: typeof existing === 'string' ? [existing, value]
|
|
89
|
+
: [...existing, value];
|
|
90
|
+
}
|
|
91
|
+
return { path: parsedURL.pathname, query };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function signableBody(body: BodyInit | null | undefined): string | ArrayBuffer | ArrayBufferView | undefined {
|
|
95
|
+
if (body === undefined || body === null) return undefined;
|
|
96
|
+
if (typeof body === 'string' || body instanceof ArrayBuffer || ArrayBuffer.isView(body)) return body;
|
|
97
|
+
throw new Errors.OpenAIError(
|
|
98
|
+
"The SDK's Bedrock SigV4 mode requires a replayable request body. Buffer the body before sending or use bearer authentication.",
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function validateCredentialIdentity(identity: AwsCredentialIdentity): AwsCredentialIdentity {
|
|
103
|
+
if (
|
|
104
|
+
typeof identity?.accessKeyId !== 'string' ||
|
|
105
|
+
!identity.accessKeyId.trim() ||
|
|
106
|
+
typeof identity.secretAccessKey !== 'string' ||
|
|
107
|
+
!identity.secretAccessKey.trim() ||
|
|
108
|
+
(identity.sessionToken !== undefined &&
|
|
109
|
+
(typeof identity.sessionToken !== 'string' || !identity.sessionToken.trim()))
|
|
110
|
+
) {
|
|
111
|
+
throw new Errors.OpenAIError(
|
|
112
|
+
'Failed to resolve AWS credentials for Bedrock. Verify your AWS profile, environment variables, or runtime identity configuration and try again.',
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
return identity;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
class BedrockSigV4Auth implements BedrockRequestAuth {
|
|
119
|
+
private signer: SignatureV4 | undefined;
|
|
120
|
+
private resolvedCredentialsProvider: (() => Promise<AwsCredentialIdentity>) | undefined;
|
|
121
|
+
|
|
122
|
+
constructor(
|
|
123
|
+
private readonly options: {
|
|
124
|
+
region: string;
|
|
125
|
+
staticCredentials?: AwsCredentialIdentity | undefined;
|
|
126
|
+
profile?: string | undefined;
|
|
127
|
+
credentialProvider?: AwsCredentialsProvider | undefined;
|
|
128
|
+
usesDefaultChain: boolean;
|
|
129
|
+
},
|
|
130
|
+
) {}
|
|
131
|
+
|
|
132
|
+
private credentialsProvider(): () => Promise<AwsCredentialIdentity> {
|
|
133
|
+
if (this.resolvedCredentialsProvider) return this.resolvedCredentialsProvider;
|
|
134
|
+
|
|
135
|
+
if (this.options.staticCredentials) {
|
|
136
|
+
const credentials = this.options.staticCredentials;
|
|
137
|
+
return (this.resolvedCredentialsProvider = async () => credentials);
|
|
138
|
+
}
|
|
139
|
+
if (this.options.credentialProvider) {
|
|
140
|
+
const provider = this.options.credentialProvider;
|
|
141
|
+
return (this.resolvedCredentialsProvider = async () => validateCredentialIdentity(await provider()));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const provider = defaultProvider(this.options.profile ? { profile: this.options.profile } : {});
|
|
145
|
+
return (this.resolvedCredentialsProvider = async () => validateCredentialIdentity(await provider()));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
private signatureV4(): SignatureV4 {
|
|
149
|
+
return (this.signer ??= new SignatureV4({
|
|
150
|
+
credentials: this.credentialsProvider(),
|
|
151
|
+
region: this.options.region,
|
|
152
|
+
service: BEDROCK_SERVICE,
|
|
153
|
+
sha256: Hash.bind(null, 'sha256'),
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
async prepareRequest(request: FinalizedRequestInit, { url }: ProviderRequestContext): Promise<void> {
|
|
158
|
+
if (Object.prototype.toString.call((globalThis as any).process) !== '[object process]') {
|
|
159
|
+
throw new Errors.OpenAIError(
|
|
160
|
+
'Bedrock AWS credential authentication is only supported in Node.js and compatible server runtimes. Use bearer authentication in this runtime.',
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const parsedURL = new URL(url);
|
|
165
|
+
const canonicalRegion = /^bedrock-mantle\.([a-z0-9-]+)\.api\.aws$/i.exec(parsedURL.hostname)?.[1];
|
|
166
|
+
if (canonicalRegion && canonicalRegion !== this.options.region) {
|
|
167
|
+
throw new Errors.OpenAIError(
|
|
168
|
+
`The Bedrock endpoint region \`${canonicalRegion}\` does not match the SigV4 region \`${this.options.region}\`.`,
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const headers = new Headers(request.headers);
|
|
173
|
+
assertProviderOwnsAuthorization(headers);
|
|
174
|
+
headers.delete('x-amz-date');
|
|
175
|
+
headers.delete('x-amz-security-token');
|
|
176
|
+
headers.delete('x-amz-content-sha256');
|
|
177
|
+
headers.set('host', parsedURL.host);
|
|
178
|
+
|
|
179
|
+
const method = (request.method ?? 'GET').toUpperCase();
|
|
180
|
+
const body = signableBody(request.body);
|
|
181
|
+
|
|
182
|
+
let signed: { headers: Record<string, string> };
|
|
183
|
+
try {
|
|
184
|
+
signed = await this.signatureV4().sign({
|
|
185
|
+
protocol: parsedURL.protocol,
|
|
186
|
+
hostname: parsedURL.hostname,
|
|
187
|
+
...(parsedURL.port ? { port: Number(parsedURL.port) } : {}),
|
|
188
|
+
method,
|
|
189
|
+
...requestTarget(parsedURL),
|
|
190
|
+
headers: Object.fromEntries(headers.entries()),
|
|
191
|
+
...(body !== undefined ? { body } : {}),
|
|
192
|
+
});
|
|
193
|
+
} catch (cause) {
|
|
194
|
+
const message =
|
|
195
|
+
this.options.usesDefaultChain ?
|
|
196
|
+
'Could not find credentials for Bedrock. Pass AWS credentials to `bedrock(...)` or configure the default AWS credential chain.'
|
|
197
|
+
: 'Failed to resolve AWS credentials for Bedrock. Verify your AWS profile, environment variables, or runtime identity configuration and try again.';
|
|
198
|
+
throw errorWithCause(message, cause);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
request.method = method;
|
|
202
|
+
request.redirect = 'manual';
|
|
203
|
+
request.headers = new Headers(signed.headers);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** Configure the standard OpenAI client for Amazon Bedrock using bearer or AWS authentication. */
|
|
208
|
+
export function bedrock(options: BedrockProviderOptions = {}): Provider {
|
|
209
|
+
const staticCredentials = validateStaticCredentials(options);
|
|
210
|
+
const profile = normalizeOptionalString(options.profile);
|
|
211
|
+
if (options.profile !== undefined && !profile) {
|
|
212
|
+
throw new Errors.OpenAIError('The Bedrock AWS `profile` must not be empty.');
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const awsModes = [!!staticCredentials, !!profile, !!options.credentialProvider].filter(Boolean).length;
|
|
216
|
+
if (awsModes > 1) {
|
|
217
|
+
throw new Errors.OpenAIError(
|
|
218
|
+
'Bedrock authentication is ambiguous. Configure exactly one explicit AWS mode: static credentials, profile, or credential provider.',
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
const explicitAwsAuth = awsModes === 1;
|
|
222
|
+
const bearerAuth = resolveBedrockBearerAuth(options, { allowEnvironment: !explicitAwsAuth });
|
|
223
|
+
if (bearerAuth.explicit && explicitAwsAuth) {
|
|
224
|
+
throw new Errors.OpenAIError(
|
|
225
|
+
'Bearer and AWS credential authentication are mutually exclusive. Configure exactly one explicit mode: bearer credential, static AWS credentials, profile, or credential provider.',
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const { region, baseURL } = resolveBedrockEndpoint(options);
|
|
230
|
+
if (!bearerAuth.factory && !region) {
|
|
231
|
+
throw new Errors.OpenAIError(
|
|
232
|
+
'Bedrock requires an AWS region. Pass `region` to `bedrock(...)`, or set `AWS_REGION` or `AWS_DEFAULT_REGION`.',
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
const credentialProvider = options.credentialProvider;
|
|
236
|
+
|
|
237
|
+
return createProvider({
|
|
238
|
+
configure() {
|
|
239
|
+
const auth =
|
|
240
|
+
bearerAuth.factory?.() ??
|
|
241
|
+
new BedrockSigV4Auth({
|
|
242
|
+
region: region!,
|
|
243
|
+
staticCredentials,
|
|
244
|
+
profile,
|
|
245
|
+
credentialProvider,
|
|
246
|
+
usesDefaultChain: !explicitAwsAuth,
|
|
247
|
+
});
|
|
248
|
+
return {
|
|
249
|
+
name: 'bedrock',
|
|
250
|
+
baseURL,
|
|
251
|
+
prepareRequest: auth.prepareRequest.bind(auth),
|
|
252
|
+
};
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as Errors from '../error';
|
|
2
|
+
import type { Provider } from '../internal/provider';
|
|
3
|
+
import { createProvider } from '../internal/provider';
|
|
4
|
+
import {
|
|
5
|
+
resolveBedrockBearerAuth,
|
|
6
|
+
resolveBedrockEndpoint,
|
|
7
|
+
type BedrockBearerOptions,
|
|
8
|
+
type BedrockEndpointOptions,
|
|
9
|
+
} from '../internal/bedrock';
|
|
10
|
+
|
|
11
|
+
export interface BedrockProviderOptions extends BedrockEndpointOptions, BedrockBearerOptions {}
|
|
12
|
+
|
|
13
|
+
/** Configure the standard OpenAI client for Amazon Bedrock using bearer authentication. */
|
|
14
|
+
export function bedrock(options: BedrockProviderOptions = {}): Provider {
|
|
15
|
+
const { baseURL } = resolveBedrockEndpoint(options);
|
|
16
|
+
const { factory } = resolveBedrockBearerAuth(options);
|
|
17
|
+
if (!factory) {
|
|
18
|
+
throw new Errors.OpenAIError(
|
|
19
|
+
'Bedrock bearer authentication requires an `apiKey`, `tokenProvider`, or `AWS_BEARER_TOKEN_BEDROCK`. For AWS credential authentication, import `bedrock` from `openai/providers/bedrock/aws`.',
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return createProvider({
|
|
24
|
+
configure() {
|
|
25
|
+
const auth = factory();
|
|
26
|
+
return {
|
|
27
|
+
name: 'bedrock',
|
|
28
|
+
baseURL,
|
|
29
|
+
prepareRequest: auth.prepareRequest.bind(auth),
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -83,16 +83,99 @@ export function isAzure(client: Pick<OpenAI, 'apiKey' | 'baseURL'>): client is A
|
|
|
83
83
|
return client instanceof AzureOpenAI;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
export
|
|
87
|
-
|
|
86
|
+
export type RealtimeConnectionConfig =
|
|
87
|
+
| {
|
|
88
|
+
/**
|
|
89
|
+
* Start a new Realtime session using the given model.
|
|
90
|
+
*/
|
|
91
|
+
model: string;
|
|
92
|
+
callID?: undefined;
|
|
93
|
+
}
|
|
94
|
+
| {
|
|
95
|
+
model?: undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Attach to an in-progress Realtime call over a sideband control connection.
|
|
98
|
+
*/
|
|
99
|
+
callID: string;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type AzureRealtimeConnectionConfig =
|
|
103
|
+
| {
|
|
104
|
+
/**
|
|
105
|
+
* Override the deployment configured on the Azure client.
|
|
106
|
+
*/
|
|
107
|
+
deploymentName?: string;
|
|
108
|
+
callID?: undefined;
|
|
109
|
+
}
|
|
110
|
+
| {
|
|
111
|
+
deploymentName?: undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Attach to an in-progress Azure Realtime call over a sideband control connection.
|
|
114
|
+
*/
|
|
115
|
+
callID: string;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export function buildRealtimeURL(
|
|
119
|
+
client: Pick<OpenAI, 'apiKey' | 'baseURL'>,
|
|
120
|
+
connection: string | RealtimeConnectionConfig,
|
|
121
|
+
): URL {
|
|
122
|
+
const config: RealtimeConnectionConfig =
|
|
123
|
+
typeof connection === 'string' ? { model: connection } : connection;
|
|
88
124
|
const baseURL = client.baseURL;
|
|
89
|
-
const
|
|
125
|
+
const azure = isAzure(client);
|
|
126
|
+
const hasModel = !!config.model;
|
|
127
|
+
const hasCallID = !!config.callID;
|
|
128
|
+
|
|
129
|
+
if (hasModel === hasCallID) {
|
|
130
|
+
throw new Error('Pass exactly one of `model` or `callID` when opening a Realtime WebSocket.');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
let url: URL;
|
|
134
|
+
if (azure && hasCallID) {
|
|
135
|
+
url = new URL(baseURL);
|
|
136
|
+
const basePath = url.pathname.replace(/\/+/g, '/').replace(/\/+$/, '');
|
|
137
|
+
const versionedPath = basePath.endsWith('/v1') ? basePath : `${basePath}/v1`;
|
|
138
|
+
url.pathname = `${versionedPath}/realtime`;
|
|
139
|
+
url.search = '';
|
|
140
|
+
url.hash = '';
|
|
141
|
+
} else {
|
|
142
|
+
const path = '/realtime';
|
|
143
|
+
url = new URL(baseURL + (baseURL.endsWith('/') ? path.slice(1) : path));
|
|
144
|
+
}
|
|
145
|
+
|
|
90
146
|
url.protocol = 'wss';
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
147
|
+
// Sideband control connections attach to an existing call via `call_id`.
|
|
148
|
+
if (azure) {
|
|
149
|
+
if (hasCallID) {
|
|
150
|
+
url.searchParams.set('call_id', config.callID!);
|
|
151
|
+
} else {
|
|
152
|
+
url.searchParams.set('api-version', client.apiVersion);
|
|
153
|
+
url.searchParams.set('deployment', config.model!);
|
|
154
|
+
}
|
|
94
155
|
} else {
|
|
95
|
-
|
|
156
|
+
if (hasCallID) {
|
|
157
|
+
url.searchParams.set('call_id', config.callID!);
|
|
158
|
+
} else {
|
|
159
|
+
url.searchParams.set('model', config.model!);
|
|
160
|
+
}
|
|
96
161
|
}
|
|
97
162
|
return url;
|
|
98
163
|
}
|
|
164
|
+
|
|
165
|
+
export function getAzureRealtimeConnection(
|
|
166
|
+
client: Pick<AzureOpenAI, 'deploymentName'>,
|
|
167
|
+
connection: AzureRealtimeConnectionConfig,
|
|
168
|
+
): RealtimeConnectionConfig {
|
|
169
|
+
if (connection.callID !== undefined) {
|
|
170
|
+
if (connection.deploymentName !== undefined) {
|
|
171
|
+
throw new Error('Pass either `deploymentName` or `callID`, but not both.');
|
|
172
|
+
}
|
|
173
|
+
return { callID: connection.callID };
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const model = connection.deploymentName ?? client.deploymentName;
|
|
177
|
+
if (!model) {
|
|
178
|
+
throw new Error('No deployment name provided');
|
|
179
|
+
}
|
|
180
|
+
return { model };
|
|
181
|
+
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { AzureOpenAI, OpenAI } from '../index';
|
|
2
2
|
import { OpenAIError } from '../error';
|
|
3
3
|
import type { RealtimeClientEvent, RealtimeServerEvent } from '../resources/realtime/realtime';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
OpenAIRealtimeEmitter,
|
|
6
|
+
buildRealtimeURL,
|
|
7
|
+
getAzureRealtimeConnection,
|
|
8
|
+
isAzure,
|
|
9
|
+
type AzureRealtimeConnectionConfig,
|
|
10
|
+
type RealtimeConnectionConfig,
|
|
11
|
+
} from './internal-base';
|
|
5
12
|
import { isRunningInBrowser } from '../internal/detect-platform';
|
|
6
13
|
|
|
7
14
|
interface MessageEvent {
|
|
@@ -23,8 +30,7 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
|
|
|
23
30
|
socket: _WebSocket;
|
|
24
31
|
|
|
25
32
|
constructor(
|
|
26
|
-
props: {
|
|
27
|
-
model: string;
|
|
33
|
+
props: RealtimeConnectionConfig & {
|
|
28
34
|
dangerouslyAllowBrowser?: boolean;
|
|
29
35
|
/**
|
|
30
36
|
* Callback to mutate the URL, needed for Azure.
|
|
@@ -54,13 +60,12 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
|
|
|
54
60
|
throw new Error(
|
|
55
61
|
[
|
|
56
62
|
'Cannot open Realtime WebSocket with a function-based apiKey.',
|
|
57
|
-
'Use the .create() method so that the key is resolved before connecting
|
|
58
|
-
'await OpenAIRealtimeWebSocket.create(client, { model })',
|
|
63
|
+
'Use the .create() method so that the key is resolved before connecting.',
|
|
59
64
|
].join('\n'),
|
|
60
65
|
);
|
|
61
66
|
}
|
|
62
67
|
|
|
63
|
-
this.url = buildRealtimeURL(client, props
|
|
68
|
+
this.url = buildRealtimeURL(client, props);
|
|
64
69
|
props.onURL?.(this.url);
|
|
65
70
|
|
|
66
71
|
// @ts-ignore
|
|
@@ -106,15 +111,16 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
|
|
|
106
111
|
|
|
107
112
|
static async create(
|
|
108
113
|
client: Pick<OpenAI, 'apiKey' | 'baseURL' | '_callApiKey'>,
|
|
109
|
-
props:
|
|
114
|
+
props: RealtimeConnectionConfig & { dangerouslyAllowBrowser?: boolean },
|
|
110
115
|
): Promise<OpenAIRealtimeWebSocket> {
|
|
111
116
|
return new OpenAIRealtimeWebSocket({ ...props, __resolvedApiKey: await client._callApiKey() }, client);
|
|
112
117
|
}
|
|
113
118
|
|
|
114
119
|
static async azure(
|
|
115
120
|
client: Pick<AzureOpenAI, '_callApiKey' | 'apiVersion' | 'apiKey' | 'baseURL' | 'deploymentName'>,
|
|
116
|
-
options:
|
|
121
|
+
options: AzureRealtimeConnectionConfig & { dangerouslyAllowBrowser?: boolean } = {},
|
|
117
122
|
): Promise<OpenAIRealtimeWebSocket> {
|
|
123
|
+
const connection = getAzureRealtimeConnection(client, options);
|
|
118
124
|
const isApiKeyProvider = await client._callApiKey();
|
|
119
125
|
const apiKey = client.apiKey;
|
|
120
126
|
if (!apiKey) {
|
|
@@ -128,14 +134,10 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
|
|
|
128
134
|
url.searchParams.set('api-key', azureApiKey);
|
|
129
135
|
}
|
|
130
136
|
}
|
|
131
|
-
const deploymentName = options.deploymentName ?? client.deploymentName;
|
|
132
|
-
if (!deploymentName) {
|
|
133
|
-
throw new Error('No deployment name provided');
|
|
134
|
-
}
|
|
135
137
|
const { dangerouslyAllowBrowser } = options;
|
|
136
138
|
return new OpenAIRealtimeWebSocket(
|
|
137
139
|
{
|
|
138
|
-
|
|
140
|
+
...connection,
|
|
139
141
|
onURL,
|
|
140
142
|
...(dangerouslyAllowBrowser ? { dangerouslyAllowBrowser } : {}),
|
|
141
143
|
__resolvedApiKey: isApiKeyProvider,
|