From 794c51397f30590ed9d0ec322566ade1f0b20181 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:28:57 +0100 Subject: [PATCH] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.438.1 (#45) Co-authored-by: speakeasybot --- .speakeasy/workflow.lock | 14 +++---- packages/mistralai-gcp/.speakeasy/gen.lock | 10 ++--- packages/mistralai-gcp/.speakeasy/gen.yaml | 3 +- packages/mistralai-gcp/RELEASES.md | 12 +++++- packages/mistralai-gcp/jsr.json | 2 +- packages/mistralai-gcp/package-lock.json | 4 +- packages/mistralai-gcp/package.json | 2 +- .../mistralai-gcp/src/funcs/chatComplete.ts | 3 ++ .../mistralai-gcp/src/funcs/chatStream.ts | 3 ++ .../mistralai-gcp/src/funcs/fimComplete.ts | 3 ++ packages/mistralai-gcp/src/funcs/fimStream.ts | 3 ++ packages/mistralai-gcp/src/hooks/types.ts | 2 + packages/mistralai-gcp/src/lib/config.ts | 6 +-- packages/mistralai-gcp/src/lib/primitives.ts | 20 +++++++++ packages/mistralai-gcp/src/lib/security.ts | 42 +++++++++++++++++-- .../components/chatcompletionrequest.ts | 12 +++--- .../components/chatcompletionstreamrequest.ts | 12 +++--- 17 files changed, 117 insertions(+), 36 deletions(-) diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index f8424c9..2846d79 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -8,9 +8,9 @@ sources: - latest - main mistral-google-cloud-source: - sourceNamespace: mistral-openapi-google-cloud - sourceRevisionDigest: sha256:b2ce8e0e63674ea7ccfa3a75ff231bb97a39748331bcc0a3629f29c158f5b31e - sourceBlobDigest: sha256:a895adbf903776492b28daa3dd8c624f509decbbfe9ca6cda6510a33226604be + sourceNamespace: mistral-google-cloud-source + sourceRevisionDigest: sha256:22da209c58cb1591b3fde77467a9affce33c874724b220dd68f11a8f5fe92fbe + sourceBlobDigest: sha256:79c11900db52030ed8d8fff8066f9fe716670f4eadca41936f2cbc1a270fb087 tags: - latest - main @@ -31,11 +31,11 @@ targets: codeSamplesRevisionDigest: sha256:859080f8bc0f025db686fb068bea2903ab97b15e55d3c88ad484fe27671b7a1d mistralai-gcp-sdk: source: mistral-google-cloud-source - sourceNamespace: mistral-openapi-google-cloud - sourceRevisionDigest: sha256:b2ce8e0e63674ea7ccfa3a75ff231bb97a39748331bcc0a3629f29c158f5b31e - sourceBlobDigest: sha256:a895adbf903776492b28daa3dd8c624f509decbbfe9ca6cda6510a33226604be + sourceNamespace: mistral-google-cloud-source + sourceRevisionDigest: sha256:22da209c58cb1591b3fde77467a9affce33c874724b220dd68f11a8f5fe92fbe + sourceBlobDigest: sha256:79c11900db52030ed8d8fff8066f9fe716670f4eadca41936f2cbc1a270fb087 codeSamplesNamespace: mistral-openapi-google-cloud-code-samples - codeSamplesRevisionDigest: sha256:5126fed27553befa9735d0e0c2abdc089d6f6a22efe89475df630e375b496241 + codeSamplesRevisionDigest: sha256:388930534caf7f0c463410313e251ecbbe548002fe9c03fdf0138e738ba4e0e0 mistralai-sdk: source: mistral-openapi sourceNamespace: mistral-openapi diff --git a/packages/mistralai-gcp/.speakeasy/gen.lock b/packages/mistralai-gcp/.speakeasy/gen.lock index 6fd4fef..4ad611f 100644 --- a/packages/mistralai-gcp/.speakeasy/gen.lock +++ b/packages/mistralai-gcp/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: c6044247-eaf9-46da-b078-0e1334e93be2 management: - docChecksum: 46baf8da7636ea1bf44557571d011045 + docChecksum: a4b0284a2171be4279ac869462fc2ba5 docVersion: 0.0.2 - speakeasyVersion: 1.434.7 - generationVersion: 2.452.0 - releaseVersion: 1.3.0 - configChecksum: 3b3800ab2f8b198bdbd47807fbe76770 + speakeasyVersion: 1.438.1 + generationVersion: 2.457.2 + releaseVersion: 1.3.1 + configChecksum: 0e5490b5f6a45163ed1ce89547eb8e70 repoURL: https://github.com/mistralai/client-ts.git repoSubDirectory: packages/mistralai-gcp installationURL: https://gitpkg.now.sh/mistralai/client-ts/packages/mistralai-gcp diff --git a/packages/mistralai-gcp/.speakeasy/gen.yaml b/packages/mistralai-gcp/.speakeasy/gen.yaml index 81014db..f05512d 100644 --- a/packages/mistralai-gcp/.speakeasy/gen.yaml +++ b/packages/mistralai-gcp/.speakeasy/gen.yaml @@ -13,7 +13,7 @@ generation: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false typescript: - version: 1.3.0 + version: 1.3.1 additionalDependencies: dependencies: google-auth-library: ^9.11.0 @@ -22,6 +22,7 @@ typescript: additionalPackageJSON: {} author: Speakeasy clientServerStatusCodesAsErrors: true + defaultErrorName: SDKError enumFormat: union flattenGlobalSecurity: true flatteningOrder: body-first diff --git a/packages/mistralai-gcp/RELEASES.md b/packages/mistralai-gcp/RELEASES.md index 4141196..c77b828 100644 --- a/packages/mistralai-gcp/RELEASES.md +++ b/packages/mistralai-gcp/RELEASES.md @@ -58,4 +58,14 @@ Based on: ### Generated - [typescript v1.3.0] packages/mistralai-gcp ### Releases -- [NPM v1.3.0] https://www.npmjs.com/package/@mistralai/mistralai-gcp/v/1.3.0 - packages/mistralai-gcp \ No newline at end of file +- [NPM v1.3.0] https://www.npmjs.com/package/@mistralai/mistralai-gcp/v/1.3.0 - packages/mistralai-gcp + +## 2024-11-12 18:04:59 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.438.1 (2.457.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v1.3.1] packages/mistralai-gcp +### Releases +- [NPM v1.3.1] https://www.npmjs.com/package/@mistralai/mistralai-gcp/v/1.3.1 - packages/mistralai-gcp \ No newline at end of file diff --git a/packages/mistralai-gcp/jsr.json b/packages/mistralai-gcp/jsr.json index fb73caf..58f5545 100644 --- a/packages/mistralai-gcp/jsr.json +++ b/packages/mistralai-gcp/jsr.json @@ -2,7 +2,7 @@ { "name": "@mistralai/mistralai-gcp", - "version": "1.3.0", + "version": "1.3.1", "exports": { ".": "./src/index.ts", "./models/errors": "./src/models/errors/index.ts", diff --git a/packages/mistralai-gcp/package-lock.json b/packages/mistralai-gcp/package-lock.json index c983f61..3d21b8e 100644 --- a/packages/mistralai-gcp/package-lock.json +++ b/packages/mistralai-gcp/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mistralai/mistralai-gcp", - "version": "1.3.0", + "version": "1.3.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mistralai/mistralai-gcp", - "version": "1.3.0", + "version": "1.3.1", "dependencies": { "google-auth-library": "^9.11.0" }, diff --git a/packages/mistralai-gcp/package.json b/packages/mistralai-gcp/package.json index 846e4b4..791304e 100644 --- a/packages/mistralai-gcp/package.json +++ b/packages/mistralai-gcp/package.json @@ -1,6 +1,6 @@ { "name": "@mistralai/mistralai-gcp", - "version": "1.3.0", + "version": "1.3.1", "author": "Speakeasy", "main": "./index.js", "sideEffects": false, diff --git a/packages/mistralai-gcp/src/funcs/chatComplete.ts b/packages/mistralai-gcp/src/funcs/chatComplete.ts index 14fbc4c..8a58599 100644 --- a/packages/mistralai-gcp/src/funcs/chatComplete.ts +++ b/packages/mistralai-gcp/src/funcs/chatComplete.ts @@ -67,6 +67,9 @@ export async function chatComplete( const context = { operationID: "chat_completion_v1_chat_completions_post", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKey, retryConfig: options?.retries || client._options.retryConfig diff --git a/packages/mistralai-gcp/src/funcs/chatStream.ts b/packages/mistralai-gcp/src/funcs/chatStream.ts index 9bed6da..5b8aa81 100644 --- a/packages/mistralai-gcp/src/funcs/chatStream.ts +++ b/packages/mistralai-gcp/src/funcs/chatStream.ts @@ -73,6 +73,9 @@ export async function chatStream( const context = { operationID: "stream_chat", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKey, retryConfig: options?.retries || client._options.retryConfig diff --git a/packages/mistralai-gcp/src/funcs/fimComplete.ts b/packages/mistralai-gcp/src/funcs/fimComplete.ts index c6b0b01..95da4f0 100644 --- a/packages/mistralai-gcp/src/funcs/fimComplete.ts +++ b/packages/mistralai-gcp/src/funcs/fimComplete.ts @@ -70,6 +70,9 @@ export async function fimComplete( const context = { operationID: "fim_completion_v1_fim_completions_post", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKey, retryConfig: options?.retries || client._options.retryConfig diff --git a/packages/mistralai-gcp/src/funcs/fimStream.ts b/packages/mistralai-gcp/src/funcs/fimStream.ts index 3de7685..6b79683 100644 --- a/packages/mistralai-gcp/src/funcs/fimStream.ts +++ b/packages/mistralai-gcp/src/funcs/fimStream.ts @@ -73,6 +73,9 @@ export async function fimStream( const context = { operationID: "stream_fim", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKey, retryConfig: options?.retries || client._options.retryConfig diff --git a/packages/mistralai-gcp/src/hooks/types.ts b/packages/mistralai-gcp/src/hooks/types.ts index 4079cc9..df5237d 100644 --- a/packages/mistralai-gcp/src/hooks/types.ts +++ b/packages/mistralai-gcp/src/hooks/types.ts @@ -4,12 +4,14 @@ import { HTTPClient, RequestInput } from "../lib/http.js"; import { RetryConfig } from "../lib/retries.js"; +import { SecurityState } from "../lib/security.js"; export type HookContext = { operationID: string; oAuth2Scopes?: string[]; securitySource?: any | (() => Promise); retryConfig: RetryConfig; + resolvedSecurity: SecurityState | null; }; export type Awaitable = T | Promise; diff --git a/packages/mistralai-gcp/src/lib/config.ts b/packages/mistralai-gcp/src/lib/config.ts index 488cd6a..4ab3b67 100644 --- a/packages/mistralai-gcp/src/lib/config.ts +++ b/packages/mistralai-gcp/src/lib/config.ts @@ -55,8 +55,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "0.0.2", - sdkVersion: "1.3.0", - genVersion: "2.452.0", + sdkVersion: "1.3.1", + genVersion: "2.457.2", userAgent: - "speakeasy-sdk/typescript 1.3.0 2.452.0 0.0.2 @mistralai/mistralai-gcp", + "speakeasy-sdk/typescript 1.3.1 2.457.2 0.0.2 @mistralai/mistralai-gcp", } as const; diff --git a/packages/mistralai-gcp/src/lib/primitives.ts b/packages/mistralai-gcp/src/lib/primitives.ts index 23794a2..48b2867 100644 --- a/packages/mistralai-gcp/src/lib/primitives.ts +++ b/packages/mistralai-gcp/src/lib/primitives.ts @@ -2,6 +2,26 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ +class InvariantError extends Error { + constructor(message: string) { + super(message); + this.name = "InvariantError"; + } +} + +export function invariant( + condition: unknown, + message: string, +): asserts condition { + if (!condition) { + throw new InvariantError(message); + } +} + +export type ExactPartial = { + [P in keyof T]?: T[P] | undefined; +}; + export type Remap = { [k in keyof Inp as Mapping[k] extends string /* if we have a string mapping for this key then use it */ ? Mapping[k] diff --git a/packages/mistralai-gcp/src/lib/security.ts b/packages/mistralai-gcp/src/lib/security.ts index a80808f..a2054cd 100644 --- a/packages/mistralai-gcp/src/lib/security.ts +++ b/packages/mistralai-gcp/src/lib/security.ts @@ -4,6 +4,14 @@ import * as components from "../models/components/index.js"; +type OAuth2PasswordFlow = { + username: string; + password?: string | undefined; + clientID: string; + clientSecret?: string | undefined; + tokenURL: string; +}; + export enum SecurityErrorCode { Incomplete = "incomplete", UnrecognisedSecurityType = "unrecognized_security_type", @@ -37,6 +45,7 @@ export type SecurityState = { headers: Record; queryParams: Record; cookies: Record; + oauth2: ({ type: "password" } & OAuth2PasswordFlow) | { type: "none" }; }; type SecurityInputBasic = { @@ -73,7 +82,18 @@ type SecurityInputOAuth2 = { type SecurityInputOAuth2ClientCredentials = { type: "oauth2:client_credentials"; - value: string | null | undefined; + value: + | { clientID?: string | undefined; clientSecret?: string | undefined } + | null + | undefined; +}; + +type SecurityInputOAuth2PasswordCredentials = { + type: "oauth2:password"; + value: + | string + | null + | undefined; fieldName: string; }; @@ -89,6 +109,7 @@ export type SecurityInput = | SecurityInputAPIKey | SecurityInputOAuth2 | SecurityInputOAuth2ClientCredentials + | SecurityInputOAuth2PasswordCredentials | SecurityInputOIDC | SecurityInputCustom; @@ -100,6 +121,7 @@ export function resolveSecurity( headers: {}, queryParams: {}, cookies: {}, + oauth2: { type: "none" }, }; const option = options.find((opts) => { @@ -110,6 +132,12 @@ export function resolveSecurity( return o.value.username != null || o.value.password != null; } else if (o.type === "http:custom") { return null; + } else if (o.type === "oauth2:password") { + return ( + typeof o.value === "string" && !!o.value + ); + } else if (o.type === "oauth2:client_credentials") { + return o.value.clientID != null || o.value.clientSecret != null; } else if (typeof o.value === "string") { return !!o.value; } else { @@ -152,6 +180,9 @@ export function resolveSecurity( case "oauth2": applyBearer(state, spec); break; + case "oauth2:password": + applyBearer(state, spec); + break; case "oauth2:client_credentials": break; case "openIdConnect": @@ -179,9 +210,13 @@ function applyBasic( function applyBearer( state: SecurityState, - spec: SecurityInputBearer | SecurityInputOAuth2 | SecurityInputOIDC, + spec: + | SecurityInputBearer + | SecurityInputOAuth2 + | SecurityInputOIDC + | SecurityInputOAuth2PasswordCredentials, ) { - if (spec.value == null) { + if (typeof spec.value !== "string" || !spec.value) { return; } @@ -192,6 +227,7 @@ function applyBearer( state.headers[spec.fieldName] = value; } + export function resolveGlobalSecurity( security: Partial | null | undefined, ): SecurityState | null { diff --git a/packages/mistralai-gcp/src/models/components/chatcompletionrequest.ts b/packages/mistralai-gcp/src/models/components/chatcompletionrequest.ts index 4c2ba99..3ba9d3a 100644 --- a/packages/mistralai-gcp/src/models/components/chatcompletionrequest.ts +++ b/packages/mistralai-gcp/src/models/components/chatcompletionrequest.ts @@ -291,8 +291,8 @@ export const ChatCompletionRequest$inboundSchema: z.ZodType< tools: z.nullable(z.array(Tool$inboundSchema)).optional(), tool_choice: z.union([ToolChoice$inboundSchema, ToolChoiceEnum$inboundSchema]) .optional(), - presence_penalty: z.number().default(0), - frequency_penalty: z.number().default(0), + presence_penalty: z.number().optional(), + frequency_penalty: z.number().optional(), n: z.nullable(z.number().int()).optional(), }).transform((v) => { return remap$(v, { @@ -324,8 +324,8 @@ export type ChatCompletionRequest$Outbound = { response_format?: ResponseFormat$Outbound | undefined; tools?: Array | null | undefined; tool_choice?: ToolChoice$Outbound | string | undefined; - presence_penalty: number; - frequency_penalty: number; + presence_penalty?: number | undefined; + frequency_penalty?: number | undefined; n?: number | null | undefined; }; @@ -372,8 +372,8 @@ export const ChatCompletionRequest$outboundSchema: z.ZodType< ToolChoice$outboundSchema, ToolChoiceEnum$outboundSchema, ]).optional(), - presencePenalty: z.number().default(0), - frequencyPenalty: z.number().default(0), + presencePenalty: z.number().optional(), + frequencyPenalty: z.number().optional(), n: z.nullable(z.number().int()).optional(), }).transform((v) => { return remap$(v, { diff --git a/packages/mistralai-gcp/src/models/components/chatcompletionstreamrequest.ts b/packages/mistralai-gcp/src/models/components/chatcompletionstreamrequest.ts index dbba7fa..9be51e1 100644 --- a/packages/mistralai-gcp/src/models/components/chatcompletionstreamrequest.ts +++ b/packages/mistralai-gcp/src/models/components/chatcompletionstreamrequest.ts @@ -284,8 +284,8 @@ export const ChatCompletionStreamRequest$inboundSchema: z.ZodType< tools: z.nullable(z.array(Tool$inboundSchema)).optional(), tool_choice: z.union([ToolChoice$inboundSchema, ToolChoiceEnum$inboundSchema]) .optional(), - presence_penalty: z.number().default(0), - frequency_penalty: z.number().default(0), + presence_penalty: z.number().optional(), + frequency_penalty: z.number().optional(), n: z.nullable(z.number().int()).optional(), }).transform((v) => { return remap$(v, { @@ -317,8 +317,8 @@ export type ChatCompletionStreamRequest$Outbound = { response_format?: ResponseFormat$Outbound | undefined; tools?: Array | null | undefined; tool_choice?: ToolChoice$Outbound | string | undefined; - presence_penalty: number; - frequency_penalty: number; + presence_penalty?: number | undefined; + frequency_penalty?: number | undefined; n?: number | null | undefined; }; @@ -365,8 +365,8 @@ export const ChatCompletionStreamRequest$outboundSchema: z.ZodType< ToolChoice$outboundSchema, ToolChoiceEnum$outboundSchema, ]).optional(), - presencePenalty: z.number().default(0), - frequencyPenalty: z.number().default(0), + presencePenalty: z.number().optional(), + frequencyPenalty: z.number().optional(), n: z.nullable(z.number().int()).optional(), }).transform((v) => { return remap$(v, {