(client, request3, options)
| 44996 | var components = __importStar(require_components()); |
| 44997 | var errors = __importStar(require_errors2()); |
| 44998 | async function embeddingsCreate(client, request3, options) { |
| 44999 | const parsed = (0, schemas_js_1.safeParse)(request3, (value) => components.EmbeddingRequest$outboundSchema.parse(value), "Input validation failed"); |
| 45000 | if (!parsed.ok) { |
| 45001 | return parsed; |
| 45002 | } |
| 45003 | const payload = parsed.value; |
| 45004 | const body = (0, encodings_js_1.encodeJSON)("body", payload, { explode: true }); |
| 45005 | const path5 = (0, url_js_1.pathToFunc)("/v1/embeddings")(); |
| 45006 | const headers = new Headers({ |
| 45007 | "Content-Type": "application/json", |
| 45008 | Accept: "application/json" |
| 45009 | }); |
| 45010 | const secConfig = await (0, security_js_1.extractSecurity)(client._options.apiKey); |
| 45011 | const securityInput = secConfig == null ? {} : { apiKey: secConfig }; |
| 45012 | const requestSecurity = (0, security_js_1.resolveGlobalSecurity)(securityInput); |
| 45013 | const context = { |
| 45014 | operationID: "embeddings_v1_embeddings_post", |
| 45015 | oAuth2Scopes: [], |
| 45016 | resolvedSecurity: requestSecurity, |
| 45017 | securitySource: client._options.apiKey, |
| 45018 | retryConfig: (options === null || options === void 0 ? void 0 : options.retries) || client._options.retryConfig || { strategy: "none" }, |
| 45019 | retryCodes: (options === null || options === void 0 ? void 0 : options.retryCodes) || ["429", "500", "502", "503", "504"] |
| 45020 | }; |
| 45021 | const requestRes = client._createRequest(context, { |
| 45022 | security: requestSecurity, |
| 45023 | method: "POST", |
| 45024 | path: path5, |
| 45025 | headers, |
| 45026 | body, |
| 45027 | timeoutMs: (options === null || options === void 0 ? void 0 : options.timeoutMs) || client._options.timeoutMs || -1 |
| 45028 | }, options); |
| 45029 | if (!requestRes.ok) { |
| 45030 | return requestRes; |
| 45031 | } |
| 45032 | const req = requestRes.value; |
| 45033 | const doResult = await client._do(req, { |
| 45034 | context, |
| 45035 | errorCodes: ["422", "4XX", "5XX"], |
| 45036 | retryConfig: context.retryConfig, |
| 45037 | retryCodes: context.retryCodes |
| 45038 | }); |
| 45039 | if (!doResult.ok) { |
| 45040 | return doResult; |
| 45041 | } |
| 45042 | const response = doResult.value; |
| 45043 | const responseFields = { |
| 45044 | HttpMeta: { Response: response, Request: req } |
| 45045 | }; |
| 45046 | const [result] = await M5.match(M5.json(200, components.EmbeddingResponse$inboundSchema), M5.jsonErr(422, errors.HTTPValidationError$inboundSchema), M5.fail(["4XX", "5XX"]))(response, { extraFields: responseFields }); |
| 45047 | if (!result.ok) { |
| 45048 | return result; |
| 45049 | } |
| 45050 | return result; |
| 45051 | } |
| 45052 | } |
| 45053 | }); |
| 45054 |
nothing calls this directly
no test coverage detected
searching dependent graphs…