(client, request3, options)
| 42353 | var components = __importStar(require_components()); |
| 42354 | var errors = __importStar(require_errors2()); |
| 42355 | async function agentsComplete(client, request3, options) { |
| 42356 | const parsed = (0, schemas_js_1.safeParse)(request3, (value) => components.AgentsCompletionRequest$outboundSchema.parse(value), "Input validation failed"); |
| 42357 | if (!parsed.ok) { |
| 42358 | return parsed; |
| 42359 | } |
| 42360 | const payload = parsed.value; |
| 42361 | const body = (0, encodings_js_1.encodeJSON)("body", payload, { explode: true }); |
| 42362 | const path5 = (0, url_js_1.pathToFunc)("/v1/agents/completions")(); |
| 42363 | const headers = new Headers({ |
| 42364 | "Content-Type": "application/json", |
| 42365 | Accept: "application/json" |
| 42366 | }); |
| 42367 | const secConfig = await (0, security_js_1.extractSecurity)(client._options.apiKey); |
| 42368 | const securityInput = secConfig == null ? {} : { apiKey: secConfig }; |
| 42369 | const requestSecurity = (0, security_js_1.resolveGlobalSecurity)(securityInput); |
| 42370 | const context = { |
| 42371 | operationID: "agents_completion_v1_agents_completions_post", |
| 42372 | oAuth2Scopes: [], |
| 42373 | resolvedSecurity: requestSecurity, |
| 42374 | securitySource: client._options.apiKey, |
| 42375 | retryConfig: (options === null || options === void 0 ? void 0 : options.retries) || client._options.retryConfig || { strategy: "none" }, |
| 42376 | retryCodes: (options === null || options === void 0 ? void 0 : options.retryCodes) || ["429", "500", "502", "503", "504"] |
| 42377 | }; |
| 42378 | const requestRes = client._createRequest(context, { |
| 42379 | security: requestSecurity, |
| 42380 | method: "POST", |
| 42381 | path: path5, |
| 42382 | headers, |
| 42383 | body, |
| 42384 | timeoutMs: (options === null || options === void 0 ? void 0 : options.timeoutMs) || client._options.timeoutMs || -1 |
| 42385 | }, options); |
| 42386 | if (!requestRes.ok) { |
| 42387 | return requestRes; |
| 42388 | } |
| 42389 | const req = requestRes.value; |
| 42390 | const doResult = await client._do(req, { |
| 42391 | context, |
| 42392 | errorCodes: ["422", "4XX", "5XX"], |
| 42393 | retryConfig: context.retryConfig, |
| 42394 | retryCodes: context.retryCodes |
| 42395 | }); |
| 42396 | if (!doResult.ok) { |
| 42397 | return doResult; |
| 42398 | } |
| 42399 | const response = doResult.value; |
| 42400 | const responseFields = { |
| 42401 | HttpMeta: { Response: response, Request: req } |
| 42402 | }; |
| 42403 | const [result] = await M5.match(M5.json(200, components.ChatCompletionResponse$inboundSchema), M5.jsonErr(422, errors.HTTPValidationError$inboundSchema), M5.fail(["4XX", "5XX"]))(response, { extraFields: responseFields }); |
| 42404 | if (!result.ok) { |
| 42405 | return result; |
| 42406 | } |
| 42407 | return result; |
| 42408 | } |
| 42409 | } |
| 42410 | }); |
| 42411 |
nothing calls this directly
no test coverage detected
searching dependent graphs…