@songtonyli/dsh-cli 0.1.55 → 0.1.57
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/README.md +1 -1
- package/bin/dsh.mjs +1 -1
- package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/package.json +6 -6
- package/node_modules/@aws-sdk/token-providers/package.json +6 -6
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/symbols.js +17 -1
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/embed.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/file.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/symbols.js +60 -41
- package/node_modules/@bufbuild/protobuf/dist/commonjs/create.js +2 -1
- package/node_modules/@bufbuild/protobuf/dist/commonjs/from-binary.js +9 -6
- package/node_modules/@bufbuild/protobuf/dist/commonjs/from-json.js +30 -12
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/message.js +3 -2
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect-check.js +3 -4
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/unsafe.js +31 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/registry.js +53 -5
- package/node_modules/@bufbuild/protobuf/dist/commonjs/to-json.js +27 -5
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/binary-encoding.js +5 -3
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/any.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/duration.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/{gen/google → google}/protobuf/any_pb.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/{gen/google → google}/protobuf/api_pb.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/google/protobuf/c_sharp_features_pb.js +33 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/{gen/google → google}/protobuf/compiler/plugin_pb.js +3 -3
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/{gen/google → google}/protobuf/cpp_features_pb.js +34 -6
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/google/protobuf/cpp_file_options_pb.js +33 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/google/protobuf/cpp_options_pb.js +22 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/{gen/google → google}/protobuf/descriptor_pb.js +49 -6
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/{gen/google → google}/protobuf/duration_pb.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/{gen/google → google}/protobuf/empty_pb.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/{gen/google → google}/protobuf/field_mask_pb.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/{gen/google → google}/protobuf/go_features_pb.js +4 -4
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/{gen/google → google}/protobuf/java_features_pb.js +4 -4
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/google/protobuf/json_enumvalue_options_pb.js +33 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/google/protobuf/json_options_pb.js +22 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/{gen/google → google}/protobuf/source_context_pb.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/{gen/google → google}/protobuf/struct_pb.js +11 -6
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/{gen/google → google}/protobuf/timestamp_pb.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/{gen/google → google}/protobuf/type_pb.js +3 -3
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/{gen/google → google}/protobuf/wrappers_pb.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/index.js +15 -15
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/timestamp.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/symbols.js +18 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/embed.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/file.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/symbols.js +60 -41
- package/node_modules/@bufbuild/protobuf/dist/esm/create.js +2 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js +10 -7
- package/node_modules/@bufbuild/protobuf/dist/esm/from-json.js +31 -13
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/message.js +3 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-check.js +4 -5
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect.js +3 -3
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/unsafe.js +29 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/registry.js +53 -5
- package/node_modules/@bufbuild/protobuf/dist/esm/to-json.js +28 -6
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js +5 -3
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/any.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/duration.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/{gen/google → google}/protobuf/any_pb.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/{gen/google → google}/protobuf/api_pb.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/google/protobuf/c_sharp_features_pb.js +30 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/{gen/google → google}/protobuf/compiler/plugin_pb.js +3 -3
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/{gen/google → google}/protobuf/cpp_features_pb.js +33 -5
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/google/protobuf/cpp_file_options_pb.js +30 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/google/protobuf/cpp_options_pb.js +19 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/{gen/google → google}/protobuf/descriptor_pb.js +47 -4
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/{gen/google → google}/protobuf/duration_pb.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/{gen/google → google}/protobuf/empty_pb.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/{gen/google → google}/protobuf/field_mask_pb.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/{gen/google → google}/protobuf/go_features_pb.js +4 -4
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/{gen/google → google}/protobuf/java_features_pb.js +4 -4
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/google/protobuf/json_enumvalue_options_pb.js +30 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/google/protobuf/json_options_pb.js +19 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/{gen/google → google}/protobuf/source_context_pb.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/{gen/google → google}/protobuf/struct_pb.js +11 -6
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/{gen/google → google}/protobuf/timestamp_pb.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/{gen/google → google}/protobuf/type_pb.js +3 -3
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/{gen/google → google}/protobuf/wrappers_pb.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/index.js +15 -15
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/timestamp.js +1 -1
- package/node_modules/@bufbuild/protobuf/package.json +236 -13
- package/node_modules/@deepseek-ai/dsh-client-ui-primitives/package.json +2 -2
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-slots/package.json +2 -2
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/README.md +1 -1
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/README.zh.md +1 -1
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/index.js +1 -182
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +8 -8
- package/node_modules/@deepseek-ai/dsh-tui-app/README.md +15 -4
- package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +15 -4
- package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +692 -43
- package/node_modules/@earendil-works/pi-ai/README.md +207 -27
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +6 -5
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-workers-ai-system-one.js +43 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-workers-ai-system-one.lazy.js +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/llama-cpp-classify.js +365 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/llama-cpp-classify.lazy.js +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +18 -17
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +20 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +4 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +14 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +26 -9
- package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +2 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.js +183 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/typesafe-system-one.js +19 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/typesafe-system-one.lazy.js +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/helpers.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.js +19 -128
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/callback-server.js +146 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js +5 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-chatgpt.js +266 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js +20 -124
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js +19 -138
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.js +21 -89
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +3 -19
- package/node_modules/@earendil-works/pi-ai/dist/bun-oauth.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/cli.js +3 -1
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.js +14 -13
- package/node_modules/@earendil-works/pi-ai/dist/images.js +5 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.js +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/model-catalog.js +14 -2
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +131 -41
- package/node_modules/@earendil-works/pi-ai/dist/models.js +157 -30
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +25 -21
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/baseten.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-stream.js +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.js +10 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/ant-ling.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cerebras.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/deepseek.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/google-vertex.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/groq.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/meta.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-individual.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/typesafe.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-ams.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-sgp.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/google.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/meta.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai.js +11 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.js +5 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js +11 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/radius.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/together.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/typesafe.js +18 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/typesafe.models.js +8 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.js +5 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/utils/headers.js +10 -8
- package/node_modules/@earendil-works/pi-ai/dist/utils/model-operations.js +47 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/models-error.js +19 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +7 -0
- package/node_modules/@earendil-works/pi-ai/package.json +4 -4
- package/node_modules/@earendil-works/pi-telemetry/package.json +2 -2
- package/node_modules/openai/CHANGELOG.md +1089 -1
- package/node_modules/openai/README.md +201 -102
- package/node_modules/openai/_vendor/partial-json-parser/parser.js +55 -38
- package/node_modules/openai/_vendor/partial-json-parser/parser.mjs +55 -38
- package/node_modules/openai/_vendor/zod-to-json-schema/Options.js +11 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/Options.mjs +11 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/Refs.js +4 -4
- package/node_modules/openai/_vendor/zod-to-json-schema/Refs.mjs +4 -4
- package/node_modules/openai/_vendor/zod-to-json-schema/errorMessages.js +2 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/errorMessages.mjs +2 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/index.js +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/index.mjs +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parseDef.js +139 -54
- package/node_modules/openai/_vendor/zod-to-json-schema/parseDef.mjs +139 -54
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/array.js +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/array.mjs +1 -1
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/bigint.js +10 -4
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/bigint.mjs +10 -4
- 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.mjs +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.js +1 -3
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/catch.mjs +1 -3
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/date.js +10 -5
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/date.mjs +10 -5
- 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.mjs +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/intersection.js +6 -5
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/intersection.mjs +6 -5
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/literal.js +5 -0
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/literal.mjs +5 -0
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nativeEnum.js +7 -9
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nativeEnum.mjs +7 -9
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/null.js +3 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/null.mjs +3 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.js +8 -3
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/nullable.mjs +8 -3
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/number.js +12 -5
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/number.mjs +12 -5
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/object.js +43 -38
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/object.mjs +43 -38
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.js +11 -12
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/optional.mjs +11 -12
- 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.mjs +3 -3
- 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.mjs +2 -2
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.js +1 -3
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/readonly.mjs +1 -3
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/record.js +7 -5
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/record.mjs +7 -5
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/string.js +57 -34
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/string.mjs +57 -34
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/tuple.js +24 -19
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/tuple.mjs +24 -19
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/union.js +46 -24
- package/node_modules/openai/_vendor/zod-to-json-schema/parsers/union.mjs +46 -24
- package/node_modules/openai/_vendor/zod-to-json-schema/util.js +7 -5
- package/node_modules/openai/_vendor/zod-to-json-schema/util.mjs +7 -5
- package/node_modules/openai/_vendor/zod-to-json-schema/zodToJsonSchema.js +110 -38
- package/node_modules/openai/_vendor/zod-to-json-schema/zodToJsonSchema.mjs +110 -38
- package/node_modules/openai/auth/subject-token-providers.js +235 -10
- package/node_modules/openai/auth/subject-token-providers.mjs +235 -10
- package/node_modules/openai/auth/workload-identity-auth.js +185 -24
- package/node_modules/openai/auth/workload-identity-auth.mjs +186 -25
- package/node_modules/openai/auth/x509-transport.js +273 -0
- package/node_modules/openai/auth/x509-transport.mjs +268 -0
- package/node_modules/openai/azure.js +74 -21
- package/node_modules/openai/azure.mjs +75 -22
- package/node_modules/openai/bedrock.js +174 -0
- package/node_modules/openai/bedrock.mjs +169 -0
- package/node_modules/openai/beta/realtime/internal-base.js +71 -10
- package/node_modules/openai/beta/realtime/internal-base.mjs +70 -10
- package/node_modules/openai/beta/realtime/websocket.js +180 -33
- package/node_modules/openai/beta/realtime/websocket.mjs +181 -34
- package/node_modules/openai/beta/realtime/ws.js +93 -14
- package/node_modules/openai/beta/realtime/ws.mjs +94 -15
- package/node_modules/openai/client.js +745 -99
- package/node_modules/openai/client.mjs +747 -101
- package/node_modules/openai/core/EventEmitter.js +127 -16
- package/node_modules/openai/core/EventEmitter.mjs +128 -17
- package/node_modules/openai/core/api-promise.js +0 -1
- package/node_modules/openai/core/api-promise.mjs +0 -1
- package/node_modules/openai/core/error.js +5 -5
- package/node_modules/openai/core/error.mjs +5 -5
- package/node_modules/openai/core/pagination.js +33 -3
- package/node_modules/openai/core/pagination.mjs +31 -2
- package/node_modules/openai/core/resource.js +0 -1
- package/node_modules/openai/core/resource.mjs +0 -1
- package/node_modules/openai/core/streaming.js +453 -88
- package/node_modules/openai/core/streaming.mjs +454 -89
- package/node_modules/openai/core/uploads.js +3 -1
- package/node_modules/openai/core/uploads.mjs +1 -0
- package/node_modules/openai/helpers/audio.js +198 -28
- package/node_modules/openai/helpers/audio.mjs +199 -29
- package/node_modules/openai/helpers/live.js +6 -0
- package/node_modules/openai/helpers/live.mjs +2 -0
- package/node_modules/openai/helpers/standard-schema.js +393 -0
- package/node_modules/openai/helpers/standard-schema.mjs +387 -0
- package/node_modules/openai/helpers/zod-v3-strict-schema.js +408 -0
- package/node_modules/openai/helpers/zod-v3-strict-schema.mjs +404 -0
- package/node_modules/openai/helpers/zod.js +221 -24
- package/node_modules/openai/helpers/zod.mjs +222 -26
- package/node_modules/openai/index.js +8 -7
- package/node_modules/openai/index.mjs +2 -2
- package/node_modules/openai/internal/assistant-stream-delta.js +316 -0
- package/node_modules/openai/internal/assistant-stream-delta.mjs +308 -0
- package/node_modules/openai/internal/auth/x509-api-origin.js +28 -0
- package/node_modules/openai/internal/auth/x509-api-origin.mjs +24 -0
- package/node_modules/openai/internal/auth/x509-credential-options.js +125 -0
- package/node_modules/openai/internal/auth/x509-credential-options.mjs +121 -0
- package/node_modules/openai/internal/auth/x509-token-exchange.js +248 -0
- package/node_modules/openai/internal/auth/x509-token-exchange.mjs +245 -0
- package/node_modules/openai/internal/auth/x509-transport-capability.js +171 -0
- package/node_modules/openai/internal/auth/x509-transport-capability.mjs +166 -0
- package/node_modules/openai/internal/auth/x509-transport-registry.js +53 -0
- package/node_modules/openai/internal/auth/x509-transport-registry.mjs +48 -0
- package/node_modules/openai/internal/auth/x509-transport-state-browser.js +35 -0
- package/node_modules/openai/internal/auth/x509-transport-state-browser.mjs +32 -0
- package/node_modules/openai/internal/auth/x509-transport-state.cjs +35 -0
- package/node_modules/openai/internal/auth/x509-transport-state.js +36 -0
- package/node_modules/openai/internal/auth/x509-transport-state.mjs +20 -0
- package/node_modules/openai/internal/auth/x509-workload-identity-auth.js +787 -0
- package/node_modules/openai/internal/auth/x509-workload-identity-auth.mjs +778 -0
- package/node_modules/openai/internal/bedrock.js +438 -0
- package/node_modules/openai/internal/bedrock.mjs +424 -0
- package/node_modules/openai/internal/builtin-types.js +0 -1
- package/node_modules/openai/internal/builtin-types.mjs +0 -1
- package/node_modules/openai/internal/data-residency.js +34 -0
- package/node_modules/openai/internal/data-residency.mjs +30 -0
- package/node_modules/openai/internal/decoders/line.js +140 -54
- package/node_modules/openai/internal/decoders/line.mjs +141 -55
- package/node_modules/openai/internal/detect-platform.js +3 -4
- package/node_modules/openai/internal/detect-platform.mjs +3 -4
- package/node_modules/openai/internal/errors.js +3 -3
- package/node_modules/openai/internal/errors.mjs +3 -3
- package/node_modules/openai/internal/headers.js +11 -9
- package/node_modules/openai/internal/headers.mjs +11 -9
- package/node_modules/openai/internal/multipart-encoding.js +51 -0
- package/node_modules/openai/internal/multipart-encoding.mjs +48 -0
- package/node_modules/openai/internal/parse.js +35 -11
- package/node_modules/openai/internal/parse.mjs +35 -11
- package/node_modules/openai/internal/provider.js +50 -0
- package/node_modules/openai/internal/provider.mjs +46 -0
- package/node_modules/openai/internal/qs/formats.js +1 -2
- package/node_modules/openai/internal/qs/formats.mjs +1 -1
- package/node_modules/openai/internal/qs/stringify.js +60 -51
- package/node_modules/openai/internal/qs/stringify.mjs +60 -51
- package/node_modules/openai/internal/qs/utils.js +368 -50
- package/node_modules/openai/internal/qs/utils.mjs +368 -50
- package/node_modules/openai/internal/realtime-credentials.js +23 -0
- package/node_modules/openai/internal/realtime-credentials.mjs +19 -0
- package/node_modules/openai/internal/request-options.js +43 -2
- package/node_modules/openai/internal/request-options.mjs +42 -2
- package/node_modules/openai/internal/responses/canonical-output-text.js +123 -0
- package/node_modules/openai/internal/responses/canonical-output-text.mjs +115 -0
- package/node_modules/openai/internal/responses/output-text-index.js +77 -0
- package/node_modules/openai/internal/responses/output-text-index.mjs +73 -0
- package/node_modules/openai/internal/responses/response-accumulator.js +942 -0
- package/node_modules/openai/internal/responses/response-accumulator.mjs +938 -0
- package/node_modules/openai/internal/shim-types.js +6 -1
- package/node_modules/openai/internal/shim-types.mjs +6 -1
- package/node_modules/openai/internal/shims.js +6 -1
- package/node_modules/openai/internal/shims.mjs +6 -1
- package/node_modules/openai/internal/stream-utils.js +35 -7
- package/node_modules/openai/internal/stream-utils.mjs +35 -7
- package/node_modules/openai/internal/to-file.js +47 -24
- package/node_modules/openai/internal/to-file.mjs +47 -24
- package/node_modules/openai/internal/tslib.js +6 -0
- package/node_modules/openai/internal/tslib.mjs +6 -1
- package/node_modules/openai/internal/types.js +0 -1
- package/node_modules/openai/internal/types.mjs +0 -1
- package/node_modules/openai/internal/uploads.js +377 -43
- package/node_modules/openai/internal/uploads.mjs +376 -44
- package/node_modules/openai/internal/utils/abort.js +94 -0
- package/node_modules/openai/internal/utils/abort.mjs +90 -0
- package/node_modules/openai/internal/utils/base64.js +3 -1
- package/node_modules/openai/internal/utils/base64.mjs +3 -1
- package/node_modules/openai/internal/utils/bytes.js +5 -0
- package/node_modules/openai/internal/utils/bytes.mjs +5 -0
- package/node_modules/openai/internal/utils/env.js +9 -5
- package/node_modules/openai/internal/utils/env.mjs +9 -5
- package/node_modules/openai/internal/utils/log.js +73 -11
- package/node_modules/openai/internal/utils/log.mjs +70 -11
- package/node_modules/openai/internal/utils/path.js +50 -30
- package/node_modules/openai/internal/utils/path.mjs +50 -30
- package/node_modules/openai/internal/utils/query.js +0 -1
- package/node_modules/openai/internal/utils/query.mjs +0 -1
- package/node_modules/openai/internal/utils/sleep.js +51 -2
- package/node_modules/openai/internal/utils/sleep.mjs +51 -2
- package/node_modules/openai/internal/utils/uuid.js +0 -1
- package/node_modules/openai/internal/utils/uuid.mjs +0 -1
- package/node_modules/openai/internal/utils/values.js +0 -1
- package/node_modules/openai/internal/utils/values.mjs +0 -1
- package/node_modules/openai/internal/utils.js +0 -1
- package/node_modules/openai/internal/utils.mjs +0 -1
- package/node_modules/openai/internal/ws-adapter-browser.js +66 -21
- package/node_modules/openai/internal/ws-adapter-browser.mjs +66 -21
- package/node_modules/openai/internal/ws-adapter-node.js +90 -24
- package/node_modules/openai/internal/ws-adapter-node.mjs +90 -24
- package/node_modules/openai/internal/ws-adapter.js +4 -0
- package/node_modules/openai/internal/ws-adapter.mjs +4 -0
- package/node_modules/openai/internal/ws.js +193 -48
- package/node_modules/openai/internal/ws.mjs +188 -49
- package/node_modules/openai/lib/AbstractChatCompletionRunner.js +254 -72
- package/node_modules/openai/lib/AbstractChatCompletionRunner.mjs +256 -74
- package/node_modules/openai/lib/AssistantStream.js +430 -259
- package/node_modules/openai/lib/AssistantStream.mjs +432 -261
- package/node_modules/openai/lib/ChatCompletionRunner.js +12 -5
- package/node_modules/openai/lib/ChatCompletionRunner.mjs +13 -6
- package/node_modules/openai/lib/ChatCompletionStream.js +1430 -189
- package/node_modules/openai/lib/ChatCompletionStream.mjs +1433 -193
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.js +40 -2
- package/node_modules/openai/lib/ChatCompletionStreamingRunner.mjs +41 -3
- package/node_modules/openai/lib/EventEmitter.js +124 -16
- package/node_modules/openai/lib/EventEmitter.mjs +125 -17
- package/node_modules/openai/lib/EventStream.js +1533 -55
- package/node_modules/openai/lib/EventStream.mjs +1534 -56
- package/node_modules/openai/lib/ResponsesParser.js +68 -29
- package/node_modules/openai/lib/ResponsesParser.mjs +69 -30
- package/node_modules/openai/lib/RunnableFunction.js +3 -0
- package/node_modules/openai/lib/RunnableFunction.mjs +3 -0
- package/node_modules/openai/lib/Util.js +7 -4
- package/node_modules/openai/lib/Util.mjs +7 -4
- package/node_modules/openai/lib/agents/agent-session-stream.js +274 -0
- package/node_modules/openai/lib/agents/agent-session-stream.mjs +270 -0
- package/node_modules/openai/lib/agents/output-text.js +8 -0
- package/node_modules/openai/lib/agents/output-text.mjs +5 -0
- package/node_modules/openai/lib/agents/turn-state.js +62 -0
- package/node_modules/openai/lib/agents/turn-state.mjs +58 -0
- package/node_modules/openai/lib/assistant-run-polling.js +17 -0
- package/node_modules/openai/lib/assistant-run-polling.mjs +14 -0
- package/node_modules/openai/lib/chatCompletionUtils.js +5 -6
- package/node_modules/openai/lib/chatCompletionUtils.mjs +5 -6
- package/node_modules/openai/lib/embeddings.js +58 -0
- package/node_modules/openai/lib/embeddings.mjs +55 -0
- package/node_modules/openai/lib/file-processing.js +31 -0
- package/node_modules/openai/lib/file-processing.mjs +28 -0
- package/node_modules/openai/lib/live/transcript-grouper.js +229 -0
- package/node_modules/openai/lib/live/transcript-grouper.mjs +225 -0
- package/node_modules/openai/lib/live/transcript-grouping.js +309 -0
- package/node_modules/openai/lib/live/transcript-grouping.mjs +305 -0
- package/node_modules/openai/lib/live/webrtc.js +16 -0
- package/node_modules/openai/lib/live/webrtc.mjs +10 -0
- package/node_modules/openai/lib/parser.js +142 -42
- package/node_modules/openai/lib/parser.mjs +140 -42
- package/node_modules/openai/lib/polling.js +131 -0
- package/node_modules/openai/lib/polling.mjs +128 -0
- package/node_modules/openai/lib/realtime/webrtc.js +16 -0
- package/node_modules/openai/lib/realtime/webrtc.mjs +10 -0
- package/node_modules/openai/lib/responses/ResponseAccumulator.js +15 -0
- package/node_modules/openai/lib/responses/ResponseAccumulator.mjs +12 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.js +139 -0
- package/node_modules/openai/lib/responses/ResponseInputItems.mjs +135 -0
- package/node_modules/openai/lib/responses/ResponseStream.js +85 -159
- package/node_modules/openai/lib/responses/ResponseStream.mjs +86 -160
- package/node_modules/openai/lib/responses/responses-websocket-lane.js +314 -0
- package/node_modules/openai/lib/responses/responses-websocket-lane.mjs +309 -0
- package/node_modules/openai/lib/responses/responses-websocket-session.js +268 -0
- package/node_modules/openai/lib/responses/responses-websocket-session.mjs +263 -0
- package/node_modules/openai/lib/transform.js +1608 -82
- package/node_modules/openai/lib/transform.mjs +1602 -82
- package/node_modules/openai/lib/vector-store-polling.js +24 -0
- package/node_modules/openai/lib/vector-store-polling.mjs +20 -0
- package/node_modules/openai/lib/vector-store-upload.js +41 -0
- package/node_modules/openai/lib/vector-store-upload.mjs +38 -0
- package/node_modules/openai/lib/webhook-signature.js +125 -0
- package/node_modules/openai/lib/webhook-signature.mjs +121 -0
- package/node_modules/openai/lib/webrtc/connection.js +233 -0
- package/node_modules/openai/lib/webrtc/connection.mjs +229 -0
- package/node_modules/openai/lib/webrtc/data-channel.js +133 -0
- package/node_modules/openai/lib/webrtc/data-channel.mjs +129 -0
- package/node_modules/openai/lib/webrtc/errors.js +18 -0
- package/node_modules/openai/lib/webrtc/errors.mjs +14 -0
- package/node_modules/openai/lib/webrtc/subscriptions.js +64 -0
- package/node_modules/openai/lib/webrtc/subscriptions.mjs +60 -0
- package/node_modules/openai/lib/webrtc/types.js +3 -0
- package/node_modules/openai/lib/webrtc/types.mjs +2 -0
- package/node_modules/openai/live/webrtc.js +8 -0
- package/node_modules/openai/live/webrtc.mjs +2 -0
- package/node_modules/openai/package.json +71 -11
- package/node_modules/openai/providers/bedrock/aws.js +211 -0
- package/node_modules/openai/providers/bedrock/aws.mjs +207 -0
- package/node_modules/openai/providers/bedrock.js +43 -0
- package/node_modules/openai/providers/bedrock.mjs +39 -0
- package/node_modules/openai/realtime/internal-base.js +118 -11
- package/node_modules/openai/realtime/internal-base.mjs +116 -11
- package/node_modules/openai/realtime/webrtc.js +8 -0
- package/node_modules/openai/realtime/webrtc.mjs +2 -0
- package/node_modules/openai/realtime/websocket.js +174 -39
- package/node_modules/openai/realtime/websocket.mjs +175 -40
- package/node_modules/openai/realtime/ws.js +86 -18
- package/node_modules/openai/realtime/ws.mjs +87 -19
- package/node_modules/openai/resources/admin/admin.js +1 -1
- package/node_modules/openai/resources/admin/admin.mjs +1 -1
- package/node_modules/openai/resources/admin/index.js +1 -1
- package/node_modules/openai/resources/admin/index.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/admin-api-keys.js +1 -1
- package/node_modules/openai/resources/admin/organization/admin-api-keys.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/audit-logs.js +1 -1
- package/node_modules/openai/resources/admin/organization/audit-logs.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/certificates.js +1 -1
- package/node_modules/openai/resources/admin/organization/certificates.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/data-retention.js +1 -1
- package/node_modules/openai/resources/admin/organization/data-retention.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/groups/groups.js +1 -1
- package/node_modules/openai/resources/admin/organization/groups/groups.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/groups/index.js +1 -1
- package/node_modules/openai/resources/admin/organization/groups/index.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/groups/roles.js +1 -1
- package/node_modules/openai/resources/admin/organization/groups/roles.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/groups/users.js +1 -1
- package/node_modules/openai/resources/admin/organization/groups/users.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/groups.js +1 -1
- package/node_modules/openai/resources/admin/organization/groups.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/index.js +4 -2
- package/node_modules/openai/resources/admin/organization/index.mjs +2 -1
- package/node_modules/openai/resources/admin/organization/invites.js +1 -1
- package/node_modules/openai/resources/admin/organization/invites.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/organization.js +5 -1
- package/node_modules/openai/resources/admin/organization/organization.mjs +5 -1
- package/node_modules/openai/resources/admin/organization/projects/api-keys.js +1 -1
- package/node_modules/openai/resources/admin/organization/projects/api-keys.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/projects/certificates.js +1 -1
- package/node_modules/openai/resources/admin/organization/projects/certificates.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/projects/data-retention.js +1 -1
- package/node_modules/openai/resources/admin/organization/projects/data-retention.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/projects/groups/groups.js +1 -1
- package/node_modules/openai/resources/admin/organization/projects/groups/groups.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/projects/groups/index.js +1 -1
- package/node_modules/openai/resources/admin/organization/projects/groups/index.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/projects/groups/roles.js +1 -1
- package/node_modules/openai/resources/admin/organization/projects/groups/roles.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/projects/groups.js +1 -1
- package/node_modules/openai/resources/admin/organization/projects/groups.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/projects/hosted-tool-permissions.js +1 -1
- package/node_modules/openai/resources/admin/organization/projects/hosted-tool-permissions.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.js +8 -6
- package/node_modules/openai/resources/admin/organization/projects/index.mjs +3 -2
- package/node_modules/openai/resources/admin/organization/projects/model-permissions.js +1 -1
- package/node_modules/openai/resources/admin/organization/projects/model-permissions.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.js +7 -3
- package/node_modules/openai/resources/admin/organization/projects/projects.mjs +7 -3
- package/node_modules/openai/resources/admin/organization/projects/rate-limits.js +1 -1
- package/node_modules/openai/resources/admin/organization/projects/rate-limits.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/projects/roles.js +1 -1
- package/node_modules/openai/resources/admin/organization/projects/roles.mjs +1 -1
- 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.mjs +22 -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.mjs +4 -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.mjs +104 -0
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.js +3 -98
- package/node_modules/openai/resources/admin/organization/projects/service-accounts.mjs +2 -96
- package/node_modules/openai/resources/admin/organization/projects/spend-alerts.js +20 -1
- package/node_modules/openai/resources/admin/organization/projects/spend-alerts.mjs +20 -1
- package/node_modules/openai/resources/admin/organization/projects/spend-limit.js +67 -0
- package/node_modules/openai/resources/admin/organization/projects/spend-limit.mjs +63 -0
- package/node_modules/openai/resources/admin/organization/projects/users/index.js +1 -1
- package/node_modules/openai/resources/admin/organization/projects/users/index.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/projects/users/roles.js +1 -1
- package/node_modules/openai/resources/admin/organization/projects/users/roles.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/projects/users/users.js +1 -1
- package/node_modules/openai/resources/admin/organization/projects/users/users.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/projects/users.js +1 -1
- package/node_modules/openai/resources/admin/organization/projects/users.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/projects.js +1 -1
- package/node_modules/openai/resources/admin/organization/projects.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/roles.js +1 -1
- package/node_modules/openai/resources/admin/organization/roles.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/spend-alerts.js +18 -1
- package/node_modules/openai/resources/admin/organization/spend-alerts.mjs +18 -1
- package/node_modules/openai/resources/admin/organization/spend-limit.js +59 -0
- package/node_modules/openai/resources/admin/organization/spend-limit.mjs +55 -0
- package/node_modules/openai/resources/admin/organization/usage.js +1 -1
- package/node_modules/openai/resources/admin/organization/usage.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/users/index.js +1 -1
- package/node_modules/openai/resources/admin/organization/users/index.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/users/roles.js +1 -1
- package/node_modules/openai/resources/admin/organization/users/roles.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/users/users.js +1 -1
- package/node_modules/openai/resources/admin/organization/users/users.mjs +1 -1
- package/node_modules/openai/resources/admin/organization/users.js +1 -1
- package/node_modules/openai/resources/admin/organization/users.mjs +1 -1
- package/node_modules/openai/resources/admin/organization.js +1 -1
- package/node_modules/openai/resources/admin/organization.mjs +1 -1
- package/node_modules/openai/resources/admin.js +1 -1
- package/node_modules/openai/resources/admin.mjs +1 -1
- package/node_modules/openai/resources/audio/audio.js +1 -1
- package/node_modules/openai/resources/audio/audio.mjs +1 -1
- package/node_modules/openai/resources/audio/index.js +1 -1
- package/node_modules/openai/resources/audio/index.mjs +1 -1
- package/node_modules/openai/resources/audio/speech.js +1 -1
- package/node_modules/openai/resources/audio/speech.mjs +1 -1
- package/node_modules/openai/resources/audio/transcriptions.js +1 -1
- package/node_modules/openai/resources/audio/transcriptions.mjs +1 -1
- package/node_modules/openai/resources/audio/translations.js +1 -1
- package/node_modules/openai/resources/audio/translations.mjs +1 -1
- package/node_modules/openai/resources/audio.js +1 -1
- package/node_modules/openai/resources/audio.mjs +1 -1
- package/node_modules/openai/resources/batches.js +1 -1
- package/node_modules/openai/resources/batches.mjs +1 -1
- package/node_modules/openai/resources/beta/agents/agents.js +118 -0
- package/node_modules/openai/resources/beta/agents/agents.mjs +113 -0
- package/node_modules/openai/resources/beta/agents/environments/environments.js +43 -0
- package/node_modules/openai/resources/beta/agents/environments/environments.mjs +38 -0
- package/node_modules/openai/resources/beta/agents/environments/files.js +61 -0
- package/node_modules/openai/resources/beta/agents/environments/files.mjs +57 -0
- package/node_modules/openai/resources/beta/agents/environments/index.js +11 -0
- package/node_modules/openai/resources/beta/agents/environments/index.mjs +5 -0
- package/node_modules/openai/resources/beta/agents/environments/templates.js +112 -0
- package/node_modules/openai/resources/beta/agents/environments/templates.mjs +108 -0
- package/node_modules/openai/resources/beta/agents/environments.js +6 -0
- package/node_modules/openai/resources/beta/agents/environments.mjs +3 -0
- package/node_modules/openai/resources/beta/agents/index.js +13 -0
- package/node_modules/openai/resources/beta/agents/index.mjs +6 -0
- package/node_modules/openai/resources/beta/agents/sessions/artifacts.js +106 -0
- package/node_modules/openai/resources/beta/agents/sessions/artifacts.mjs +102 -0
- package/node_modules/openai/resources/beta/agents/sessions/events.js +75 -0
- package/node_modules/openai/resources/beta/agents/sessions/events.mjs +71 -0
- package/node_modules/openai/resources/beta/agents/sessions/index.js +17 -0
- package/node_modules/openai/resources/beta/agents/sessions/index.mjs +8 -0
- package/node_modules/openai/resources/beta/agents/sessions/items.js +35 -0
- package/node_modules/openai/resources/beta/agents/sessions/items.mjs +31 -0
- package/node_modules/openai/resources/beta/agents/sessions/sessions.js +127 -0
- package/node_modules/openai/resources/beta/agents/sessions/sessions.mjs +122 -0
- package/node_modules/openai/resources/beta/agents/sessions/subagents/index.js +11 -0
- package/node_modules/openai/resources/beta/agents/sessions/subagents/index.mjs +5 -0
- package/node_modules/openai/resources/beta/agents/sessions/subagents/items.js +36 -0
- package/node_modules/openai/resources/beta/agents/sessions/subagents/items.mjs +32 -0
- package/node_modules/openai/resources/beta/agents/sessions/subagents/subagents.js +67 -0
- package/node_modules/openai/resources/beta/agents/sessions/subagents/subagents.mjs +62 -0
- package/node_modules/openai/resources/beta/agents/sessions/subagents/turns/index.js +9 -0
- package/node_modules/openai/resources/beta/agents/sessions/subagents/turns/index.mjs +4 -0
- package/node_modules/openai/resources/beta/agents/sessions/subagents/turns/items.js +36 -0
- package/node_modules/openai/resources/beta/agents/sessions/subagents/turns/items.mjs +32 -0
- package/node_modules/openai/resources/beta/agents/sessions/subagents/turns/turns.js +68 -0
- package/node_modules/openai/resources/beta/agents/sessions/subagents/turns/turns.mjs +63 -0
- package/node_modules/openai/resources/beta/agents/sessions/subagents/turns.js +6 -0
- package/node_modules/openai/resources/beta/agents/sessions/subagents/turns.mjs +3 -0
- package/node_modules/openai/resources/beta/agents/sessions/subagents.js +6 -0
- package/node_modules/openai/resources/beta/agents/sessions/subagents.mjs +3 -0
- package/node_modules/openai/resources/beta/agents/sessions/turns.js +57 -0
- package/node_modules/openai/resources/beta/agents/sessions/turns.mjs +53 -0
- package/node_modules/openai/resources/beta/agents/sessions.js +6 -0
- package/node_modules/openai/resources/beta/agents/sessions.mjs +3 -0
- package/node_modules/openai/resources/beta/agents/vaults/credentials.js +132 -0
- package/node_modules/openai/resources/beta/agents/vaults/credentials.mjs +128 -0
- package/node_modules/openai/resources/beta/agents/vaults/index.js +9 -0
- package/node_modules/openai/resources/beta/agents/vaults/index.mjs +4 -0
- package/node_modules/openai/resources/beta/agents/vaults/vaults.js +93 -0
- package/node_modules/openai/resources/beta/agents/vaults/vaults.mjs +88 -0
- package/node_modules/openai/resources/beta/agents/vaults.js +6 -0
- package/node_modules/openai/resources/beta/agents/vaults.mjs +3 -0
- package/node_modules/openai/resources/beta/agents.js +6 -0
- package/node_modules/openai/resources/beta/agents.mjs +3 -0
- package/node_modules/openai/resources/beta/assistants.js +1 -1
- package/node_modules/openai/resources/beta/assistants.mjs +1 -1
- package/node_modules/openai/resources/beta/beta.js +9 -1
- package/node_modules/openai/resources/beta/beta.mjs +9 -1
- package/node_modules/openai/resources/beta/chatkit/chatkit.js +1 -1
- package/node_modules/openai/resources/beta/chatkit/chatkit.mjs +1 -1
- package/node_modules/openai/resources/beta/chatkit/index.js +1 -1
- package/node_modules/openai/resources/beta/chatkit/index.mjs +1 -1
- package/node_modules/openai/resources/beta/chatkit/sessions.js +1 -1
- package/node_modules/openai/resources/beta/chatkit/sessions.mjs +1 -1
- package/node_modules/openai/resources/beta/chatkit/threads.js +1 -1
- package/node_modules/openai/resources/beta/chatkit/threads.mjs +1 -1
- package/node_modules/openai/resources/beta/chatkit.js +1 -1
- package/node_modules/openai/resources/beta/chatkit.mjs +1 -1
- package/node_modules/openai/resources/beta/index.js +12 -8
- package/node_modules/openai/resources/beta/index.mjs +3 -1
- package/node_modules/openai/resources/beta/realtime/index.js +0 -1
- package/node_modules/openai/resources/beta/realtime/index.mjs +0 -1
- package/node_modules/openai/resources/beta/realtime/realtime.js +0 -1
- package/node_modules/openai/resources/beta/realtime/realtime.mjs +0 -1
- package/node_modules/openai/resources/beta/realtime/sessions.js +0 -1
- package/node_modules/openai/resources/beta/realtime/sessions.mjs +0 -1
- package/node_modules/openai/resources/beta/realtime/transcription-sessions.js +0 -1
- package/node_modules/openai/resources/beta/realtime/transcription-sessions.mjs +0 -1
- package/node_modules/openai/resources/beta/realtime.js +0 -1
- package/node_modules/openai/resources/beta/realtime.mjs +0 -1
- package/node_modules/openai/resources/beta/responses/index.js +11 -0
- package/node_modules/openai/resources/beta/responses/index.mjs +5 -0
- package/node_modules/openai/resources/beta/responses/input-items.js +37 -0
- package/node_modules/openai/resources/beta/responses/input-items.mjs +33 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.js +34 -0
- package/node_modules/openai/resources/beta/responses/input-tokens.mjs +30 -0
- package/node_modules/openai/resources/beta/responses/internal-base.js +66 -0
- package/node_modules/openai/resources/beta/responses/internal-base.mjs +60 -0
- package/node_modules/openai/resources/beta/responses/responses.js +121 -0
- package/node_modules/openai/resources/beta/responses/responses.mjs +116 -0
- package/node_modules/openai/resources/beta/responses/ws-base.js +566 -0
- package/node_modules/openai/resources/beta/responses/ws-base.mjs +560 -0
- package/node_modules/openai/resources/beta/responses/ws.js +47 -0
- package/node_modules/openai/resources/beta/responses/ws.mjs +42 -0
- package/node_modules/openai/resources/beta/responses.js +6 -0
- package/node_modules/openai/resources/beta/responses.mjs +3 -0
- package/node_modules/openai/resources/beta/threads/index.js +1 -1
- package/node_modules/openai/resources/beta/threads/index.mjs +1 -1
- package/node_modules/openai/resources/beta/threads/messages.js +1 -1
- package/node_modules/openai/resources/beta/threads/messages.mjs +1 -1
- package/node_modules/openai/resources/beta/threads/runs/index.js +1 -1
- package/node_modules/openai/resources/beta/threads/runs/index.mjs +1 -1
- package/node_modules/openai/resources/beta/threads/runs/runs.js +3 -44
- package/node_modules/openai/resources/beta/threads/runs/runs.mjs +3 -44
- package/node_modules/openai/resources/beta/threads/runs/steps.js +1 -1
- package/node_modules/openai/resources/beta/threads/runs/steps.mjs +1 -1
- package/node_modules/openai/resources/beta/threads/runs.js +1 -1
- package/node_modules/openai/resources/beta/threads/runs.mjs +1 -1
- package/node_modules/openai/resources/beta/threads/threads.js +1 -1
- package/node_modules/openai/resources/beta/threads/threads.mjs +1 -1
- package/node_modules/openai/resources/beta/threads.js +1 -1
- package/node_modules/openai/resources/beta/threads.mjs +1 -1
- package/node_modules/openai/resources/beta.js +1 -1
- package/node_modules/openai/resources/beta.mjs +1 -1
- package/node_modules/openai/resources/chat/chat.js +1 -1
- package/node_modules/openai/resources/chat/chat.mjs +1 -1
- package/node_modules/openai/resources/chat/completions/completions.js +2 -5
- package/node_modules/openai/resources/chat/completions/completions.mjs +2 -5
- package/node_modules/openai/resources/chat/completions/index.js +1 -1
- package/node_modules/openai/resources/chat/completions/index.mjs +1 -1
- package/node_modules/openai/resources/chat/completions/messages.js +1 -1
- package/node_modules/openai/resources/chat/completions/messages.mjs +1 -1
- package/node_modules/openai/resources/chat/completions.js +1 -1
- package/node_modules/openai/resources/chat/completions.mjs +1 -1
- package/node_modules/openai/resources/chat/index.js +1 -1
- package/node_modules/openai/resources/chat/index.mjs +1 -1
- package/node_modules/openai/resources/chat.js +1 -1
- package/node_modules/openai/resources/chat.mjs +1 -1
- package/node_modules/openai/resources/completions.js +1 -1
- package/node_modules/openai/resources/completions.mjs +1 -1
- package/node_modules/openai/resources/containers/containers.js +1 -1
- package/node_modules/openai/resources/containers/containers.mjs +1 -1
- package/node_modules/openai/resources/containers/files/content.js +1 -1
- package/node_modules/openai/resources/containers/files/content.mjs +1 -1
- package/node_modules/openai/resources/containers/files/files.js +1 -1
- package/node_modules/openai/resources/containers/files/files.mjs +1 -1
- package/node_modules/openai/resources/containers/files/index.js +1 -1
- package/node_modules/openai/resources/containers/files/index.mjs +1 -1
- package/node_modules/openai/resources/containers/files.js +1 -1
- package/node_modules/openai/resources/containers/files.mjs +1 -1
- package/node_modules/openai/resources/containers/index.js +1 -1
- package/node_modules/openai/resources/containers/index.mjs +1 -1
- package/node_modules/openai/resources/containers.js +1 -1
- package/node_modules/openai/resources/containers.mjs +1 -1
- package/node_modules/openai/resources/content-provenance-checks.js +24 -0
- package/node_modules/openai/resources/content-provenance-checks.mjs +20 -0
- package/node_modules/openai/resources/conversations/conversations.js +1 -1
- package/node_modules/openai/resources/conversations/conversations.mjs +1 -1
- package/node_modules/openai/resources/conversations/index.js +1 -1
- package/node_modules/openai/resources/conversations/index.mjs +1 -1
- package/node_modules/openai/resources/conversations/items.js +1 -1
- package/node_modules/openai/resources/conversations/items.mjs +1 -1
- package/node_modules/openai/resources/conversations.js +1 -1
- package/node_modules/openai/resources/conversations.mjs +1 -1
- package/node_modules/openai/resources/embeddings.js +3 -47
- package/node_modules/openai/resources/embeddings.mjs +3 -47
- package/node_modules/openai/resources/evals/evals.js +2 -2
- package/node_modules/openai/resources/evals/evals.mjs +2 -2
- package/node_modules/openai/resources/evals/index.js +1 -1
- package/node_modules/openai/resources/evals/index.mjs +1 -1
- package/node_modules/openai/resources/evals/runs/index.js +1 -1
- package/node_modules/openai/resources/evals/runs/index.mjs +1 -1
- package/node_modules/openai/resources/evals/runs/output-items.js +1 -1
- package/node_modules/openai/resources/evals/runs/output-items.mjs +1 -1
- package/node_modules/openai/resources/evals/runs/runs.js +1 -1
- package/node_modules/openai/resources/evals/runs/runs.mjs +1 -1
- package/node_modules/openai/resources/evals/runs.js +1 -1
- package/node_modules/openai/resources/evals/runs.mjs +1 -1
- package/node_modules/openai/resources/evals.js +1 -1
- package/node_modules/openai/resources/evals.mjs +1 -1
- package/node_modules/openai/resources/files.js +9 -22
- package/node_modules/openai/resources/files.mjs +9 -22
- package/node_modules/openai/resources/fine-tuning/alpha/alpha.js +1 -1
- package/node_modules/openai/resources/fine-tuning/alpha/alpha.mjs +1 -1
- package/node_modules/openai/resources/fine-tuning/alpha/graders.js +1 -1
- package/node_modules/openai/resources/fine-tuning/alpha/graders.mjs +1 -1
- package/node_modules/openai/resources/fine-tuning/alpha/index.js +1 -1
- package/node_modules/openai/resources/fine-tuning/alpha/index.mjs +1 -1
- package/node_modules/openai/resources/fine-tuning/alpha.js +1 -1
- package/node_modules/openai/resources/fine-tuning/alpha.mjs +1 -1
- package/node_modules/openai/resources/fine-tuning/checkpoints/checkpoints.js +1 -1
- package/node_modules/openai/resources/fine-tuning/checkpoints/checkpoints.mjs +1 -1
- package/node_modules/openai/resources/fine-tuning/checkpoints/index.js +1 -1
- package/node_modules/openai/resources/fine-tuning/checkpoints/index.mjs +1 -1
- package/node_modules/openai/resources/fine-tuning/checkpoints/permissions.js +9 -5
- package/node_modules/openai/resources/fine-tuning/checkpoints/permissions.mjs +9 -5
- package/node_modules/openai/resources/fine-tuning/checkpoints.js +1 -1
- package/node_modules/openai/resources/fine-tuning/checkpoints.mjs +1 -1
- package/node_modules/openai/resources/fine-tuning/fine-tuning.js +1 -1
- package/node_modules/openai/resources/fine-tuning/fine-tuning.mjs +1 -1
- package/node_modules/openai/resources/fine-tuning/index.js +1 -1
- package/node_modules/openai/resources/fine-tuning/index.mjs +1 -1
- package/node_modules/openai/resources/fine-tuning/jobs/checkpoints.js +1 -1
- package/node_modules/openai/resources/fine-tuning/jobs/checkpoints.mjs +1 -1
- package/node_modules/openai/resources/fine-tuning/jobs/index.js +1 -1
- package/node_modules/openai/resources/fine-tuning/jobs/index.mjs +1 -1
- package/node_modules/openai/resources/fine-tuning/jobs/jobs.js +3 -3
- package/node_modules/openai/resources/fine-tuning/jobs/jobs.mjs +3 -3
- package/node_modules/openai/resources/fine-tuning/jobs.js +1 -1
- package/node_modules/openai/resources/fine-tuning/jobs.mjs +1 -1
- package/node_modules/openai/resources/fine-tuning/methods.js +1 -1
- package/node_modules/openai/resources/fine-tuning/methods.mjs +1 -1
- package/node_modules/openai/resources/fine-tuning.js +1 -1
- package/node_modules/openai/resources/fine-tuning.mjs +1 -1
- package/node_modules/openai/resources/graders/grader-models.js +1 -1
- package/node_modules/openai/resources/graders/grader-models.mjs +1 -1
- package/node_modules/openai/resources/graders/graders.js +1 -1
- package/node_modules/openai/resources/graders/graders.mjs +1 -1
- package/node_modules/openai/resources/graders/index.js +1 -1
- package/node_modules/openai/resources/graders/index.mjs +1 -1
- package/node_modules/openai/resources/graders.js +1 -1
- package/node_modules/openai/resources/graders.mjs +1 -1
- package/node_modules/openai/resources/images.js +8 -2
- package/node_modules/openai/resources/images.mjs +8 -2
- package/node_modules/openai/resources/index.js +9 -3
- package/node_modules/openai/resources/index.mjs +5 -2
- package/node_modules/openai/resources/live/forks/forks.js +9 -0
- package/node_modules/openai/resources/live/forks/forks.mjs +5 -0
- package/node_modules/openai/resources/live/forks/index.js +7 -0
- package/node_modules/openai/resources/live/forks/index.mjs +3 -0
- package/node_modules/openai/resources/live/forks/internal-base.js +65 -0
- package/node_modules/openai/resources/live/forks/internal-base.mjs +59 -0
- package/node_modules/openai/resources/live/forks/ws-base.js +547 -0
- package/node_modules/openai/resources/live/forks/ws-base.mjs +543 -0
- package/node_modules/openai/resources/live/forks/ws.js +32 -0
- package/node_modules/openai/resources/live/forks/ws.mjs +27 -0
- package/node_modules/openai/resources/live/forks.js +6 -0
- package/node_modules/openai/resources/live/forks.mjs +3 -0
- package/node_modules/openai/resources/live/index.js +13 -0
- package/node_modules/openai/resources/live/index.mjs +6 -0
- package/node_modules/openai/resources/live/internal-base.js +64 -0
- package/node_modules/openai/resources/live/internal-base.mjs +58 -0
- package/node_modules/openai/resources/live/live.js +40 -0
- package/node_modules/openai/resources/live/live.mjs +35 -0
- package/node_modules/openai/resources/live/sessions.js +124 -0
- package/node_modules/openai/resources/live/sessions.mjs +120 -0
- package/node_modules/openai/resources/live/sideband/index.js +7 -0
- package/node_modules/openai/resources/live/sideband/index.mjs +3 -0
- package/node_modules/openai/resources/live/sideband/internal-base.js +65 -0
- package/node_modules/openai/resources/live/sideband/internal-base.mjs +59 -0
- package/node_modules/openai/resources/live/sideband/sideband.js +9 -0
- package/node_modules/openai/resources/live/sideband/sideband.mjs +5 -0
- package/node_modules/openai/resources/live/sideband/ws-base.js +547 -0
- package/node_modules/openai/resources/live/sideband/ws-base.mjs +543 -0
- package/node_modules/openai/resources/live/sideband/ws.js +32 -0
- package/node_modules/openai/resources/live/sideband/ws.mjs +27 -0
- package/node_modules/openai/resources/live/sideband.js +6 -0
- package/node_modules/openai/resources/live/sideband.mjs +3 -0
- package/node_modules/openai/resources/live/ws-base.js +547 -0
- package/node_modules/openai/resources/live/ws-base.mjs +543 -0
- package/node_modules/openai/resources/live/ws.js +32 -0
- package/node_modules/openai/resources/live/ws.mjs +27 -0
- package/node_modules/openai/resources/live.js +6 -0
- package/node_modules/openai/resources/live.mjs +3 -0
- package/node_modules/openai/resources/models.js +1 -1
- package/node_modules/openai/resources/models.mjs +1 -1
- package/node_modules/openai/resources/moderations.js +3 -2
- package/node_modules/openai/resources/moderations.mjs +3 -2
- package/node_modules/openai/resources/realtime/calls.js +25 -1
- package/node_modules/openai/resources/realtime/calls.mjs +25 -1
- package/node_modules/openai/resources/realtime/client-secrets.js +2 -2
- package/node_modules/openai/resources/realtime/client-secrets.mjs +2 -2
- package/node_modules/openai/resources/realtime/index.js +1 -1
- package/node_modules/openai/resources/realtime/index.mjs +2 -2
- package/node_modules/openai/resources/realtime/realtime.js +1 -1
- package/node_modules/openai/resources/realtime/realtime.mjs +1 -1
- package/node_modules/openai/resources/realtime.js +1 -1
- package/node_modules/openai/resources/realtime.mjs +1 -1
- package/node_modules/openai/resources/responses/index.js +1 -1
- package/node_modules/openai/resources/responses/index.mjs +1 -1
- package/node_modules/openai/resources/responses/input-items.js +1 -1
- package/node_modules/openai/resources/responses/input-items.mjs +1 -1
- package/node_modules/openai/resources/responses/input-tokens.js +1 -1
- package/node_modules/openai/resources/responses/input-tokens.mjs +1 -1
- package/node_modules/openai/resources/responses/internal-base.js +24 -6
- package/node_modules/openai/resources/responses/internal-base.mjs +24 -6
- package/node_modules/openai/resources/responses/responses.js +5 -5
- package/node_modules/openai/resources/responses/responses.mjs +5 -5
- package/node_modules/openai/resources/responses/ws-base.js +115 -23
- package/node_modules/openai/resources/responses/ws-base.mjs +115 -25
- package/node_modules/openai/resources/responses/ws.js +23 -7
- package/node_modules/openai/resources/responses/ws.mjs +23 -7
- package/node_modules/openai/resources/responses.js +1 -1
- package/node_modules/openai/resources/responses.mjs +1 -1
- package/node_modules/openai/resources/safety/alerts.js +16 -0
- package/node_modules/openai/resources/safety/alerts.mjs +12 -0
- package/node_modules/openai/resources/safety/index.js +9 -0
- package/node_modules/openai/resources/safety/index.mjs +4 -0
- package/node_modules/openai/resources/safety/safety.js +17 -0
- package/node_modules/openai/resources/safety/safety.mjs +12 -0
- package/node_modules/openai/resources/safety.js +6 -0
- package/node_modules/openai/resources/safety.mjs +3 -0
- package/node_modules/openai/resources/shared.js +1 -1
- package/node_modules/openai/resources/shared.mjs +1 -1
- package/node_modules/openai/resources/skills/content.js +1 -1
- package/node_modules/openai/resources/skills/content.mjs +1 -1
- package/node_modules/openai/resources/skills/index.js +1 -1
- package/node_modules/openai/resources/skills/index.mjs +1 -1
- package/node_modules/openai/resources/skills/skills.js +4 -2
- package/node_modules/openai/resources/skills/skills.mjs +4 -2
- package/node_modules/openai/resources/skills/versions/content.js +1 -1
- package/node_modules/openai/resources/skills/versions/content.mjs +1 -1
- package/node_modules/openai/resources/skills/versions/index.js +1 -1
- package/node_modules/openai/resources/skills/versions/index.mjs +1 -1
- package/node_modules/openai/resources/skills/versions/versions.js +4 -2
- package/node_modules/openai/resources/skills/versions/versions.mjs +4 -2
- package/node_modules/openai/resources/skills/versions.js +1 -1
- package/node_modules/openai/resources/skills/versions.mjs +1 -1
- package/node_modules/openai/resources/skills.js +1 -1
- package/node_modules/openai/resources/skills.mjs +1 -1
- package/node_modules/openai/resources/uploads/index.js +1 -1
- package/node_modules/openai/resources/uploads/index.mjs +1 -1
- package/node_modules/openai/resources/uploads/parts.js +6 -5
- package/node_modules/openai/resources/uploads/parts.mjs +6 -5
- package/node_modules/openai/resources/uploads/uploads.js +10 -10
- package/node_modules/openai/resources/uploads/uploads.mjs +10 -10
- package/node_modules/openai/resources/uploads.js +1 -1
- package/node_modules/openai/resources/uploads.mjs +1 -1
- package/node_modules/openai/resources/vector-stores/file-batches.js +6 -63
- package/node_modules/openai/resources/vector-stores/file-batches.mjs +6 -63
- package/node_modules/openai/resources/vector-stores/files.js +6 -39
- package/node_modules/openai/resources/vector-stores/files.mjs +6 -39
- package/node_modules/openai/resources/vector-stores/index.js +1 -1
- package/node_modules/openai/resources/vector-stores/index.mjs +1 -1
- package/node_modules/openai/resources/vector-stores/vector-stores.js +1 -1
- package/node_modules/openai/resources/vector-stores/vector-stores.mjs +1 -1
- package/node_modules/openai/resources/vector-stores.js +1 -1
- package/node_modules/openai/resources/vector-stores.mjs +1 -1
- package/node_modules/openai/resources/videos.js +24 -1
- package/node_modules/openai/resources/videos.mjs +24 -1
- package/node_modules/openai/resources/webhooks/event-types.js +21 -0
- package/node_modules/openai/resources/webhooks/event-types.mjs +17 -0
- package/node_modules/openai/resources/webhooks/index.js +4 -1
- package/node_modules/openai/resources/webhooks/index.mjs +2 -1
- package/node_modules/openai/resources/webhooks/webhooks.js +127 -43
- package/node_modules/openai/resources/webhooks/webhooks.mjs +127 -43
- package/node_modules/openai/resources/webhooks.js +1 -1
- package/node_modules/openai/resources/webhooks.mjs +1 -1
- package/node_modules/openai/src/_vendor/partial-json-parser/LICENSE +21 -0
- package/node_modules/openai/src/_vendor/partial-json-parser/README.md +11 -1
- package/node_modules/openai/src/_vendor/partial-json-parser/parser.ts +66 -35
- package/node_modules/openai/src/_vendor/zod-to-json-schema/Options.ts +32 -18
- package/node_modules/openai/src/_vendor/zod-to-json-schema/Refs.ts +7 -6
- package/node_modules/openai/src/_vendor/zod-to-json-schema/errorMessages.ts +5 -3
- package/node_modules/openai/src/_vendor/zod-to-json-schema/index.ts +3 -1
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parseDef.ts +194 -79
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/array.ts +8 -5
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/bigint.ts +20 -12
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/branded.ts +4 -4
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/catch.ts +4 -5
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/date.ts +16 -10
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/default.ts +10 -5
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/effects.ts +4 -3
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/enum.ts +1 -1
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/intersection.ts +12 -9
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/literal.ts +12 -2
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/map.ts +6 -4
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/nativeEnum.ts +10 -11
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/null.ts +4 -3
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/nullable.ts +25 -10
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/number.ts +17 -8
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/object.ts +57 -54
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/optional.ts +25 -17
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/pipeline.ts +8 -6
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/promise.ts +10 -5
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/readonly.ts +4 -5
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/record.ts +22 -19
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/set.ts +6 -4
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/string.ts +62 -37
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/tuple.ts +32 -25
- package/node_modules/openai/src/_vendor/zod-to-json-schema/parsers/union.ts +51 -33
- package/node_modules/openai/src/_vendor/zod-to-json-schema/util.ts +11 -6
- package/node_modules/openai/src/_vendor/zod-to-json-schema/zodToJsonSchema.ts +133 -52
- package/node_modules/openai/src/auth/index.ts +7 -1
- package/node_modules/openai/src/auth/subject-token-providers.ts +281 -16
- package/node_modules/openai/src/auth/types.ts +48 -5
- package/node_modules/openai/src/auth/workload-identity-auth.ts +227 -26
- package/node_modules/openai/src/auth/x509-transport.ts +369 -0
- package/node_modules/openai/src/azure.ts +127 -28
- package/node_modules/openai/src/bedrock.ts +294 -0
- package/node_modules/openai/src/beta/realtime/internal-base.ts +136 -16
- package/node_modules/openai/src/beta/realtime/websocket.ts +264 -48
- package/node_modules/openai/src/beta/realtime/ws.ts +138 -25
- package/node_modules/openai/src/client.ts +975 -124
- package/node_modules/openai/src/core/EventEmitter.ts +162 -26
- package/node_modules/openai/src/core/api-promise.ts +0 -2
- package/node_modules/openai/src/core/error.ts +6 -8
- package/node_modules/openai/src/core/pagination.ts +67 -7
- package/node_modules/openai/src/core/resource.ts +0 -2
- package/node_modules/openai/src/core/streaming.ts +490 -100
- package/node_modules/openai/src/core/uploads.ts +6 -1
- package/node_modules/openai/src/helpers/audio.ts +215 -32
- package/node_modules/openai/src/helpers/live.ts +8 -0
- package/node_modules/openai/src/helpers/standard-schema.ts +819 -0
- package/node_modules/openai/src/helpers/zod-v3-strict-schema.ts +520 -0
- package/node_modules/openai/src/helpers/zod.ts +418 -56
- package/node_modules/openai/src/index.ts +4 -5
- package/node_modules/openai/src/internal/assistant-stream-delta.ts +440 -0
- package/node_modules/openai/src/internal/auth/x509-api-origin.ts +27 -0
- package/node_modules/openai/src/internal/auth/x509-credential-options.ts +149 -0
- package/node_modules/openai/src/internal/auth/x509-token-exchange.ts +319 -0
- package/node_modules/openai/src/internal/auth/x509-transport-capability.ts +227 -0
- package/node_modules/openai/src/internal/auth/x509-transport-registry.ts +127 -0
- package/node_modules/openai/src/internal/auth/x509-transport-state-browser.ts +43 -0
- package/node_modules/openai/src/internal/auth/x509-transport-state.cts +43 -0
- package/node_modules/openai/src/internal/auth/x509-workload-identity-auth.ts +972 -0
- package/node_modules/openai/src/internal/bedrock.ts +586 -0
- package/node_modules/openai/src/internal/builtin-types.ts +0 -2
- package/node_modules/openai/src/internal/data-residency.ts +44 -0
- package/node_modules/openai/src/internal/decoders/line.ts +145 -61
- package/node_modules/openai/src/internal/detect-platform.ts +3 -5
- package/node_modules/openai/src/internal/errors.ts +3 -4
- package/node_modules/openai/src/internal/headers.ts +14 -10
- package/node_modules/openai/src/internal/multipart-encoding.ts +53 -0
- package/node_modules/openai/src/internal/parse.ts +47 -19
- package/node_modules/openai/src/internal/provider.ts +92 -0
- package/node_modules/openai/src/internal/qs/formats.ts +1 -1
- package/node_modules/openai/src/internal/qs/stringify.ts +57 -53
- package/node_modules/openai/src/internal/qs/types.ts +1 -1
- package/node_modules/openai/src/internal/qs/utils.ts +443 -54
- package/node_modules/openai/src/internal/realtime-credentials.ts +27 -0
- package/node_modules/openai/src/internal/request-options.ts +52 -3
- package/node_modules/openai/src/internal/responses/canonical-output-text.ts +160 -0
- package/node_modules/openai/src/internal/responses/output-text-index.ts +84 -0
- package/node_modules/openai/src/internal/responses/response-accumulator.ts +1263 -0
- package/node_modules/openai/src/internal/shim-types.ts +3 -4
- package/node_modules/openai/src/internal/shims.ts +0 -2
- package/node_modules/openai/src/internal/stream-utils.ts +37 -5
- package/node_modules/openai/src/internal/to-file.ts +90 -35
- package/node_modules/openai/src/internal/types.ts +21 -29
- package/node_modules/openai/src/internal/uploads.ts +533 -59
- package/node_modules/openai/src/internal/utils/abort.ts +116 -0
- package/node_modules/openai/src/internal/utils/base64.ts +3 -2
- package/node_modules/openai/src/internal/utils/bytes.ts +7 -0
- package/node_modules/openai/src/internal/utils/env.ts +9 -7
- package/node_modules/openai/src/internal/utils/log.ts +77 -14
- package/node_modules/openai/src/internal/utils/path.ts +53 -32
- package/node_modules/openai/src/internal/utils/query.ts +0 -2
- package/node_modules/openai/src/internal/utils/sleep.ts +51 -2
- package/node_modules/openai/src/internal/utils/uuid.ts +0 -2
- package/node_modules/openai/src/internal/utils/values.ts +0 -2
- package/node_modules/openai/src/internal/utils.ts +0 -2
- package/node_modules/openai/src/internal/ws-adapter-browser.ts +83 -24
- package/node_modules/openai/src/internal/ws-adapter-node.ts +105 -26
- package/node_modules/openai/src/internal/ws-adapter.ts +23 -0
- package/node_modules/openai/src/internal/ws.ts +250 -51
- package/node_modules/openai/src/lib/.keep +2 -2
- package/node_modules/openai/src/lib/AbstractChatCompletionRunner.ts +349 -102
- package/node_modules/openai/src/lib/AssistantStream.ts +537 -268
- package/node_modules/openai/src/lib/ChatCompletionRunner.ts +75 -22
- package/node_modules/openai/src/lib/ChatCompletionStream.ts +2016 -268
- package/node_modules/openai/src/lib/ChatCompletionStreamingRunner.ts +115 -17
- package/node_modules/openai/src/lib/EventEmitter.ts +171 -26
- package/node_modules/openai/src/lib/EventStream.ts +1979 -64
- package/node_modules/openai/src/lib/ResponsesParser.ts +153 -56
- package/node_modules/openai/src/lib/RunnableFunction.ts +99 -37
- package/node_modules/openai/src/lib/Util.ts +7 -5
- package/node_modules/openai/src/lib/agents/agent-session-stream.ts +328 -0
- package/node_modules/openai/src/lib/agents/output-text.ts +6 -0
- package/node_modules/openai/src/lib/agents/turn-state.ts +61 -0
- package/node_modules/openai/src/lib/assistant-run-polling.ts +27 -0
- package/node_modules/openai/src/lib/chatCompletionUtils.ts +9 -10
- package/node_modules/openai/src/lib/embeddings.ts +73 -0
- package/node_modules/openai/src/lib/file-processing.ts +37 -0
- package/node_modules/openai/src/lib/jsonschema.ts +77 -34
- package/node_modules/openai/src/lib/live/transcript-grouper.ts +307 -0
- package/node_modules/openai/src/lib/live/transcript-grouping.ts +394 -0
- package/node_modules/openai/src/lib/live/webrtc.ts +23 -0
- package/node_modules/openai/src/lib/parser.ts +247 -69
- package/node_modules/openai/src/lib/polling.ts +145 -0
- package/node_modules/openai/src/lib/realtime/webrtc.ts +20 -0
- package/node_modules/openai/src/lib/responses/EventTypes.ts +9 -60
- package/node_modules/openai/src/lib/responses/ResponseAccumulator.ts +27 -0
- package/node_modules/openai/src/lib/responses/ResponseInputItems.ts +167 -0
- package/node_modules/openai/src/lib/responses/ResponseStream.ts +135 -179
- package/node_modules/openai/src/lib/responses/responses-websocket-lane.ts +388 -0
- package/node_modules/openai/src/lib/responses/responses-websocket-session.ts +317 -0
- package/node_modules/openai/src/lib/transform.ts +2015 -100
- package/node_modules/openai/src/lib/vector-store-polling.ts +46 -0
- package/node_modules/openai/src/lib/vector-store-upload.ts +57 -0
- package/node_modules/openai/src/lib/webhook-signature.ts +164 -0
- package/node_modules/openai/src/lib/webrtc/connection.ts +313 -0
- package/node_modules/openai/src/lib/webrtc/data-channel.ts +151 -0
- package/node_modules/openai/src/lib/webrtc/errors.ts +38 -0
- package/node_modules/openai/src/lib/webrtc/subscriptions.ts +65 -0
- package/node_modules/openai/src/lib/webrtc/types.ts +110 -0
- package/node_modules/openai/src/live/webrtc.ts +10 -0
- package/node_modules/openai/src/providers/bedrock/aws.ts +331 -0
- package/node_modules/openai/src/providers/bedrock.ts +51 -0
- package/node_modules/openai/src/realtime/internal-base.ts +265 -17
- package/node_modules/openai/src/realtime/webrtc.ts +10 -0
- package/node_modules/openai/src/realtime/websocket.ts +259 -54
- package/node_modules/openai/src/realtime/ws.ts +135 -29
- package/node_modules/openai/src/resources/admin/admin.ts +1 -1
- package/node_modules/openai/src/resources/admin/index.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/admin-api-keys.ts +18 -2
- package/node_modules/openai/src/resources/admin/organization/audit-logs.ts +327 -4
- package/node_modules/openai/src/resources/admin/organization/certificates.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/data-retention.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/groups/groups.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/groups/index.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/groups/roles.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/groups/users.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/groups.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/index.ts +9 -1
- package/node_modules/openai/src/resources/admin/organization/invites.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/organization.ts +21 -1
- package/node_modules/openai/src/resources/admin/organization/projects/api-keys.ts +22 -2
- package/node_modules/openai/src/resources/admin/organization/projects/certificates.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/projects/data-retention.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/projects/groups/groups.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/projects/groups/index.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/projects/groups/roles.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/projects/groups.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/projects/hosted-tool-permissions.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/projects/index.ts +10 -2
- package/node_modules/openai/src/resources/admin/organization/projects/model-permissions.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/projects/projects.ts +70 -19
- package/node_modules/openai/src/resources/admin/organization/projects/rate-limits.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/projects/roles.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/projects/service-accounts/api-keys.ts +91 -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 +299 -0
- package/node_modules/openai/src/resources/admin/organization/projects/service-accounts.ts +2 -265
- package/node_modules/openai/src/resources/admin/organization/projects/spend-alerts.ts +33 -1
- package/node_modules/openai/src/resources/admin/organization/projects/spend-limit.ts +156 -0
- package/node_modules/openai/src/resources/admin/organization/projects/users/index.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/projects/users/roles.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/projects/users/users.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/projects/users.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/projects.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/roles.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/spend-alerts.ts +19 -1
- package/node_modules/openai/src/resources/admin/organization/spend-limit.ts +144 -0
- package/node_modules/openai/src/resources/admin/organization/usage.ts +706 -89
- package/node_modules/openai/src/resources/admin/organization/users/index.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/users/roles.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/users/users.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization/users.ts +1 -1
- package/node_modules/openai/src/resources/admin/organization.ts +1 -1
- package/node_modules/openai/src/resources/admin.ts +1 -1
- package/node_modules/openai/src/resources/audio/audio.ts +4 -1
- package/node_modules/openai/src/resources/audio/index.ts +2 -1
- package/node_modules/openai/src/resources/audio/speech.ts +4 -3
- package/node_modules/openai/src/resources/audio/transcriptions.ts +51 -13
- package/node_modules/openai/src/resources/audio/translations.ts +5 -3
- package/node_modules/openai/src/resources/audio.ts +1 -1
- package/node_modules/openai/src/resources/batches.ts +10 -9
- package/node_modules/openai/src/resources/beta/agents/agents.ts +4627 -0
- package/node_modules/openai/src/resources/beta/agents/environments/environments.ts +111 -0
- package/node_modules/openai/src/resources/beta/agents/environments/files.ts +169 -0
- package/node_modules/openai/src/resources/beta/agents/environments/index.ts +19 -0
- package/node_modules/openai/src/resources/beta/agents/environments/templates.ts +535 -0
- package/node_modules/openai/src/resources/beta/agents/environments.ts +3 -0
- package/node_modules/openai/src/resources/beta/agents/index.ts +127 -0
- package/node_modules/openai/src/resources/beta/agents/sessions/artifacts.ts +249 -0
- package/node_modules/openai/src/resources/beta/agents/sessions/events.ts +94 -0
- package/node_modules/openai/src/resources/beta/agents/sessions/index.ts +24 -0
- package/node_modules/openai/src/resources/beta/agents/sessions/items.ts +59 -0
- package/node_modules/openai/src/resources/beta/agents/sessions/sessions.ts +403 -0
- package/node_modules/openai/src/resources/beta/agents/sessions/subagents/index.ts +5 -0
- package/node_modules/openai/src/resources/beta/agents/sessions/subagents/items.ts +65 -0
- package/node_modules/openai/src/resources/beta/agents/sessions/subagents/subagents.ts +113 -0
- package/node_modules/openai/src/resources/beta/agents/sessions/subagents/turns/index.ts +4 -0
- package/node_modules/openai/src/resources/beta/agents/sessions/subagents/turns/items.ts +70 -0
- package/node_modules/openai/src/resources/beta/agents/sessions/subagents/turns/turns.ts +111 -0
- package/node_modules/openai/src/resources/beta/agents/sessions/subagents/turns.ts +3 -0
- package/node_modules/openai/src/resources/beta/agents/sessions/subagents.ts +3 -0
- package/node_modules/openai/src/resources/beta/agents/sessions/turns.ts +159 -0
- package/node_modules/openai/src/resources/beta/agents/sessions.ts +3 -0
- package/node_modules/openai/src/resources/beta/agents/vaults/credentials.ts +693 -0
- package/node_modules/openai/src/resources/beta/agents/vaults/index.ts +29 -0
- package/node_modules/openai/src/resources/beta/agents/vaults/vaults.ts +243 -0
- package/node_modules/openai/src/resources/beta/agents/vaults.ts +3 -0
- package/node_modules/openai/src/resources/beta/agents.ts +3 -0
- package/node_modules/openai/src/resources/beta/assistants.ts +154 -172
- package/node_modules/openai/src/resources/beta/beta.ts +578 -3
- package/node_modules/openai/src/resources/beta/chatkit/chatkit.ts +1 -1
- package/node_modules/openai/src/resources/beta/chatkit/index.ts +1 -1
- package/node_modules/openai/src/resources/beta/chatkit/sessions.ts +1 -1
- package/node_modules/openai/src/resources/beta/chatkit/threads.ts +1 -1
- package/node_modules/openai/src/resources/beta/chatkit.ts +1 -1
- package/node_modules/openai/src/resources/beta/index.ts +290 -1
- package/node_modules/openai/src/resources/beta/realtime/index.ts +0 -2
- package/node_modules/openai/src/resources/beta/realtime/realtime.ts +0 -2
- package/node_modules/openai/src/resources/beta/realtime/sessions.ts +0 -2
- package/node_modules/openai/src/resources/beta/realtime/transcription-sessions.ts +0 -2
- package/node_modules/openai/src/resources/beta/realtime.ts +0 -2
- package/node_modules/openai/src/resources/beta/responses/index.ts +189 -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 +249 -0
- package/node_modules/openai/src/resources/beta/responses/internal-base.ts +136 -0
- package/node_modules/openai/src/resources/beta/responses/responses.ts +15060 -0
- package/node_modules/openai/src/resources/beta/responses/ws-base.ts +729 -0
- package/node_modules/openai/src/resources/beta/responses/ws.ts +62 -0
- package/node_modules/openai/src/resources/beta/responses.ts +3 -0
- package/node_modules/openai/src/resources/beta/threads/index.ts +1 -1
- package/node_modules/openai/src/resources/beta/threads/messages.ts +30 -24
- package/node_modules/openai/src/resources/beta/threads/runs/index.ts +2 -2
- package/node_modules/openai/src/resources/beta/threads/runs/runs.ts +47 -93
- package/node_modules/openai/src/resources/beta/threads/runs/steps.ts +15 -16
- package/node_modules/openai/src/resources/beta/threads/runs.ts +1 -1
- package/node_modules/openai/src/resources/beta/threads/threads.ts +54 -51
- package/node_modules/openai/src/resources/beta/threads.ts +1 -1
- package/node_modules/openai/src/resources/beta.ts +1 -1
- package/node_modules/openai/src/resources/chat/chat.ts +1 -1
- package/node_modules/openai/src/resources/chat/completions/completions.ts +762 -108
- package/node_modules/openai/src/resources/chat/completions/index.ts +1 -1
- package/node_modules/openai/src/resources/chat/completions/messages.ts +1 -1
- package/node_modules/openai/src/resources/chat/completions.ts +1 -1
- package/node_modules/openai/src/resources/chat/index.ts +1 -1
- package/node_modules/openai/src/resources/chat.ts +1 -1
- package/node_modules/openai/src/resources/completions.ts +36 -15
- package/node_modules/openai/src/resources/containers/containers.ts +1 -1
- package/node_modules/openai/src/resources/containers/files/content.ts +1 -1
- package/node_modules/openai/src/resources/containers/files/files.ts +1 -1
- package/node_modules/openai/src/resources/containers/files/index.ts +1 -1
- package/node_modules/openai/src/resources/containers/files.ts +1 -1
- package/node_modules/openai/src/resources/containers/index.ts +1 -1
- package/node_modules/openai/src/resources/containers.ts +1 -1
- package/node_modules/openai/src/resources/content-provenance-checks.ts +132 -0
- package/node_modules/openai/src/resources/conversations/conversations.ts +23 -2
- package/node_modules/openai/src/resources/conversations/index.ts +1 -1
- package/node_modules/openai/src/resources/conversations/items.ts +93 -5
- package/node_modules/openai/src/resources/conversations.ts +1 -1
- package/node_modules/openai/src/resources/embeddings.ts +22 -49
- package/node_modules/openai/src/resources/evals/evals.ts +6 -6
- package/node_modules/openai/src/resources/evals/index.ts +1 -1
- package/node_modules/openai/src/resources/evals/runs/index.ts +1 -1
- package/node_modules/openai/src/resources/evals/runs/output-items.ts +1 -1
- package/node_modules/openai/src/resources/evals/runs/runs.ts +119 -191
- package/node_modules/openai/src/resources/evals/runs.ts +1 -1
- package/node_modules/openai/src/resources/evals.ts +1 -1
- package/node_modules/openai/src/resources/files.ts +9 -26
- package/node_modules/openai/src/resources/fine-tuning/alpha/alpha.ts +1 -1
- package/node_modules/openai/src/resources/fine-tuning/alpha/graders.ts +6 -5
- package/node_modules/openai/src/resources/fine-tuning/alpha/index.ts +1 -1
- package/node_modules/openai/src/resources/fine-tuning/alpha.ts +1 -1
- package/node_modules/openai/src/resources/fine-tuning/checkpoints/checkpoints.ts +1 -1
- package/node_modules/openai/src/resources/fine-tuning/checkpoints/index.ts +1 -1
- package/node_modules/openai/src/resources/fine-tuning/checkpoints/permissions.ts +9 -5
- package/node_modules/openai/src/resources/fine-tuning/checkpoints.ts +1 -1
- package/node_modules/openai/src/resources/fine-tuning/fine-tuning.ts +1 -1
- package/node_modules/openai/src/resources/fine-tuning/index.ts +1 -1
- package/node_modules/openai/src/resources/fine-tuning/jobs/checkpoints.ts +1 -1
- package/node_modules/openai/src/resources/fine-tuning/jobs/index.ts +1 -1
- package/node_modules/openai/src/resources/fine-tuning/jobs/jobs.ts +14 -13
- package/node_modules/openai/src/resources/fine-tuning/jobs.ts +1 -1
- package/node_modules/openai/src/resources/fine-tuning/methods.ts +1 -1
- package/node_modules/openai/src/resources/fine-tuning.ts +1 -1
- package/node_modules/openai/src/resources/graders/grader-models.ts +7 -14
- package/node_modules/openai/src/resources/graders/graders.ts +1 -1
- package/node_modules/openai/src/resources/graders/index.ts +1 -1
- package/node_modules/openai/src/resources/graders.ts +1 -1
- package/node_modules/openai/src/resources/images.ts +100 -85
- package/node_modules/openai/src/resources/index.ts +9 -2
- package/node_modules/openai/src/resources/live/api.md +87 -0
- package/node_modules/openai/src/resources/live/forks/forks.ts +169 -0
- package/node_modules/openai/src/resources/live/forks/index.ts +5 -0
- package/node_modules/openai/src/resources/live/forks/internal-base.ts +126 -0
- package/node_modules/openai/src/resources/live/forks/ws-base.ts +700 -0
- package/node_modules/openai/src/resources/live/forks/ws.ts +47 -0
- package/node_modules/openai/src/resources/live/forks.ts +3 -0
- package/node_modules/openai/src/resources/live/index.ts +20 -0
- package/node_modules/openai/src/resources/live/internal-base.ts +123 -0
- package/node_modules/openai/src/resources/live/live.ts +2296 -0
- package/node_modules/openai/src/resources/live/sessions.ts +343 -0
- package/node_modules/openai/src/resources/live/sideband/index.ts +10 -0
- package/node_modules/openai/src/resources/live/sideband/internal-base.ts +126 -0
- package/node_modules/openai/src/resources/live/sideband/sideband.ts +58 -0
- package/node_modules/openai/src/resources/live/sideband/ws-base.ts +710 -0
- package/node_modules/openai/src/resources/live/sideband/ws.ts +47 -0
- package/node_modules/openai/src/resources/live/sideband.ts +3 -0
- package/node_modules/openai/src/resources/live/ws-base.ts +696 -0
- package/node_modules/openai/src/resources/live/ws.ts +43 -0
- package/node_modules/openai/src/resources/live.ts +3 -0
- package/node_modules/openai/src/resources/models.ts +6 -1
- package/node_modules/openai/src/resources/moderations.ts +6 -5
- package/node_modules/openai/src/resources/realtime/api.md +1 -0
- package/node_modules/openai/src/resources/realtime/calls.ts +50 -2
- package/node_modules/openai/src/resources/realtime/client-secrets.ts +27 -10
- package/node_modules/openai/src/resources/realtime/index.ts +8 -2
- package/node_modules/openai/src/resources/realtime/realtime.ts +93 -35
- package/node_modules/openai/src/resources/realtime.ts +1 -1
- package/node_modules/openai/src/resources/responses/api.md +20 -0
- package/node_modules/openai/src/resources/responses/index.ts +1 -1
- package/node_modules/openai/src/resources/responses/input-items.ts +1 -1
- package/node_modules/openai/src/resources/responses/input-tokens.ts +26 -16
- package/node_modules/openai/src/resources/responses/internal-base.ts +33 -14
- package/node_modules/openai/src/resources/responses/responses.ts +4150 -792
- package/node_modules/openai/src/resources/responses/ws-base.ts +147 -31
- package/node_modules/openai/src/resources/responses/ws.ts +33 -9
- package/node_modules/openai/src/resources/responses.ts +1 -1
- package/node_modules/openai/src/resources/safety/alerts.ts +51 -0
- package/node_modules/openai/src/resources/safety/index.ts +4 -0
- package/node_modules/openai/src/resources/safety/safety.ts +15 -0
- package/node_modules/openai/src/resources/safety.ts +3 -0
- package/node_modules/openai/src/resources/shared.ts +98 -41
- package/node_modules/openai/src/resources/skills/content.ts +1 -1
- package/node_modules/openai/src/resources/skills/index.ts +1 -1
- package/node_modules/openai/src/resources/skills/skills.ts +4 -2
- package/node_modules/openai/src/resources/skills/versions/content.ts +1 -1
- package/node_modules/openai/src/resources/skills/versions/index.ts +1 -1
- package/node_modules/openai/src/resources/skills/versions/versions.ts +4 -2
- package/node_modules/openai/src/resources/skills/versions.ts +1 -1
- package/node_modules/openai/src/resources/skills.ts +1 -1
- package/node_modules/openai/src/resources/uploads/index.ts +1 -1
- package/node_modules/openai/src/resources/uploads/parts.ts +6 -5
- package/node_modules/openai/src/resources/uploads/uploads.ts +12 -12
- package/node_modules/openai/src/resources/uploads.ts +1 -1
- package/node_modules/openai/src/resources/vector-stores/file-batches.ts +24 -89
- package/node_modules/openai/src/resources/vector-stores/files.ts +12 -52
- package/node_modules/openai/src/resources/vector-stores/index.ts +1 -1
- package/node_modules/openai/src/resources/vector-stores/vector-stores.ts +4 -4
- package/node_modules/openai/src/resources/vector-stores.ts +1 -1
- package/node_modules/openai/src/resources/videos.ts +63 -2
- package/node_modules/openai/src/resources/webhooks/api.md +40 -17
- package/node_modules/openai/src/resources/webhooks/event-types.ts +21 -0
- package/node_modules/openai/src/resources/webhooks/index.ts +2 -1
- package/node_modules/openai/src/resources/webhooks/webhooks.ts +694 -69
- package/node_modules/openai/src/resources/webhooks.ts +1 -1
- package/node_modules/openai/src/tsconfig.json +6 -3
- package/node_modules/openai/src/version.ts +2 -1
- package/node_modules/openai/version.js +2 -1
- package/node_modules/openai/version.mjs +2 -1
- package/package.json +6 -6
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +0 -832
- package/node_modules/@earendil-works/pi-ai/dist/images-models.js +0 -143
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.js +0 -22
- /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/LICENSE +0 -0
- /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/README.md +0 -0
- /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +0 -0
- /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/constants.js +0 -0
- /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/fromEnvSigningName.js +0 -0
- /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js +0 -0
- /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/fromStatic.js +0 -0
- /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/getNewSsoOidcToken.js +0 -0
- /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/getSsoOidcClient.js +0 -0
- /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/index.js +0 -0
- /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/nodeProvider.js +0 -0
- /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js +0 -0
- /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js +0 -0
- /package/node_modules/@aws-sdk/{credential-provider-sso → client-bedrock-runtime}/node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js +0 -0
- /package/node_modules/@earendil-works/pi-ai/dist/{auth/oauth → utils}/oauth-page.js +0 -0
|
@@ -1,27 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// File generated from our OpenAPI spec by
|
|
3
|
-
var _OpenAI_instances, _a, _OpenAI_encoder, _OpenAI_baseURLOverridden;
|
|
2
|
+
// File generated from our OpenAPI spec by Castiron. See CONTRIBUTING.md for details.
|
|
3
|
+
var _OpenAI_instances, _a, _OpenAI_encoder, _OpenAI_x509Authentication, _OpenAI_x509Credential, _OpenAI_x509Fetch, _OpenAI_explicitDataResidency, _OpenAI_responseAttempts, _OpenAI_baseURLOverridden;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.OpenAI = void 0;
|
|
6
6
|
const tslib_1 = require("./internal/tslib.js");
|
|
7
7
|
const uuid_1 = require("./internal/utils/uuid.js");
|
|
8
8
|
const values_1 = require("./internal/utils/values.js");
|
|
9
9
|
const sleep_1 = require("./internal/utils/sleep.js");
|
|
10
|
+
const abort_1 = require("./internal/utils/abort.js");
|
|
10
11
|
const errors_1 = require("./internal/errors.js");
|
|
12
|
+
const parse_1 = require("./internal/parse.js");
|
|
11
13
|
const detect_platform_1 = require("./internal/detect-platform.js");
|
|
12
14
|
const Shims = tslib_1.__importStar(require("./internal/shims.js"));
|
|
13
15
|
const Opts = tslib_1.__importStar(require("./internal/request-options.js"));
|
|
14
16
|
const query_1 = require("./internal/utils/query.js");
|
|
15
17
|
const version_1 = require("./version.js");
|
|
18
|
+
const data_residency_1 = require("./internal/data-residency.js");
|
|
16
19
|
const Errors = tslib_1.__importStar(require("./core/error.js"));
|
|
17
20
|
const Pagination = tslib_1.__importStar(require("./core/pagination.js"));
|
|
18
21
|
const workload_identity_auth_1 = require("./auth/workload-identity-auth.js");
|
|
22
|
+
const x509_api_origin_1 = require("./internal/auth/x509-api-origin.js");
|
|
23
|
+
const x509_workload_identity_auth_1 = require("./internal/auth/x509-workload-identity-auth.js");
|
|
24
|
+
const x509_credential_options_1 = require("./internal/auth/x509-credential-options.js");
|
|
25
|
+
const _x509_transport_state_1 = require('./internal/auth/x509-transport-state.js');
|
|
19
26
|
const error_1 = require("./core/error.js");
|
|
20
27
|
const Uploads = tslib_1.__importStar(require("./core/uploads.js"));
|
|
21
28
|
const API = tslib_1.__importStar(require("./resources/index.js"));
|
|
22
29
|
const api_promise_1 = require("./core/api-promise.js");
|
|
30
|
+
const realtime_credentials_1 = require("./internal/realtime-credentials.js");
|
|
23
31
|
const batches_1 = require("./resources/batches.js");
|
|
24
32
|
const completions_1 = require("./resources/completions.js");
|
|
33
|
+
const content_provenance_checks_1 = require("./resources/content-provenance-checks.js");
|
|
25
34
|
const embeddings_1 = require("./resources/embeddings.js");
|
|
26
35
|
const files_1 = require("./resources/files.js");
|
|
27
36
|
const images_1 = require("./resources/images.js");
|
|
@@ -37,18 +46,38 @@ const conversations_1 = require("./resources/conversations/conversations.js");
|
|
|
37
46
|
const evals_1 = require("./resources/evals/evals.js");
|
|
38
47
|
const fine_tuning_1 = require("./resources/fine-tuning/fine-tuning.js");
|
|
39
48
|
const graders_1 = require("./resources/graders/graders.js");
|
|
49
|
+
const live_1 = require("./resources/live/live.js");
|
|
40
50
|
const realtime_1 = require("./resources/realtime/realtime.js");
|
|
41
51
|
const responses_1 = require("./resources/responses/responses.js");
|
|
52
|
+
const safety_1 = require("./resources/safety/safety.js");
|
|
42
53
|
const skills_1 = require("./resources/skills/skills.js");
|
|
43
54
|
const uploads_1 = require("./resources/uploads/uploads.js");
|
|
44
55
|
const vector_stores_1 = require("./resources/vector-stores/vector-stores.js");
|
|
45
56
|
const webhooks_1 = require("./resources/webhooks/webhooks.js");
|
|
46
57
|
const detect_platform_2 = require("./internal/detect-platform.js");
|
|
47
58
|
const headers_1 = require("./internal/headers.js");
|
|
59
|
+
const provider_1 = require("./internal/provider.js");
|
|
48
60
|
const env_1 = require("./internal/utils/env.js");
|
|
49
61
|
const log_1 = require("./internal/utils/log.js");
|
|
50
62
|
const values_2 = require("./internal/utils/values.js");
|
|
63
|
+
function isRunningInBrowserOrBrowserWorker() {
|
|
64
|
+
if ((0, detect_platform_2.isRunningInBrowser)())
|
|
65
|
+
return true;
|
|
66
|
+
const scope = globalThis;
|
|
67
|
+
return (typeof scope.WorkerGlobalScope === 'function' &&
|
|
68
|
+
scope instanceof scope.WorkerGlobalScope &&
|
|
69
|
+
typeof scope.WorkerNavigator === 'function' &&
|
|
70
|
+
scope.navigator instanceof scope.WorkerNavigator &&
|
|
71
|
+
typeof scope.navigator?.userAgent === 'string' &&
|
|
72
|
+
scope.navigator.userAgent !== 'Cloudflare-Workers' &&
|
|
73
|
+
scope.process?.versions?.node === undefined &&
|
|
74
|
+
scope.Deno === undefined &&
|
|
75
|
+
scope.Bun === undefined &&
|
|
76
|
+
scope.EdgeRuntime === undefined &&
|
|
77
|
+
scope.WebSocketPair === undefined);
|
|
78
|
+
}
|
|
51
79
|
const WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER = 'workload-identity-auth';
|
|
80
|
+
const inheritedDataResidencySelection = Symbol('inheritedDataResidencySelection');
|
|
52
81
|
/**
|
|
53
82
|
* API Client for interfacing with the OpenAI API.
|
|
54
83
|
*/
|
|
@@ -62,6 +91,7 @@ class OpenAI {
|
|
|
62
91
|
* @param {string | null | undefined} [opts.project=process.env['OPENAI_PROJECT_ID'] ?? null]
|
|
63
92
|
* @param {string | null | undefined} [opts.webhookSecret=process.env['OPENAI_WEBHOOK_SECRET'] ?? null]
|
|
64
93
|
* @param {string} [opts.baseURL=process.env['OPENAI_BASE_URL'] ?? https://api.openai.com/v1] - Override the default base URL for the API.
|
|
94
|
+
* @param {Provider} [opts.provider] - Configure a third-party API provider. Mutually exclusive with top-level authentication and base URL options.
|
|
65
95
|
* @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
66
96
|
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
|
|
67
97
|
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
@@ -70,9 +100,15 @@ class OpenAI {
|
|
|
70
100
|
* @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
71
101
|
* @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
|
|
72
102
|
*/
|
|
73
|
-
constructor(
|
|
103
|
+
constructor(clientOptions = {}) {
|
|
74
104
|
_OpenAI_instances.add(this);
|
|
75
105
|
_OpenAI_encoder.set(this, void 0);
|
|
106
|
+
_OpenAI_x509Authentication.set(this, void 0);
|
|
107
|
+
_OpenAI_x509Credential.set(this, void 0);
|
|
108
|
+
_OpenAI_x509Fetch.set(this, void 0);
|
|
109
|
+
// Preserve an explicit global selection without storing a second routing URL.
|
|
110
|
+
_OpenAI_explicitDataResidency.set(this, false);
|
|
111
|
+
_OpenAI_responseAttempts.set(this, new WeakMap());
|
|
76
112
|
/**
|
|
77
113
|
* Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
|
|
78
114
|
*/
|
|
@@ -90,6 +126,7 @@ class OpenAI {
|
|
|
90
126
|
* Given a prompt and/or an input image, the model will generate a new image.
|
|
91
127
|
*/
|
|
92
128
|
this.images = new API.Images(this);
|
|
129
|
+
this.contentProvenanceChecks = new API.ContentProvenanceChecks(this);
|
|
93
130
|
this.audio = new API.Audio(this);
|
|
94
131
|
/**
|
|
95
132
|
* Given text and/or image inputs, classifies if those inputs are potentially harmful.
|
|
@@ -102,6 +139,7 @@ class OpenAI {
|
|
|
102
139
|
this.fineTuning = new API.FineTuning(this);
|
|
103
140
|
this.graders = new API.Graders(this);
|
|
104
141
|
this.vectorStores = new API.VectorStores(this);
|
|
142
|
+
this.safety = new API.Safety(this);
|
|
105
143
|
this.webhooks = new API.Webhooks(this);
|
|
106
144
|
this.beta = new API.Beta(this);
|
|
107
145
|
/**
|
|
@@ -114,6 +152,7 @@ class OpenAI {
|
|
|
114
152
|
this.uploads = new API.Uploads(this);
|
|
115
153
|
this.admin = new API.Admin(this);
|
|
116
154
|
this.responses = new API.Responses(this);
|
|
155
|
+
this.live = new API.Live(this);
|
|
117
156
|
this.realtime = new API.Realtime(this);
|
|
118
157
|
/**
|
|
119
158
|
* Manage conversations and conversation items.
|
|
@@ -125,7 +164,29 @@ class OpenAI {
|
|
|
125
164
|
this.evals = new API.Evals(this);
|
|
126
165
|
this.containers = new API.Containers(this);
|
|
127
166
|
this.skills = new API.Skills(this);
|
|
167
|
+
/**
|
|
168
|
+
* @deprecated The Sora API is scheduled to permanently shut down on September 24, 2026.
|
|
169
|
+
*/
|
|
128
170
|
this.videos = new API.Videos(this);
|
|
171
|
+
const { credential, options: normalizedOptions } = (0, x509_credential_options_1.normalizeX509CredentialOptions)(clientOptions);
|
|
172
|
+
clientOptions = normalizedOptions;
|
|
173
|
+
const residencyBaseURL = (0, data_residency_1.resolveDataResidency)(clientOptions);
|
|
174
|
+
const provider = clientOptions.provider;
|
|
175
|
+
const { baseURL = provider ? null : (0, env_1.readEnv)('OPENAI_BASE_URL'), dataResidency: _dataResidency, [inheritedDataResidencySelection]: inheritedResidencySelection = false, apiKey = provider ? null : ((0, env_1.readEnv)('OPENAI_API_KEY') ?? null), adminAPIKey = provider ? null : ((0, env_1.readEnv)('OPENAI_ADMIN_KEY') ?? null), organization = provider ? null : ((0, env_1.readEnv)('OPENAI_ORG_ID') ?? null), project = provider ? null : ((0, env_1.readEnv)('OPENAI_PROJECT_ID') ?? null), webhookSecret = (0, env_1.readEnv)('OPENAI_WEBHOOK_SECRET') ?? null, workloadIdentity, x509Transport, credential: _credential, ...opts } = clientOptions;
|
|
176
|
+
if (provider) {
|
|
177
|
+
const conflictingOptions = ['apiKey', 'adminAPIKey', 'workloadIdentity', 'x509Transport', 'baseURL', 'dataResidency'].filter((key) => (key === 'workloadIdentity' ? workloadIdentity : clientOptions[key]) != null);
|
|
178
|
+
if (conflictingOptions.length) {
|
|
179
|
+
throw new Errors.OpenAIError(`The \`provider\` option cannot be used with ${conflictingOptions
|
|
180
|
+
.map((key) => `\`${key}\``)
|
|
181
|
+
.join(', ')}. Configure authentication and the base URL through the provider instead.`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
const identity = (0, x509_workload_identity_auth_1.isX509WorkloadIdentity)(workloadIdentity)
|
|
185
|
+
? { x509: workloadIdentity, legacy: undefined }
|
|
186
|
+
: { x509: undefined, legacy: workloadIdentity };
|
|
187
|
+
const x509Identity = identity.x509;
|
|
188
|
+
const usesX509Identity = x509Identity !== undefined;
|
|
189
|
+
const providerRuntime = provider ? (0, provider_1.configureProvider)(provider) : undefined;
|
|
129
190
|
const options = {
|
|
130
191
|
apiKey,
|
|
131
192
|
adminAPIKey,
|
|
@@ -133,20 +194,42 @@ class OpenAI {
|
|
|
133
194
|
project,
|
|
134
195
|
webhookSecret,
|
|
135
196
|
workloadIdentity,
|
|
197
|
+
x509Transport,
|
|
198
|
+
provider,
|
|
136
199
|
...opts,
|
|
137
|
-
baseURL: baseURL
|
|
200
|
+
baseURL: providerRuntime?.baseURL ??
|
|
201
|
+
residencyBaseURL ??
|
|
202
|
+
(baseURL || (usesX509Identity ? x509_api_origin_1.X509_API_BASE_URL : `https://api.openai.com/v1`)),
|
|
138
203
|
};
|
|
204
|
+
if (x509Transport && !usesX509Identity) {
|
|
205
|
+
throw new Errors.OpenAIError('An X.509 transport requires an X.509 workload identity.');
|
|
206
|
+
}
|
|
207
|
+
if (usesX509Identity) {
|
|
208
|
+
if (residencyBaseURL !== undefined || inheritedResidencySelection) {
|
|
209
|
+
throw new Errors.OpenAIError('X.509 workload identity does not support data residency selection.');
|
|
210
|
+
}
|
|
211
|
+
if (clientOptions.fetch !== undefined) {
|
|
212
|
+
throw new Errors.OpenAIError('X.509 workload identity does not support a custom fetch implementation.');
|
|
213
|
+
}
|
|
214
|
+
(0, x509_api_origin_1.assertX509APIOrigin)(options.baseURL);
|
|
215
|
+
(0, x509_workload_identity_auth_1.assertX509RequestOptions)(options.fetchOptions);
|
|
216
|
+
if (this.fetchWithAuth !== _a.prototype.fetchWithAuth ||
|
|
217
|
+
this.fetchWithTimeout !== _a.prototype.fetchWithTimeout) {
|
|
218
|
+
throw new Errors.OpenAIError('X.509 workload identity does not support overridden fetch dispatch hooks.');
|
|
219
|
+
}
|
|
220
|
+
}
|
|
139
221
|
if (apiKey && workloadIdentity) {
|
|
140
222
|
throw new Errors.OpenAIError('The `apiKey` and `workloadIdentity` options are mutually exclusive');
|
|
141
223
|
}
|
|
142
|
-
if (!apiKey && !adminAPIKey && !workloadIdentity) {
|
|
224
|
+
if (!providerRuntime && !apiKey && !adminAPIKey && !workloadIdentity) {
|
|
143
225
|
throw new Errors.OpenAIError('Missing credentials. Please pass an `apiKey`, `workloadIdentity`, `adminAPIKey`, or set the `OPENAI_API_KEY` or `OPENAI_ADMIN_KEY` environment variable.');
|
|
144
226
|
}
|
|
145
|
-
if (!options.dangerouslyAllowBrowser && (
|
|
227
|
+
if (!options.dangerouslyAllowBrowser && isRunningInBrowserOrBrowserWorker()) {
|
|
146
228
|
throw new Errors.OpenAIError("It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\nIf you understand the risks and have appropriate mitigations in place,\nyou can set the `dangerouslyAllowBrowser` option to `true`, e.g.,\n\nnew OpenAI({ apiKey, dangerouslyAllowBrowser: true });\n\nhttps://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety\n");
|
|
147
229
|
}
|
|
148
230
|
this.baseURL = options.baseURL;
|
|
149
|
-
this
|
|
231
|
+
tslib_1.__classPrivateFieldSet(this, _OpenAI_explicitDataResidency, residencyBaseURL !== undefined || inheritedResidencySelection, "f");
|
|
232
|
+
this.timeout = options.timeout ?? _a.DEFAULT_TIMEOUT; /* 10 minutes */
|
|
150
233
|
this.logger = options.logger ?? console;
|
|
151
234
|
const defaultLogLevel = 'warn';
|
|
152
235
|
// Set default logLevel early so that we can log a warning in parseLogLevel.
|
|
@@ -159,7 +242,7 @@ class OpenAI {
|
|
|
159
242
|
this.maxRetries = options.maxRetries ?? 2;
|
|
160
243
|
this.fetch = options.fetch ?? Shims.getDefaultFetch();
|
|
161
244
|
tslib_1.__classPrivateFieldSet(this, _OpenAI_encoder, Opts.FallbackEncoder, "f");
|
|
162
|
-
const customHeadersEnv = (0, env_1.readEnv)('OPENAI_CUSTOM_HEADERS');
|
|
245
|
+
const customHeadersEnv = provider || credential ? undefined : (0, env_1.readEnv)('OPENAI_CUSTOM_HEADERS');
|
|
163
246
|
if (customHeadersEnv) {
|
|
164
247
|
const parsed = {};
|
|
165
248
|
for (const line of customHeadersEnv.split('\n')) {
|
|
@@ -171,8 +254,18 @@ class OpenAI {
|
|
|
171
254
|
options.defaultHeaders = (0, headers_1.buildHeaders)([parsed, options.defaultHeaders]);
|
|
172
255
|
}
|
|
173
256
|
this._options = options;
|
|
174
|
-
|
|
175
|
-
|
|
257
|
+
this._provider = providerRuntime;
|
|
258
|
+
if (x509Identity) {
|
|
259
|
+
const authentication = new x509_workload_identity_auth_1.X509WorkloadIdentityAuth(x509Identity, x509Transport, organization, project);
|
|
260
|
+
this._workloadIdentityAuth = authentication;
|
|
261
|
+
tslib_1.__classPrivateFieldSet(this, _OpenAI_x509Authentication, authentication, "f");
|
|
262
|
+
tslib_1.__classPrivateFieldSet(this, _OpenAI_x509Credential, credential, "f");
|
|
263
|
+
tslib_1.__classPrivateFieldSet(this, _OpenAI_x509Fetch, authentication.fetch(), "f");
|
|
264
|
+
this.fetch = tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Fetch, "f");
|
|
265
|
+
(0, _x509_transport_state_1.markApprovedX509Client)(this);
|
|
266
|
+
}
|
|
267
|
+
else if (identity.legacy) {
|
|
268
|
+
this._workloadIdentityAuth = new workload_identity_auth_1.WorkloadIdentityAuth(identity.legacy, this.fetch);
|
|
176
269
|
}
|
|
177
270
|
this.apiKey = typeof apiKey === 'string' ? apiKey : null;
|
|
178
271
|
this.adminAPIKey = adminAPIKey;
|
|
@@ -184,28 +277,78 @@ class OpenAI {
|
|
|
184
277
|
* Create a new client instance re-using the same options given to the current client with optional overriding.
|
|
185
278
|
*/
|
|
186
279
|
withOptions(options) {
|
|
187
|
-
const
|
|
280
|
+
const residencyBaseURL = (0, data_residency_1.resolveDataResidency)(options);
|
|
281
|
+
const x509Authentication = tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f");
|
|
282
|
+
const inheritedOptions = {
|
|
188
283
|
...this._options,
|
|
189
284
|
baseURL: this.baseURL,
|
|
190
285
|
maxRetries: this.maxRetries,
|
|
191
286
|
timeout: this.timeout,
|
|
192
287
|
logger: this.logger,
|
|
193
288
|
logLevel: this.logLevel,
|
|
194
|
-
fetch: this.fetch,
|
|
289
|
+
fetch: tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f") ? undefined : this.fetch,
|
|
195
290
|
fetchOptions: this.fetchOptions,
|
|
196
291
|
apiKey: this._options.apiKey,
|
|
197
292
|
adminAPIKey: this.adminAPIKey,
|
|
198
|
-
workloadIdentity: this._options.workloadIdentity,
|
|
293
|
+
workloadIdentity: x509Authentication?.identitySnapshot() ?? this._options.workloadIdentity,
|
|
294
|
+
x509Transport: this._options.x509Transport,
|
|
199
295
|
organization: this.organization,
|
|
200
296
|
project: this.project,
|
|
201
297
|
webhookSecret: this.webhookSecret,
|
|
298
|
+
};
|
|
299
|
+
const { credential, provider } = (0, x509_credential_options_1.prepareX509ClientClone)(inheritedOptions, options, tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Credential, "f"), x509Authentication !== undefined);
|
|
300
|
+
if (residencyBaseURL !== undefined) {
|
|
301
|
+
delete inheritedOptions.baseURL;
|
|
302
|
+
}
|
|
303
|
+
const clientOptions = {
|
|
304
|
+
...inheritedOptions,
|
|
202
305
|
...options,
|
|
203
|
-
|
|
306
|
+
credential,
|
|
307
|
+
provider,
|
|
308
|
+
[inheritedDataResidencySelection]: tslib_1.__classPrivateFieldGet(this, _OpenAI_explicitDataResidency, "f") &&
|
|
309
|
+
residencyBaseURL === undefined &&
|
|
310
|
+
!(0, values_1.hasOwn)(options, 'baseURL') &&
|
|
311
|
+
options.credential === undefined &&
|
|
312
|
+
!provider,
|
|
313
|
+
};
|
|
314
|
+
const client = new this.constructor(clientOptions);
|
|
315
|
+
if (provider && new URL(client.baseURL).origin !== new URL(this.baseURL).origin) {
|
|
316
|
+
Object.assign(client._options, {
|
|
317
|
+
defaultHeaders: options.defaultHeaders,
|
|
318
|
+
defaultQuery: options.defaultQuery,
|
|
319
|
+
fetchOptions: options.fetchOptions,
|
|
320
|
+
fetch: options.fetch,
|
|
321
|
+
});
|
|
322
|
+
client.fetchOptions = options.fetchOptions;
|
|
323
|
+
client.fetch = options.fetch ?? Shims.getDefaultFetch();
|
|
324
|
+
client.organization = options.organization ?? null;
|
|
325
|
+
client.project = options.project ?? null;
|
|
326
|
+
}
|
|
327
|
+
if (tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f") &&
|
|
328
|
+
tslib_1.__classPrivateFieldGet(client, _OpenAI_x509Authentication, "f") &&
|
|
329
|
+
this.baseURL === client.baseURL &&
|
|
330
|
+
tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f").matches(tslib_1.__classPrivateFieldGet(client, _OpenAI_x509Authentication, "f"))) {
|
|
331
|
+
client._workloadIdentityAuth = tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f");
|
|
332
|
+
tslib_1.__classPrivateFieldSet(client, _OpenAI_x509Authentication, tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f"), "f");
|
|
333
|
+
tslib_1.__classPrivateFieldSet(client, _OpenAI_x509Fetch, tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Fetch, "f"), "f");
|
|
334
|
+
}
|
|
204
335
|
return client;
|
|
205
336
|
}
|
|
206
337
|
defaultQuery() {
|
|
207
338
|
return this._options.defaultQuery;
|
|
208
339
|
}
|
|
340
|
+
/** @internal Client request headers for each new WebSocket handshake. */
|
|
341
|
+
_buildWebSocketHeaders(authHeaders) {
|
|
342
|
+
return Object.fromEntries((0, headers_1.buildHeaders)([
|
|
343
|
+
{
|
|
344
|
+
'User-Agent': this.getUserAgent(),
|
|
345
|
+
'OpenAI-Organization': this.organization,
|
|
346
|
+
'OpenAI-Project': this.project,
|
|
347
|
+
},
|
|
348
|
+
authHeaders,
|
|
349
|
+
this._options.defaultHeaders,
|
|
350
|
+
]).values);
|
|
351
|
+
}
|
|
209
352
|
validateHeaders({ values, nulls }, schemes = {
|
|
210
353
|
bearerAuth: true,
|
|
211
354
|
adminAPIKeyAuth: true,
|
|
@@ -225,19 +368,47 @@ class OpenAI {
|
|
|
225
368
|
bearerAuth: true,
|
|
226
369
|
adminAPIKeyAuth: true,
|
|
227
370
|
}) {
|
|
371
|
+
const authentication = tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f") ?? this._workloadIdentityAuth;
|
|
372
|
+
if (authentication instanceof x509_workload_identity_auth_1.X509WorkloadIdentityAuth &&
|
|
373
|
+
schemes.adminAPIKeyAuth &&
|
|
374
|
+
this.adminAPIKey !== null) {
|
|
375
|
+
return await this.adminAPIKeyAuth(opts);
|
|
376
|
+
}
|
|
228
377
|
return (0, headers_1.buildHeaders)([
|
|
229
378
|
schemes.bearerAuth ? await this.bearerAuth(opts) : null,
|
|
230
379
|
schemes.adminAPIKeyAuth ? await this.adminAPIKeyAuth(opts) : null,
|
|
231
380
|
]);
|
|
232
381
|
}
|
|
233
382
|
async bearerAuth(opts) {
|
|
234
|
-
|
|
235
|
-
|
|
383
|
+
const authentication = tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f") ?? this._workloadIdentityAuth;
|
|
384
|
+
if (authentication) {
|
|
385
|
+
if (authentication instanceof x509_workload_identity_auth_1.X509WorkloadIdentityAuth) {
|
|
386
|
+
if (authentication === this._workloadIdentityAuth &&
|
|
387
|
+
(this.fetchWithAuth !== _a.prototype.fetchWithAuth ||
|
|
388
|
+
this.fetchWithTimeout !== _a.prototype.fetchWithTimeout)) {
|
|
389
|
+
throw new Errors.OpenAIError('X.509 workload identity does not support overridden fetch dispatch hooks.');
|
|
390
|
+
}
|
|
391
|
+
const snapshots = authentication.headerSnapshots();
|
|
392
|
+
if (!x509_workload_identity_auth_1.X509WorkloadIdentityAuth.shouldAuthenticate(opts, snapshots.defaultHeaders, snapshots.requestHeaders)) {
|
|
393
|
+
return undefined;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
const token = authentication instanceof x509_workload_identity_auth_1.X509WorkloadIdentityAuth
|
|
397
|
+
? await authentication.getToken(opts, {
|
|
398
|
+
apiURL: authentication.requestAPIURL(),
|
|
399
|
+
...authentication.headerSnapshots(),
|
|
400
|
+
...authentication.requestSnapshot(),
|
|
401
|
+
signal: authentication.effectiveSignal(),
|
|
402
|
+
...authentication.tenantSnapshot(),
|
|
403
|
+
})
|
|
404
|
+
: await authentication.getToken();
|
|
405
|
+
return (0, headers_1.buildHeaders)([{ Authorization: `Bearer ${token}` }]);
|
|
236
406
|
}
|
|
237
|
-
|
|
407
|
+
const { apiKey } = await (0, realtime_credentials_1.resolveRealtimeAPIKey)(this);
|
|
408
|
+
if (apiKey == null) {
|
|
238
409
|
return undefined;
|
|
239
410
|
}
|
|
240
|
-
return (0, headers_1.buildHeaders)([{ Authorization: `Bearer ${
|
|
411
|
+
return (0, headers_1.buildHeaders)([{ Authorization: `Bearer ${apiKey}` }]);
|
|
241
412
|
}
|
|
242
413
|
async adminAPIKeyAuth(opts) {
|
|
243
414
|
if (this.adminAPIKey == null) {
|
|
@@ -255,12 +426,30 @@ class OpenAI {
|
|
|
255
426
|
return `stainless-node-retry-${(0, uuid_1.uuid4)()}`;
|
|
256
427
|
}
|
|
257
428
|
makeStatusError(status, error, message, headers) {
|
|
258
|
-
|
|
429
|
+
const normalizedError = error && typeof error === 'object' && error.error == null ? { error } : error;
|
|
430
|
+
return Errors.APIError.generate(status, normalizedError, message, headers);
|
|
431
|
+
}
|
|
432
|
+
_hasApiKeyProvider() {
|
|
433
|
+
return typeof this._options.apiKey === 'function';
|
|
259
434
|
}
|
|
260
|
-
|
|
435
|
+
/**
|
|
436
|
+
* Resolves a function-based API key and retains the resolved value on this client.
|
|
437
|
+
* Returns whether a provider was invoked. Internal callers can capture this
|
|
438
|
+
* invocation's key before another request updates the shared `apiKey` property.
|
|
439
|
+
* Overrides should forward `capture` or invoke it with their own resolved key
|
|
440
|
+
* to preserve invocation-local credentials in concurrent requests and Realtime factories.
|
|
441
|
+
* @internal
|
|
442
|
+
*/
|
|
443
|
+
async _callApiKey(capture) {
|
|
444
|
+
if (this._provider) {
|
|
445
|
+
capture?.(this.apiKey);
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
261
448
|
const apiKey = this._options.apiKey;
|
|
262
|
-
if (typeof apiKey !== 'function')
|
|
449
|
+
if (typeof apiKey !== 'function') {
|
|
450
|
+
capture?.(this.apiKey);
|
|
263
451
|
return false;
|
|
452
|
+
}
|
|
264
453
|
let token;
|
|
265
454
|
try {
|
|
266
455
|
token = await apiKey();
|
|
@@ -276,12 +465,13 @@ class OpenAI {
|
|
|
276
465
|
throw new Errors.OpenAIError(`Expected 'apiKey' function argument to return a string but it returned ${token}`);
|
|
277
466
|
}
|
|
278
467
|
this.apiKey = token;
|
|
468
|
+
capture?.(this.apiKey);
|
|
279
469
|
return true;
|
|
280
470
|
}
|
|
281
471
|
buildURL(path, query, defaultBaseURL) {
|
|
282
472
|
const baseURL = (!tslib_1.__classPrivateFieldGet(this, _OpenAI_instances, "m", _OpenAI_baseURLOverridden).call(this) && defaultBaseURL) || this.baseURL;
|
|
283
|
-
const url = (0, values_1.isAbsoluteURL)(path)
|
|
284
|
-
new URL(path)
|
|
473
|
+
const url = (0, values_1.isAbsoluteURL)(path)
|
|
474
|
+
? new URL(path)
|
|
285
475
|
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
|
|
286
476
|
const defaultQuery = this.defaultQuery();
|
|
287
477
|
const pathQuery = Object.fromEntries(url.searchParams);
|
|
@@ -295,13 +485,11 @@ class OpenAI {
|
|
|
295
485
|
}
|
|
296
486
|
/**
|
|
297
487
|
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
488
|
+
* Function-based credentials are resolved later, when building authentication
|
|
489
|
+
* headers, including for direct `buildRequest()` calls. Overriding this hook
|
|
490
|
+
* does not bypass that resolution.
|
|
298
491
|
*/
|
|
299
|
-
async prepareOptions(options) {
|
|
300
|
-
const security = options.__security ?? { bearerAuth: true };
|
|
301
|
-
if (security.bearerAuth) {
|
|
302
|
-
await this._callApiKey();
|
|
303
|
-
}
|
|
304
|
-
}
|
|
492
|
+
async prepareOptions(options) { }
|
|
305
493
|
/**
|
|
306
494
|
* Used as a callback for mutating the given `RequestInit` object.
|
|
307
495
|
*
|
|
@@ -330,7 +518,162 @@ class OpenAI {
|
|
|
330
518
|
}));
|
|
331
519
|
}
|
|
332
520
|
request(options, remainingRetries = null) {
|
|
333
|
-
|
|
521
|
+
const authentication = tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f") ?? this._workloadIdentityAuth;
|
|
522
|
+
const request = authentication instanceof x509_workload_identity_auth_1.X509WorkloadIdentityAuth
|
|
523
|
+
? Promise.resolve(options).then((resolved) => authentication.runRequest(() => this.makeRequest(resolved, remainingRetries, undefined), this))
|
|
524
|
+
: this.makeRequest(options, remainingRetries, undefined);
|
|
525
|
+
return this.responsePromise(request);
|
|
526
|
+
}
|
|
527
|
+
responsePromise(request, parse = (client, props) => this.parseResponseWithTimeout(client, props)) {
|
|
528
|
+
const promise = new api_promise_1.APIPromise(this, request, (client, props) => {
|
|
529
|
+
const resume = tslib_1.__classPrivateFieldGet(this, _OpenAI_responseAttempts, "f").get(props.controller)?.continueRequest;
|
|
530
|
+
return resume ? resume(() => parse(client, props)) : parse(client, props);
|
|
531
|
+
});
|
|
532
|
+
// A body timeout can retry after the original raw response has arrived. Wait for
|
|
533
|
+
// parsing before selecting the response so withResponse() reports the retry.
|
|
534
|
+
promise.withResponse = async () => {
|
|
535
|
+
const data = await promise;
|
|
536
|
+
const { response } = await request;
|
|
537
|
+
return { data, response, request_id: response.headers.get('x-request-id') };
|
|
538
|
+
};
|
|
539
|
+
promise._thenUnwrap = (transform) => this.responsePromise(request, async (client, props) => (0, parse_1.addRequestID)(transform(await parse(client, props), props), props.response));
|
|
540
|
+
return promise;
|
|
541
|
+
}
|
|
542
|
+
async parseResponseWithTimeout(client, props) {
|
|
543
|
+
if (props.options.stream ||
|
|
544
|
+
props.options.__binaryResponse ||
|
|
545
|
+
props.response.status === 204 ||
|
|
546
|
+
props.response.headers.get('content-length') === '0') {
|
|
547
|
+
return (0, parse_1.defaultParseResponse)(client, props);
|
|
548
|
+
}
|
|
549
|
+
while (true) {
|
|
550
|
+
const attempt = tslib_1.__classPrivateFieldGet(this, _OpenAI_responseAttempts, "f").get(props.controller);
|
|
551
|
+
const timeout = attempt?.timeout ?? props.options.timeout ?? this.timeout;
|
|
552
|
+
const x509Authentication = attempt?.authentication;
|
|
553
|
+
const callerSignal = x509Authentication ? props.controller.signal : props.options.signal;
|
|
554
|
+
const abortError = () => x509Authentication && callerSignal
|
|
555
|
+
? this._makeUserAbortError(callerSignal)
|
|
556
|
+
: new Errors.APIUserAbortError();
|
|
557
|
+
let remaining;
|
|
558
|
+
try {
|
|
559
|
+
remaining =
|
|
560
|
+
x509Authentication?.remainingTimeout(props.options, timeout) ??
|
|
561
|
+
Math.max(0, props.startTime + timeout - Date.now());
|
|
562
|
+
}
|
|
563
|
+
catch (error) {
|
|
564
|
+
const cancellation = callerSignal?.aborted ? abortError() : undefined;
|
|
565
|
+
props.controller.abort();
|
|
566
|
+
void Shims.CancelReadableStream(props.response.body).catch(() => undefined);
|
|
567
|
+
throw cancellation ?? error;
|
|
568
|
+
}
|
|
569
|
+
let timer;
|
|
570
|
+
let abortListener;
|
|
571
|
+
let timedOut = false;
|
|
572
|
+
try {
|
|
573
|
+
// Tool runners preserve a completed buffered turn before cancellation stops the next request.
|
|
574
|
+
if (callerSignal?.aborted && attempt?.helperMethod !== 'runTools') {
|
|
575
|
+
throw abortError();
|
|
576
|
+
}
|
|
577
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
578
|
+
timer = setTimeout(() => {
|
|
579
|
+
timedOut = true;
|
|
580
|
+
props.controller.abort();
|
|
581
|
+
reject(new Errors.APIConnectionTimeoutError());
|
|
582
|
+
}, remaining);
|
|
583
|
+
if (callerSignal) {
|
|
584
|
+
abortListener = () => {
|
|
585
|
+
if (!timedOut)
|
|
586
|
+
reject(abortError());
|
|
587
|
+
};
|
|
588
|
+
callerSignal.addEventListener('abort', abortListener, { once: true });
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
return await Promise.race([(0, parse_1.defaultParseResponse)(client, props), timeoutPromise]);
|
|
592
|
+
}
|
|
593
|
+
catch (error) {
|
|
594
|
+
if (callerSignal?.aborted && !timedOut) {
|
|
595
|
+
throw abortError();
|
|
596
|
+
}
|
|
597
|
+
if (!timedOut) {
|
|
598
|
+
if (x509Authentication && error instanceof SyntaxError) {
|
|
599
|
+
throw new SyntaxError('X.509 workload identity API response contains invalid JSON.');
|
|
600
|
+
}
|
|
601
|
+
if (x509Authentication && !(error instanceof Errors.OpenAIError)) {
|
|
602
|
+
throw new Errors.APIConnectionError({
|
|
603
|
+
message: 'X.509 workload identity API response body could not be read.',
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
throw error;
|
|
607
|
+
}
|
|
608
|
+
const retriesRemaining = attempt?.retriesRemaining ?? 0;
|
|
609
|
+
if (!retriesRemaining ||
|
|
610
|
+
attempt?.hasStreamingBody ||
|
|
611
|
+
props.options.__metadata?.['hasStreamingBody'] ||
|
|
612
|
+
(globalThis.ReadableStream &&
|
|
613
|
+
props.options.body instanceof globalThis.ReadableStream) ||
|
|
614
|
+
(typeof props.options.body === 'object' &&
|
|
615
|
+
props.options.body !== null &&
|
|
616
|
+
(Symbol.asyncIterator in props.options.body ||
|
|
617
|
+
(Symbol.iterator in props.options.body &&
|
|
618
|
+
'next' in props.options.body &&
|
|
619
|
+
typeof props.options.body.next === 'function')))) {
|
|
620
|
+
throw new Errors.APIConnectionTimeoutError();
|
|
621
|
+
}
|
|
622
|
+
if (timer !== undefined)
|
|
623
|
+
clearTimeout(timer);
|
|
624
|
+
if (abortListener)
|
|
625
|
+
callerSignal?.removeEventListener('abort', abortListener);
|
|
626
|
+
abortListener = undefined;
|
|
627
|
+
const next = await this.retryRequest(props.options, retriesRemaining, props.retryOfRequestLogID ?? props.requestLogID, undefined, props.requestSignal);
|
|
628
|
+
Object.assign(props, next);
|
|
629
|
+
}
|
|
630
|
+
finally {
|
|
631
|
+
if (timer !== undefined)
|
|
632
|
+
clearTimeout(timer);
|
|
633
|
+
if (abortListener)
|
|
634
|
+
callerSignal?.removeEventListener('abort', abortListener);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
/** Keeps terminal X.509 error-body consumption inside the original logical request deadline. */
|
|
639
|
+
async readX509ResponseError(response, options, timeout, controller, authentication) {
|
|
640
|
+
const deadline = new AbortController();
|
|
641
|
+
const callerSignal = controller.signal;
|
|
642
|
+
let timedOut = false;
|
|
643
|
+
const cancel = () => deadline.abort(callerSignal.reason);
|
|
644
|
+
callerSignal.addEventListener('abort', cancel, { once: true });
|
|
645
|
+
if (callerSignal.aborted) {
|
|
646
|
+
cancel();
|
|
647
|
+
}
|
|
648
|
+
try {
|
|
649
|
+
const remaining = authentication.remainingTimeout(options, timeout);
|
|
650
|
+
const expiration = authentication.waitForRetry(remaining, deadline.signal).then(() => {
|
|
651
|
+
throw new Errors.APIConnectionTimeoutError();
|
|
652
|
+
});
|
|
653
|
+
const body = await Promise.race([
|
|
654
|
+
response.text().catch(() => 'X.509 workload identity API response body could not be read.'),
|
|
655
|
+
expiration,
|
|
656
|
+
]);
|
|
657
|
+
if (callerSignal.aborted) {
|
|
658
|
+
throw this._makeUserAbortError(callerSignal);
|
|
659
|
+
}
|
|
660
|
+
return body;
|
|
661
|
+
}
|
|
662
|
+
catch (error) {
|
|
663
|
+
if (error instanceof Errors.APIConnectionTimeoutError) {
|
|
664
|
+
timedOut = !callerSignal.aborted;
|
|
665
|
+
controller.abort();
|
|
666
|
+
void Shims.CancelReadableStream(response.body).catch(() => undefined);
|
|
667
|
+
}
|
|
668
|
+
if (callerSignal.aborted && !timedOut) {
|
|
669
|
+
throw this._makeUserAbortError(callerSignal);
|
|
670
|
+
}
|
|
671
|
+
throw error;
|
|
672
|
+
}
|
|
673
|
+
finally {
|
|
674
|
+
callerSignal.removeEventListener('abort', cancel);
|
|
675
|
+
deadline.abort();
|
|
676
|
+
}
|
|
334
677
|
}
|
|
335
678
|
async makeRequest(optionsInput, retriesRemaining, retryOfRequestLogID) {
|
|
336
679
|
const options = await optionsInput;
|
|
@@ -338,33 +681,110 @@ class OpenAI {
|
|
|
338
681
|
if (retriesRemaining == null) {
|
|
339
682
|
retriesRemaining = maxRetries;
|
|
340
683
|
}
|
|
684
|
+
const x509Authentication = tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f");
|
|
685
|
+
x509Authentication?.beginRequestPreparation();
|
|
341
686
|
await this.prepareOptions(options);
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
687
|
+
x509Authentication?.beginRequestPlanning();
|
|
688
|
+
let built;
|
|
689
|
+
try {
|
|
690
|
+
const candidate = await this.buildRequest(options, {
|
|
691
|
+
retryCount: maxRetries - retriesRemaining,
|
|
692
|
+
});
|
|
693
|
+
built = { req: candidate.req, url: candidate.url, timeout: candidate.timeout };
|
|
694
|
+
if (x509Authentication) {
|
|
695
|
+
(0, values_1.validatePositiveInteger)('timeout', built.timeout);
|
|
696
|
+
x509Authentication.authorizePlannedRequest(built.url, built.req, built.timeout);
|
|
697
|
+
if (x509_workload_identity_auth_1.X509WorkloadIdentityAuth.isStreamingRequestBody(built.req.body)) {
|
|
698
|
+
options.__metadata = { ...options.__metadata, hasStreamingBody: true };
|
|
699
|
+
}
|
|
700
|
+
await this.prepareRequest(built.req, { url: built.url, options });
|
|
701
|
+
await this._provider?.prepareRequest?.(built.req, { url: built.url, options });
|
|
702
|
+
x509Authentication.beginRequestPlanning();
|
|
703
|
+
x509Authentication.authorizePlannedRequest(built.url, built.req, built.timeout, true);
|
|
704
|
+
if (x509_workload_identity_auth_1.X509WorkloadIdentityAuth.isStreamingRequestBody(built.req.body)) {
|
|
705
|
+
options.__metadata = { ...options.__metadata, hasStreamingBody: true };
|
|
706
|
+
}
|
|
707
|
+
const callerSignal = x509Authentication.requestSnapshot().signal;
|
|
708
|
+
if (callerSignal?.aborted || built.req.signal?.aborted) {
|
|
709
|
+
throw this._makeUserAbortError(callerSignal?.aborted ? callerSignal : built.req.signal);
|
|
710
|
+
}
|
|
711
|
+
x509Authentication.setEffectiveSignal(built.req.signal || callerSignal
|
|
712
|
+
? createRequestController(built.req.signal ?? callerSignal, callerSignal).signal
|
|
713
|
+
: undefined);
|
|
714
|
+
x509Authentication.beginRequestNetwork();
|
|
715
|
+
const security = options.__security ?? { bearerAuth: true };
|
|
716
|
+
const authenticationHeaders = await this.authHeaders(options, security);
|
|
717
|
+
const suppliedHeaders = x509Authentication.headerSnapshots();
|
|
718
|
+
const supplied = (0, headers_1.buildHeaders)([suppliedHeaders.defaultHeaders, suppliedHeaders.requestHeaders]);
|
|
719
|
+
for (const [name, value] of authenticationHeaders?.values ?? []) {
|
|
720
|
+
if (!supplied.nulls.has(name) && !built.req.headers.has(name)) {
|
|
721
|
+
built.req.headers.set(name, value);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
this.validateHeaders((0, headers_1.buildHeaders)([supplied, built.req.headers]), security);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
catch (error) {
|
|
728
|
+
x509Authentication?.retireRequestBody();
|
|
729
|
+
if (x509Authentication &&
|
|
730
|
+
retriesRemaining &&
|
|
731
|
+
!options.__metadata?.['hasStreamingBody'] &&
|
|
732
|
+
x509_workload_identity_auth_1.X509WorkloadIdentityAuth.isRetryableFailure(error)) {
|
|
733
|
+
return await this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? 'x509-token-exchange', x509_workload_identity_auth_1.X509WorkloadIdentityAuth.retryHeaders(error));
|
|
734
|
+
}
|
|
735
|
+
throw error;
|
|
736
|
+
}
|
|
737
|
+
const { req, url } = built;
|
|
738
|
+
const timeout = x509Authentication
|
|
739
|
+
? Math.min(built.timeout, x509Authentication.requestSnapshot().timeout)
|
|
740
|
+
: built.timeout;
|
|
741
|
+
x509Authentication?.bindRequest(options, req, this.adminAPIKey);
|
|
742
|
+
let hasStreamingBody = options.__metadata?.['hasStreamingBody'] === true;
|
|
743
|
+
if (!x509Authentication) {
|
|
744
|
+
await this.prepareRequest(req, { url, options });
|
|
745
|
+
await this._provider?.prepareRequest?.(req, { url, options });
|
|
746
|
+
}
|
|
747
|
+
x509Authentication?.adoptRequestHeaders(req);
|
|
748
|
+
if (x509Authentication && x509_workload_identity_auth_1.X509WorkloadIdentityAuth.isStreamingRequestBody(req.body)) {
|
|
749
|
+
hasStreamingBody = true;
|
|
750
|
+
}
|
|
346
751
|
/** Not an API request ID, just for correlating local log entries. */
|
|
347
752
|
const requestLogID = 'log_' + ((Math.random() * (1 << 24)) | 0).toString(16).padStart(6, '0');
|
|
348
753
|
const retryLogStr = retryOfRequestLogID === undefined ? '' : `, retryOf: ${retryOfRequestLogID}`;
|
|
349
|
-
const startTime = Date.now();
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
754
|
+
const startTime = x509Authentication?.requestStartedAt(options) ?? Date.now();
|
|
755
|
+
if (this.logLevel === 'debug') {
|
|
756
|
+
// Summarize serialized strings without reparsing or re-running caller serialization hooks.
|
|
757
|
+
const body = typeof req.body === 'string' ? { type: 'string', length: req.body.length } : req.body;
|
|
758
|
+
(0, log_1.loggerFor)(this).debug(`[${requestLogID}] sending request`, (0, log_1.formatRequestDetails)({
|
|
759
|
+
retryOfRequestLogID,
|
|
760
|
+
method: options.method,
|
|
761
|
+
url,
|
|
762
|
+
options: x509Authentication
|
|
763
|
+
? { body, ...x509Authentication.requestSnapshot() }
|
|
764
|
+
: { ...options, body },
|
|
765
|
+
headers: req.headers,
|
|
766
|
+
}));
|
|
767
|
+
}
|
|
768
|
+
const callerSignal = x509Authentication ? x509Authentication.requestSnapshot().signal : options.signal;
|
|
769
|
+
if (callerSignal?.aborted || req.signal?.aborted) {
|
|
770
|
+
throw this._makeUserAbortError(callerSignal?.aborted ? callerSignal : req.signal);
|
|
359
771
|
}
|
|
360
772
|
const security = options.__security ?? { bearerAuth: true };
|
|
361
|
-
|
|
362
|
-
const
|
|
773
|
+
// Request hooks may replace the caller signal before it reaches fetch.
|
|
774
|
+
const controller = x509Authentication || this.fetchWithTimeout === _a.prototype.fetchWithTimeout
|
|
775
|
+
? createRequestController(req.signal ?? (x509Authentication ? callerSignal : undefined), x509Authentication ? callerSignal : undefined)
|
|
776
|
+
: new AbortController();
|
|
777
|
+
const remainingTimeout = x509Authentication?.remainingTimeout(options, timeout) ?? timeout;
|
|
778
|
+
const fetchWithAuth = x509Authentication ? _a.prototype.fetchWithAuth : this.fetchWithAuth;
|
|
779
|
+
x509Authentication?.releaseRequestBody(req.body);
|
|
780
|
+
const response = await fetchWithAuth
|
|
781
|
+
.call(this, url, req, remainingTimeout, controller, security)
|
|
782
|
+
.catch(errors_1.castToError);
|
|
363
783
|
const headersTime = Date.now();
|
|
364
784
|
if (response instanceof globalThis.Error) {
|
|
365
785
|
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
366
|
-
if (
|
|
367
|
-
throw
|
|
786
|
+
if (callerSignal?.aborted || req.signal?.aborted) {
|
|
787
|
+
throw this._makeUserAbortError(callerSignal?.aborted ? callerSignal : req.signal);
|
|
368
788
|
}
|
|
369
789
|
// detect native connection timeout errors
|
|
370
790
|
// deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)"
|
|
@@ -372,28 +792,50 @@ class OpenAI {
|
|
|
372
792
|
// others do not provide enough information to distinguish timeouts from other connection errors
|
|
373
793
|
const isTimeout = (0, errors_1.isAbortError)(response) ||
|
|
374
794
|
/timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : ''));
|
|
375
|
-
if (retriesRemaining
|
|
795
|
+
if (retriesRemaining &&
|
|
796
|
+
!hasStreamingBody &&
|
|
797
|
+
(!x509Authentication || (0, _x509_transport_state_1.isTransientX509ConnectionError)(response))) {
|
|
376
798
|
(0, log_1.loggerFor)(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`);
|
|
377
799
|
(0, log_1.loggerFor)(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`, (0, log_1.formatRequestDetails)({
|
|
378
800
|
retryOfRequestLogID,
|
|
379
801
|
url,
|
|
380
802
|
durationMs: headersTime - startTime,
|
|
381
|
-
message: response.message,
|
|
803
|
+
message: x509Authentication ? 'X.509 workload identity API connection failed.' : response.message,
|
|
382
804
|
}));
|
|
383
|
-
return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID);
|
|
805
|
+
return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID, undefined, req.signal);
|
|
384
806
|
}
|
|
385
|
-
|
|
386
|
-
|
|
807
|
+
const terminalMessage = hasStreamingBody
|
|
808
|
+
? 'error; streaming body cannot be retried'
|
|
809
|
+
: 'error; no more retries left';
|
|
810
|
+
(0, log_1.loggerFor)(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${terminalMessage}`);
|
|
811
|
+
(0, log_1.loggerFor)(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${terminalMessage})`, (0, log_1.formatRequestDetails)({
|
|
387
812
|
retryOfRequestLogID,
|
|
388
813
|
url,
|
|
389
814
|
durationMs: headersTime - startTime,
|
|
390
|
-
message: response.message,
|
|
815
|
+
message: x509Authentication ? 'X.509 workload identity API connection failed.' : response.message,
|
|
391
816
|
}));
|
|
392
817
|
if (response instanceof error_1.OAuthError || response instanceof error_1.SubjectTokenProviderError) {
|
|
393
818
|
throw response;
|
|
394
819
|
}
|
|
395
820
|
if (isTimeout) {
|
|
396
|
-
|
|
821
|
+
const transportCause = 'cause' in response ? response.cause : undefined;
|
|
822
|
+
const isHeadersTimeout = typeof transportCause === 'object' &&
|
|
823
|
+
transportCause !== null &&
|
|
824
|
+
'code' in transportCause &&
|
|
825
|
+
transportCause.code === 'UND_ERR_HEADERS_TIMEOUT';
|
|
826
|
+
const timeoutError = isHeadersTimeout
|
|
827
|
+
? new Errors.APIConnectionTimeoutError({
|
|
828
|
+
message: 'Request timed out. Node.js fetch timed out waiting for response headers; ' +
|
|
829
|
+
'configure a matching undici fetch and fetchOptions.dispatcher with an Agent whose headersTimeout is at least the SDK timeout.',
|
|
830
|
+
})
|
|
831
|
+
: new Errors.APIConnectionTimeoutError();
|
|
832
|
+
if (x509Authentication) {
|
|
833
|
+
throw new Errors.APIConnectionTimeoutError();
|
|
834
|
+
}
|
|
835
|
+
throw Object.assign(timeoutError, { cause: response });
|
|
836
|
+
}
|
|
837
|
+
if (x509Authentication) {
|
|
838
|
+
throw new Errors.APIConnectionError({ message: 'X.509 workload identity API connection failed.' });
|
|
397
839
|
}
|
|
398
840
|
throw new Errors.APIConnectionError({
|
|
399
841
|
message: getConnectionErrorMessage(response),
|
|
@@ -404,28 +846,50 @@ class OpenAI {
|
|
|
404
846
|
.filter(([name]) => name === 'x-request-id')
|
|
405
847
|
.map(([name, value]) => ', ' + name + ': ' + JSON.stringify(value))
|
|
406
848
|
.join('');
|
|
407
|
-
const responseInfo = `[${requestLogID}${retryLogStr}${specialHeaders}] ${req.method} ${url} ${response.ok ? 'succeeded' : 'failed'} with status ${response.status} in ${headersTime - startTime}ms`;
|
|
849
|
+
const responseInfo = `[${requestLogID}${retryLogStr}${specialHeaders}] ${req.method} ${(0, log_1.redactURL)(url)} ${response.ok ? 'succeeded' : 'failed'} with status ${response.status} in ${headersTime - startTime}ms`;
|
|
408
850
|
if (!response.ok) {
|
|
851
|
+
const rejectedX509Credential = response.status === 401 &&
|
|
852
|
+
x509Authentication &&
|
|
853
|
+
security.bearerAuth &&
|
|
854
|
+
x509Authentication.usedWorkloadToken(options);
|
|
855
|
+
if (rejectedX509Credential) {
|
|
856
|
+
x509Authentication.invalidateToken();
|
|
857
|
+
}
|
|
409
858
|
if (response.status === 401 &&
|
|
410
|
-
this._workloadIdentityAuth &&
|
|
859
|
+
(x509Authentication || this._workloadIdentityAuth) &&
|
|
411
860
|
security.bearerAuth &&
|
|
412
|
-
!options
|
|
861
|
+
(!x509Authentication || x509Authentication.usedWorkloadToken(options)) &&
|
|
862
|
+
(!x509Authentication || retriesRemaining > 0) &&
|
|
863
|
+
!hasStreamingBody &&
|
|
413
864
|
!options.__metadata?.['workloadIdentityTokenRefreshed']) {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
865
|
+
if (x509Authentication) {
|
|
866
|
+
void Shims.CancelReadableStream(response.body).catch(() => undefined);
|
|
867
|
+
}
|
|
868
|
+
else {
|
|
869
|
+
await Shims.CancelReadableStream(response.body);
|
|
870
|
+
this._workloadIdentityAuth?.invalidateToken();
|
|
871
|
+
}
|
|
872
|
+
const replayOptions = {
|
|
417
873
|
...options,
|
|
418
874
|
__metadata: {
|
|
419
875
|
...options.__metadata,
|
|
420
876
|
workloadIdentityTokenRefreshed: true,
|
|
421
877
|
},
|
|
422
|
-
}
|
|
878
|
+
};
|
|
879
|
+
return this.makeRequest(replayOptions, x509Authentication ? retriesRemaining - 1 : retriesRemaining, retryOfRequestLogID ?? requestLogID);
|
|
423
880
|
}
|
|
424
|
-
const shouldRetry =
|
|
425
|
-
|
|
881
|
+
const shouldRetry = rejectedX509Credential && options.__metadata?.['workloadIdentityTokenRefreshed']
|
|
882
|
+
? false
|
|
883
|
+
: await this.shouldRetry(response);
|
|
884
|
+
if (retriesRemaining && shouldRetry && !hasStreamingBody) {
|
|
426
885
|
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
427
886
|
// We don't need the body of this response.
|
|
428
|
-
|
|
887
|
+
if (x509Authentication) {
|
|
888
|
+
void Shims.CancelReadableStream(response.body).catch(() => undefined);
|
|
889
|
+
}
|
|
890
|
+
else {
|
|
891
|
+
await Shims.CancelReadableStream(response.body);
|
|
892
|
+
}
|
|
429
893
|
(0, log_1.loggerFor)(this).info(`${responseInfo} - ${retryMessage}`);
|
|
430
894
|
(0, log_1.loggerFor)(this).debug(`[${requestLogID}] response error (${retryMessage})`, (0, log_1.formatRequestDetails)({
|
|
431
895
|
retryOfRequestLogID,
|
|
@@ -434,11 +898,17 @@ class OpenAI {
|
|
|
434
898
|
headers: response.headers,
|
|
435
899
|
durationMs: headersTime - startTime,
|
|
436
900
|
}));
|
|
437
|
-
return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID, response.headers);
|
|
901
|
+
return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID, response.headers, req.signal);
|
|
438
902
|
}
|
|
439
|
-
const retryMessage = shouldRetry
|
|
903
|
+
const retryMessage = shouldRetry
|
|
904
|
+
? hasStreamingBody
|
|
905
|
+
? `error; streaming body cannot be retried`
|
|
906
|
+
: `error; no more retries left`
|
|
907
|
+
: `error; not retryable`;
|
|
440
908
|
(0, log_1.loggerFor)(this).info(`${responseInfo} - ${retryMessage}`);
|
|
441
|
-
const errText =
|
|
909
|
+
const errText = x509Authentication
|
|
910
|
+
? await this.readX509ResponseError(response, options, timeout, controller, x509Authentication)
|
|
911
|
+
: await response.text().catch((err) => (0, errors_1.castToError)(err).message);
|
|
442
912
|
const errJSON = (0, values_1.safeJSON)(errText);
|
|
443
913
|
const errMessage = errJSON ? undefined : errText;
|
|
444
914
|
(0, log_1.loggerFor)(this).debug(`[${requestLogID}] response error (${retryMessage})`, (0, log_1.formatRequestDetails)({
|
|
@@ -460,37 +930,69 @@ class OpenAI {
|
|
|
460
930
|
headers: response.headers,
|
|
461
931
|
durationMs: headersTime - startTime,
|
|
462
932
|
}));
|
|
463
|
-
|
|
933
|
+
const continueRequest = x509Authentication?.continuation();
|
|
934
|
+
x509Authentication?.releaseRequestCredentials();
|
|
935
|
+
tslib_1.__classPrivateFieldGet(this, _OpenAI_responseAttempts, "f").set(controller, {
|
|
936
|
+
timeout,
|
|
937
|
+
retriesRemaining,
|
|
938
|
+
hasStreamingBody,
|
|
939
|
+
...(x509Authentication ? { authentication: x509Authentication } : {}),
|
|
940
|
+
helperMethod: options.__metadata?.['helperMethod'],
|
|
941
|
+
...(continueRequest ? { continueRequest } : {}),
|
|
942
|
+
});
|
|
943
|
+
return {
|
|
944
|
+
response,
|
|
945
|
+
options,
|
|
946
|
+
controller,
|
|
947
|
+
requestSignal: req.signal,
|
|
948
|
+
requestLogID,
|
|
949
|
+
retryOfRequestLogID,
|
|
950
|
+
startTime,
|
|
951
|
+
};
|
|
464
952
|
}
|
|
465
953
|
getAPIList(path, Page, opts) {
|
|
466
|
-
return this.requestAPIList(Page, opts && 'then' in opts
|
|
467
|
-
opts.then((opts) => ({ method: 'get', path, ...opts }))
|
|
954
|
+
return this.requestAPIList(Page, opts && 'then' in opts
|
|
955
|
+
? opts.then((opts) => ({ method: 'get', path, ...opts }))
|
|
468
956
|
: { method: 'get', path, ...opts });
|
|
469
957
|
}
|
|
470
958
|
requestAPIList(Page, options) {
|
|
471
|
-
const
|
|
472
|
-
|
|
959
|
+
const authentication = tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f") ?? this._workloadIdentityAuth;
|
|
960
|
+
const request = authentication instanceof x509_workload_identity_auth_1.X509WorkloadIdentityAuth
|
|
961
|
+
? Promise.resolve(options).then((resolved) => authentication.runRequest(() => this.makeRequest(resolved, null, undefined), this))
|
|
962
|
+
: this.makeRequest(options, null, undefined);
|
|
963
|
+
const page = new Pagination.PagePromise(this, request, Page);
|
|
964
|
+
const guarded = this.responsePromise(request, async (client, props) => {
|
|
965
|
+
const body = await this.parseResponseWithTimeout(client, props);
|
|
966
|
+
return new Page(client, props.response, body, props.options);
|
|
967
|
+
});
|
|
968
|
+
page.then = guarded.then.bind(guarded);
|
|
969
|
+
page.catch = guarded.catch.bind(guarded);
|
|
970
|
+
page.finally = guarded.finally.bind(guarded);
|
|
971
|
+
page.withResponse = guarded.withResponse.bind(guarded);
|
|
972
|
+
page._thenUnwrap = guarded._thenUnwrap.bind(guarded);
|
|
973
|
+
return page;
|
|
473
974
|
}
|
|
474
975
|
async fetchWithAuth(url, init, timeout, controller, schemes = {
|
|
475
976
|
bearerAuth: true,
|
|
476
977
|
adminAPIKeyAuth: true,
|
|
477
978
|
}) {
|
|
478
|
-
if (this._workloadIdentityAuth && schemes.bearerAuth) {
|
|
979
|
+
if (this._workloadIdentityAuth && !tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Fetch, "f") && schemes.bearerAuth) {
|
|
479
980
|
const headers = init.headers;
|
|
480
981
|
const authHeader = headers.get('Authorization');
|
|
481
|
-
if (
|
|
982
|
+
if (authHeader === `Bearer ${WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER}`) {
|
|
482
983
|
const token = await this._workloadIdentityAuth.getToken();
|
|
483
984
|
headers.set('Authorization', `Bearer ${token}`);
|
|
484
985
|
}
|
|
485
986
|
}
|
|
486
|
-
const
|
|
987
|
+
const fetchWithTimeout = tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Fetch, "f") ? _a.prototype.fetchWithTimeout : this.fetchWithTimeout;
|
|
988
|
+
const response = await fetchWithTimeout.call(this, url, init, timeout, controller);
|
|
487
989
|
return response;
|
|
488
990
|
}
|
|
489
991
|
async fetchWithTimeout(url, init, ms, controller) {
|
|
490
992
|
const { signal, method, ...options } = init || {};
|
|
491
993
|
const abort = this._makeAbort(controller);
|
|
492
|
-
|
|
493
|
-
|
|
994
|
+
const composed = !!signal && composedCallerSignals.get(controller) === signal;
|
|
995
|
+
const cleanup = signal && !composed ? (0, abort_1.addRequestAbortListener)(signal, abort, controller.signal) : undefined;
|
|
494
996
|
const timeout = setTimeout(abort, ms);
|
|
495
997
|
const isReadableBody = (globalThis.ReadableStream && options.body instanceof globalThis.ReadableStream) ||
|
|
496
998
|
(typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body);
|
|
@@ -507,7 +1009,15 @@ class OpenAI {
|
|
|
507
1009
|
}
|
|
508
1010
|
try {
|
|
509
1011
|
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
|
|
510
|
-
|
|
1012
|
+
const response = await (tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Fetch, "f") ?? this.fetch).call(undefined, url, fetchOptions);
|
|
1013
|
+
if (cleanup) {
|
|
1014
|
+
(0, abort_1.retainRequestAbortCallback)(response.body ?? response, abort, controller.signal);
|
|
1015
|
+
}
|
|
1016
|
+
return response;
|
|
1017
|
+
}
|
|
1018
|
+
catch (err) {
|
|
1019
|
+
cleanup?.();
|
|
1020
|
+
throw err;
|
|
511
1021
|
}
|
|
512
1022
|
finally {
|
|
513
1023
|
clearTimeout(timeout);
|
|
@@ -535,7 +1045,7 @@ class OpenAI {
|
|
|
535
1045
|
return true;
|
|
536
1046
|
return false;
|
|
537
1047
|
}
|
|
538
|
-
async retryRequest(options, retriesRemaining, requestLogID, responseHeaders) {
|
|
1048
|
+
async retryRequest(options, retriesRemaining, requestLogID, responseHeaders, requestSignal = options.signal) {
|
|
539
1049
|
let timeoutMillis;
|
|
540
1050
|
// Note the `retry-after-ms` header may not be standard, but is a good idea and we'd like proactive support for it.
|
|
541
1051
|
const retryAfterMillisHeader = responseHeaders?.get('retry-after-ms');
|
|
@@ -547,7 +1057,7 @@ class OpenAI {
|
|
|
547
1057
|
}
|
|
548
1058
|
// About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
|
549
1059
|
const retryAfterHeader = responseHeaders?.get('retry-after');
|
|
550
|
-
if (retryAfterHeader &&
|
|
1060
|
+
if (retryAfterHeader && timeoutMillis === undefined) {
|
|
551
1061
|
const timeoutSeconds = parseFloat(retryAfterHeader);
|
|
552
1062
|
if (!Number.isNaN(timeoutSeconds)) {
|
|
553
1063
|
timeoutMillis = timeoutSeconds * 1000;
|
|
@@ -558,11 +1068,36 @@ class OpenAI {
|
|
|
558
1068
|
}
|
|
559
1069
|
// If the API asks us to wait a certain amount of time, just do what it
|
|
560
1070
|
// says, but otherwise calculate a default
|
|
561
|
-
if (timeoutMillis === undefined
|
|
1071
|
+
if (timeoutMillis === undefined ||
|
|
1072
|
+
!Number.isFinite(timeoutMillis) ||
|
|
1073
|
+
timeoutMillis < 0 ||
|
|
1074
|
+
timeoutMillis > 60 * 1000) {
|
|
562
1075
|
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
563
1076
|
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
|
|
564
1077
|
}
|
|
565
|
-
|
|
1078
|
+
const x509Authentication = tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f");
|
|
1079
|
+
if (x509Authentication) {
|
|
1080
|
+
const remaining = x509Authentication.remainingTimeout(options, x509Authentication.requestSnapshot().timeout);
|
|
1081
|
+
if (timeoutMillis >= remaining) {
|
|
1082
|
+
throw new Errors.APIConnectionTimeoutError();
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
if (x509Authentication) {
|
|
1086
|
+
await x509Authentication.waitForRetry(timeoutMillis, x509Authentication.effectiveSignal());
|
|
1087
|
+
}
|
|
1088
|
+
else {
|
|
1089
|
+
const retrySignals = requestSignal === options.signal ? [requestSignal] : [requestSignal, options.signal];
|
|
1090
|
+
try {
|
|
1091
|
+
await (0, sleep_1.sleep)(timeoutMillis, ...retrySignals);
|
|
1092
|
+
}
|
|
1093
|
+
catch (error) {
|
|
1094
|
+
const abortedSignal = retrySignals.find((signal) => signal?.aborted);
|
|
1095
|
+
if (abortedSignal) {
|
|
1096
|
+
throw this._makeUserAbortError(abortedSignal);
|
|
1097
|
+
}
|
|
1098
|
+
throw error;
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
566
1101
|
return this.makeRequest(options, retriesRemaining - 1, requestLogID);
|
|
567
1102
|
}
|
|
568
1103
|
calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries) {
|
|
@@ -575,21 +1110,75 @@ class OpenAI {
|
|
|
575
1110
|
const jitter = 1 - Math.random() * 0.25;
|
|
576
1111
|
return sleepSeconds * jitter * 1000;
|
|
577
1112
|
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Builds a request, resolving callback credentials when constructing authentication
|
|
1115
|
+
* headers, after any subclass request-option rewrites. Calling this method directly
|
|
1116
|
+
* also resolves credentials. Complete replacement builders own authentication and
|
|
1117
|
+
* can call `this.authHeaders()` to resolve headers with request-local credentials.
|
|
1118
|
+
*/
|
|
578
1119
|
async buildRequest(inputOptions, { retryCount = 0 } = {}) {
|
|
1120
|
+
if (tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f") && !tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f").inRequest(this)) {
|
|
1121
|
+
const authentication = tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f");
|
|
1122
|
+
return await authentication.runRequest(async () => {
|
|
1123
|
+
const built = await _a.prototype.buildRequest.call(this, inputOptions, { retryCount });
|
|
1124
|
+
authentication.releaseRequestBody(built.req.body);
|
|
1125
|
+
return built;
|
|
1126
|
+
}, this);
|
|
1127
|
+
}
|
|
579
1128
|
const options = { ...inputOptions };
|
|
1129
|
+
const x509Authentication = tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f");
|
|
1130
|
+
const x509Tenant = x509Authentication?.snapshotTenant(this.organization, this.project);
|
|
1131
|
+
const x509Headers = x509Authentication?.snapshotHeaders(this._options.defaultHeaders, options.headers);
|
|
1132
|
+
if (x509Headers) {
|
|
1133
|
+
options.headers = x509Headers.requestHeaders;
|
|
1134
|
+
}
|
|
1135
|
+
const x509ClientFetchOptions = x509Authentication
|
|
1136
|
+
? (0, x509_workload_identity_auth_1.snapshotX509RequestOptions)(this.fetchOptions)
|
|
1137
|
+
: undefined;
|
|
1138
|
+
const x509RequestFetchOptions = x509Authentication
|
|
1139
|
+
? (0, x509_workload_identity_auth_1.snapshotX509RequestOptions)(options.fetchOptions)
|
|
1140
|
+
: undefined;
|
|
580
1141
|
const { method, path, query, defaultBaseURL } = options;
|
|
581
1142
|
const url = this.buildURL(path, query, defaultBaseURL);
|
|
582
|
-
|
|
1143
|
+
x509Authentication?.snapshotAPIURL(url);
|
|
1144
|
+
const explicitTimeout = 'timeout' in options;
|
|
1145
|
+
if (explicitTimeout)
|
|
583
1146
|
(0, values_1.validatePositiveInteger)('timeout', options.timeout);
|
|
584
1147
|
options.timeout = options.timeout ?? this.timeout;
|
|
1148
|
+
if (x509Authentication && x509RequestFetchOptions) {
|
|
1149
|
+
x509Authentication.snapshotRequest(options.signal, options.timeout, x509RequestFetchOptions);
|
|
1150
|
+
}
|
|
1151
|
+
if (x509Authentication) {
|
|
1152
|
+
const snapshot = x509Authentication.requestSnapshot();
|
|
1153
|
+
options.timeout = snapshot.timeout;
|
|
1154
|
+
if (snapshot.signal === undefined) {
|
|
1155
|
+
delete options.signal;
|
|
1156
|
+
}
|
|
1157
|
+
else {
|
|
1158
|
+
options.signal = snapshot.signal;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
const authenticationHeaders = this._provider || x509Authentication
|
|
1162
|
+
? undefined
|
|
1163
|
+
: await this.authHeaders(inputOptions, inputOptions.__security ?? { bearerAuth: true });
|
|
585
1164
|
const { bodyHeaders, body, isStreamingBody } = this.buildBody({ options });
|
|
586
1165
|
if (isStreamingBody) {
|
|
587
1166
|
inputOptions.__metadata = {
|
|
588
1167
|
...inputOptions.__metadata,
|
|
589
1168
|
hasStreamingBody: true,
|
|
590
1169
|
};
|
|
1170
|
+
x509Authentication?.ownRequestBody(body, options.body);
|
|
591
1171
|
}
|
|
592
|
-
const reqHeaders = await this.buildHeaders({
|
|
1172
|
+
const reqHeaders = await this.buildHeaders({
|
|
1173
|
+
options: inputOptions,
|
|
1174
|
+
method,
|
|
1175
|
+
bodyHeaders,
|
|
1176
|
+
authenticationHeaders,
|
|
1177
|
+
retryCount,
|
|
1178
|
+
x509Headers,
|
|
1179
|
+
x509Timeout: explicitTimeout ? options.timeout : undefined,
|
|
1180
|
+
x509Tenant,
|
|
1181
|
+
});
|
|
593
1182
|
const req = {
|
|
594
1183
|
method,
|
|
595
1184
|
headers: reqHeaders,
|
|
@@ -597,35 +1186,43 @@ class OpenAI {
|
|
|
597
1186
|
...(globalThis.ReadableStream &&
|
|
598
1187
|
body instanceof globalThis.ReadableStream && { duplex: 'half' }),
|
|
599
1188
|
...(body && { body }),
|
|
600
|
-
...(this.fetchOptions ?? {}),
|
|
601
|
-
...(options.fetchOptions ?? {}),
|
|
1189
|
+
...((x509Authentication ? x509ClientFetchOptions : this.fetchOptions) ?? {}),
|
|
1190
|
+
...((x509Authentication ? x509RequestFetchOptions : options.fetchOptions) ?? {}),
|
|
602
1191
|
};
|
|
603
1192
|
return { req, url, timeout: options.timeout };
|
|
604
1193
|
}
|
|
605
|
-
async buildHeaders({ options, method, bodyHeaders, retryCount, }) {
|
|
1194
|
+
async buildHeaders({ options, method, bodyHeaders, authenticationHeaders, retryCount, x509Headers, x509Timeout, x509Tenant, }) {
|
|
606
1195
|
let idempotencyHeaders = {};
|
|
607
1196
|
if (this.idempotencyHeader && method !== 'get') {
|
|
608
1197
|
if (!options.idempotencyKey)
|
|
609
1198
|
options.idempotencyKey = this.defaultIdempotencyKey();
|
|
610
1199
|
idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
|
|
611
1200
|
}
|
|
1201
|
+
const helperMethod = options.__metadata?.['helperMethod'];
|
|
1202
|
+
const timeout = x509Headers ? x509Timeout : options.timeout;
|
|
612
1203
|
const headers = (0, headers_1.buildHeaders)([
|
|
613
1204
|
idempotencyHeaders,
|
|
614
1205
|
{
|
|
615
1206
|
Accept: 'application/json',
|
|
616
|
-
'User-Agent': this.getUserAgent(),
|
|
1207
|
+
...(!isRunningInBrowserOrBrowserWorker() ? { 'User-Agent': this.getUserAgent() } : undefined),
|
|
617
1208
|
'X-Stainless-Retry-Count': String(retryCount),
|
|
618
|
-
...(
|
|
1209
|
+
...(timeout ? { 'X-Stainless-Timeout': String(Math.trunc(timeout / 1000)) } : {}),
|
|
619
1210
|
...(0, detect_platform_1.getPlatformHeaders)(),
|
|
620
|
-
'
|
|
621
|
-
'OpenAI-
|
|
1211
|
+
...(typeof helperMethod === 'string' ? { 'X-Stainless-Helper-Method': helperMethod } : {}),
|
|
1212
|
+
'OpenAI-Organization': x509Tenant ? x509Tenant.organization : this.organization,
|
|
1213
|
+
'OpenAI-Project': x509Tenant ? x509Tenant.project : this.project,
|
|
622
1214
|
},
|
|
623
|
-
|
|
624
|
-
this.
|
|
1215
|
+
// X.509 owns streaming uploads before authentication so it can retire them on failure.
|
|
1216
|
+
tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f") && !tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f").isPlanningRequest()
|
|
1217
|
+
? await this.authHeaders(options, options.__security ?? { bearerAuth: true })
|
|
1218
|
+
: authenticationHeaders,
|
|
1219
|
+
x509Headers?.defaultHeaders ?? this._options.defaultHeaders,
|
|
625
1220
|
bodyHeaders,
|
|
626
|
-
options.headers,
|
|
1221
|
+
x509Headers?.requestHeaders ?? options.headers,
|
|
627
1222
|
]);
|
|
628
|
-
this.
|
|
1223
|
+
if (!this._provider && !tslib_1.__classPrivateFieldGet(this, _OpenAI_x509Authentication, "f")?.isPlanningRequest()) {
|
|
1224
|
+
this.validateHeaders(headers, options.__security ?? { bearerAuth: true });
|
|
1225
|
+
}
|
|
629
1226
|
return headers.values;
|
|
630
1227
|
}
|
|
631
1228
|
_makeAbort(controller) {
|
|
@@ -633,8 +1230,21 @@ class OpenAI {
|
|
|
633
1230
|
// would capture all request options, and cause a memory leak.
|
|
634
1231
|
return () => controller.abort();
|
|
635
1232
|
}
|
|
636
|
-
|
|
1233
|
+
_makeUserAbortError(signal) {
|
|
1234
|
+
const error = new Errors.APIUserAbortError();
|
|
1235
|
+
Object.defineProperty(error, 'cause', { value: signal.reason, writable: true, configurable: true });
|
|
1236
|
+
return error;
|
|
1237
|
+
}
|
|
1238
|
+
buildBody({ options }) {
|
|
1239
|
+
const { body, headers: rawHeaders } = options;
|
|
637
1240
|
if (!body) {
|
|
1241
|
+
// A resource method always passes a `body` key when its operation defines a
|
|
1242
|
+
// request body, even if the caller omitted an optional body param. Keep the
|
|
1243
|
+
// content-type for those, and only elide it for operations with no body at
|
|
1244
|
+
// all (e.g. GET/DELETE).
|
|
1245
|
+
if (body === undefined && 'body' in options) {
|
|
1246
|
+
return { ...tslib_1.__classPrivateFieldGet(this, _OpenAI_encoder, "f").call(this, { body, headers: (0, headers_1.buildHeaders)([rawHeaders]) }), isStreamingBody: false };
|
|
1247
|
+
}
|
|
638
1248
|
return { bodyHeaders: undefined, body: undefined, isStreamingBody: false };
|
|
639
1249
|
}
|
|
640
1250
|
const headers = (0, headers_1.buildHeaders)([rawHeaders]);
|
|
@@ -688,8 +1298,10 @@ class OpenAI {
|
|
|
688
1298
|
}
|
|
689
1299
|
}
|
|
690
1300
|
exports.OpenAI = OpenAI;
|
|
691
|
-
_a = OpenAI, _OpenAI_encoder = new WeakMap(), _OpenAI_instances = new WeakSet(), _OpenAI_baseURLOverridden = function _OpenAI_baseURLOverridden() {
|
|
692
|
-
return this
|
|
1301
|
+
_a = OpenAI, _OpenAI_encoder = new WeakMap(), _OpenAI_x509Authentication = new WeakMap(), _OpenAI_x509Credential = new WeakMap(), _OpenAI_x509Fetch = new WeakMap(), _OpenAI_explicitDataResidency = new WeakMap(), _OpenAI_responseAttempts = new WeakMap(), _OpenAI_instances = new WeakSet(), _OpenAI_baseURLOverridden = function _OpenAI_baseURLOverridden() {
|
|
1302
|
+
return (tslib_1.__classPrivateFieldGet(this, _OpenAI_explicitDataResidency, "f") ||
|
|
1303
|
+
this._provider !== undefined ||
|
|
1304
|
+
this.baseURL !== 'https://api.openai.com/v1');
|
|
693
1305
|
};
|
|
694
1306
|
OpenAI.OpenAI = _a;
|
|
695
1307
|
OpenAI.DEFAULT_TIMEOUT = 600000; // 10 minutes
|
|
@@ -708,29 +1320,63 @@ OpenAI.PermissionDeniedError = Errors.PermissionDeniedError;
|
|
|
708
1320
|
OpenAI.UnprocessableEntityError = Errors.UnprocessableEntityError;
|
|
709
1321
|
OpenAI.InvalidWebhookSignatureError = Errors.InvalidWebhookSignatureError;
|
|
710
1322
|
OpenAI.toFile = Uploads.toFile;
|
|
1323
|
+
OpenAI.toStreamingFile = Uploads.toStreamingFile;
|
|
711
1324
|
OpenAI.Completions = completions_1.Completions;
|
|
712
1325
|
OpenAI.Chat = chat_1.Chat;
|
|
713
1326
|
OpenAI.Embeddings = embeddings_1.Embeddings;
|
|
714
1327
|
OpenAI.Files = files_1.Files;
|
|
715
1328
|
OpenAI.Images = images_1.Images;
|
|
1329
|
+
OpenAI.ContentProvenanceChecks = content_provenance_checks_1.ContentProvenanceChecks;
|
|
716
1330
|
OpenAI.Audio = audio_1.Audio;
|
|
717
1331
|
OpenAI.Moderations = moderations_1.Moderations;
|
|
718
1332
|
OpenAI.Models = models_1.Models;
|
|
719
1333
|
OpenAI.FineTuning = fine_tuning_1.FineTuning;
|
|
720
1334
|
OpenAI.Graders = graders_1.Graders;
|
|
721
1335
|
OpenAI.VectorStores = vector_stores_1.VectorStores;
|
|
1336
|
+
OpenAI.Safety = safety_1.Safety;
|
|
722
1337
|
OpenAI.Webhooks = webhooks_1.Webhooks;
|
|
723
1338
|
OpenAI.Beta = beta_1.Beta;
|
|
724
1339
|
OpenAI.Batches = batches_1.Batches;
|
|
725
1340
|
OpenAI.Uploads = uploads_1.Uploads;
|
|
726
1341
|
OpenAI.Admin = admin_1.Admin;
|
|
727
1342
|
OpenAI.Responses = responses_1.Responses;
|
|
1343
|
+
OpenAI.Live = live_1.Live;
|
|
728
1344
|
OpenAI.Realtime = realtime_1.Realtime;
|
|
729
1345
|
OpenAI.Conversations = conversations_1.Conversations;
|
|
730
1346
|
OpenAI.Evals = evals_1.Evals;
|
|
731
1347
|
OpenAI.Containers = containers_1.Containers;
|
|
732
1348
|
OpenAI.Skills = skills_1.Skills;
|
|
733
1349
|
OpenAI.Videos = videos_1.Videos;
|
|
1350
|
+
OpenAI.ConversationCursorPage = Pagination.ConversationCursorPage;
|
|
1351
|
+
OpenAI.CursorPage = Pagination.CursorPage;
|
|
1352
|
+
OpenAI.NextCursorPage = Pagination.NextCursorPage;
|
|
1353
|
+
OpenAI.Page = Pagination.Page;
|
|
1354
|
+
OpenAI.TokenPage = Pagination.TokenPage;
|
|
1355
|
+
const composedCallerSignals = new WeakMap();
|
|
1356
|
+
function createRequestController(callerSignal, originalSignal) {
|
|
1357
|
+
const controller = new AbortController();
|
|
1358
|
+
if (!callerSignal)
|
|
1359
|
+
return controller;
|
|
1360
|
+
const nativeAbortSignal = globalThis.AbortSignal;
|
|
1361
|
+
if (typeof nativeAbortSignal?.any !== 'function' || !(callerSignal instanceof nativeAbortSignal)) {
|
|
1362
|
+
return controller;
|
|
1363
|
+
}
|
|
1364
|
+
try {
|
|
1365
|
+
// Native composition keeps cancellation active after response headers without
|
|
1366
|
+
// retaining an abort listener on the caller's signal or changing its reason.
|
|
1367
|
+
const signals = [controller.signal, callerSignal];
|
|
1368
|
+
if (originalSignal && originalSignal !== callerSignal) {
|
|
1369
|
+
signals.push(originalSignal);
|
|
1370
|
+
}
|
|
1371
|
+
const composed = nativeAbortSignal.any(signals);
|
|
1372
|
+
Object.defineProperty(controller, 'signal', { value: composed, configurable: true });
|
|
1373
|
+
composedCallerSignals.set(controller, callerSignal);
|
|
1374
|
+
}
|
|
1375
|
+
catch {
|
|
1376
|
+
// Older or incompatible runtimes retain the existing listener-based fallback.
|
|
1377
|
+
}
|
|
1378
|
+
return controller;
|
|
1379
|
+
}
|
|
734
1380
|
function getConnectionErrorMessage(error) {
|
|
735
1381
|
if (isUndiciDispatcherVersionMismatchError(error)) {
|
|
736
1382
|
return `Connection error. This may be caused by passing an undici dispatcher, such as ProxyAgent, that is incompatible with the fetch implementation. If you are using undici's ProxyAgent, pass the fetch implementation from the same undici package: import { fetch, ProxyAgent } from 'undici'; new OpenAI({ fetch, fetchOptions: { dispatcher: new ProxyAgent(...) } });`;
|