Skip to content

Commit

Permalink
Merge pull request #62 from mistralai/speakeasy-sdk-regen-1733304480
Browse files Browse the repository at this point in the history
chore: 🐝 Update SDK - Generate MISTRALAI-AZURE-SDK 1.3.5
  • Loading branch information
aac228 authored Dec 4, 2024
2 parents e6900ad + 2eb2026 commit da73a50
Show file tree
Hide file tree
Showing 39 changed files with 860 additions and 39 deletions.
12 changes: 6 additions & 6 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ speakeasyVersion: 1.451.1
sources:
mistral-azure-source:
sourceNamespace: mistral-azure-source
sourceRevisionDigest: sha256:c441f2d21e7879f5fb9d8d99e2ae242d1e5a84c0c06db971911eb578173e7f62
sourceBlobDigest: sha256:de4af0f100f15fef89e093a6b5393302b2218fb154230594ec811aacdd4f2ec7
sourceRevisionDigest: sha256:9c35eed0174f2d8165807bcd7c8e7b7111fa97c059a77ae7eeaa352ca7e83b4d
sourceBlobDigest: sha256:07283bfde08363f9f69b133888b482472c4bf12d2e5b59cb33c8993c517278e3
tags:
- latest
- main
- speakeasy-sdk-regen-1733304480
mistral-google-cloud-source:
sourceNamespace: mistral-google-cloud-source
sourceRevisionDigest: sha256:e0fd58ce2dbba068f375d3a23d758b8678c2a68cf4fc7bc46ea7e1b37abe0647
Expand All @@ -25,10 +25,10 @@ targets:
mistralai-azure-sdk:
source: mistral-azure-source
sourceNamespace: mistral-azure-source
sourceRevisionDigest: sha256:c441f2d21e7879f5fb9d8d99e2ae242d1e5a84c0c06db971911eb578173e7f62
sourceBlobDigest: sha256:de4af0f100f15fef89e093a6b5393302b2218fb154230594ec811aacdd4f2ec7
sourceRevisionDigest: sha256:9c35eed0174f2d8165807bcd7c8e7b7111fa97c059a77ae7eeaa352ca7e83b4d
sourceBlobDigest: sha256:07283bfde08363f9f69b133888b482472c4bf12d2e5b59cb33c8993c517278e3
codeSamplesNamespace: mistral-openapi-azure-code-samples
codeSamplesRevisionDigest: sha256:e986a6f674fde2807db8383cdfefc9229cc4df98276918d60a5f4189ce07fb98
codeSamplesRevisionDigest: sha256:1918c360fdb31c721fbc4e47a1b54530ba8deb526e638c9e61f039027343696f
mistralai-gcp-sdk:
source: mistral-google-cloud-source
sourceNamespace: mistral-google-cloud-source
Expand Down
14 changes: 7 additions & 7 deletions packages/mistralai-azure/.speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
lockVersion: 2.0.0
id: 01e8a40b-3df3-4d9a-9501-2eb9e0d26c05
management:
docChecksum: d0000cbe03848bfe843794965cba332f
docChecksum: 26271aa279a7a7182f7af19df8b67038
docVersion: 0.0.2
speakeasyVersion: 1.438.1
generationVersion: 2.457.2
releaseVersion: 1.3.4
configChecksum: c701bbf71f3977510ce625c672b31284
speakeasyVersion: 1.451.1
generationVersion: 2.470.1
releaseVersion: 1.3.5
configChecksum: e32b498a394ce6079f7bced9cced33b5
repoURL: https://github.com/mistralai/client-ts.git
repoSubDirectory: packages/mistralai-azure
installationURL: https://gitpkg.now.sh/mistralai/client-ts/packages/mistralai-azure
Expand All @@ -15,7 +15,7 @@ features:
typescript:
additionalDependencies: 0.1.0
constsAndDefaults: 0.1.11
core: 3.18.3
core: 3.18.8
defaultEnabledRetries: 0.1.0
enumUnions: 0.1.0
envVarSecurityUsage: 0.1.2
Expand All @@ -33,7 +33,6 @@ features:
serverEvents: 0.1.5
serverEventsSentinels: 0.1.0
serverIDs: 2.81.2
tests: 0.7.0
unions: 2.85.8
generatedFiles:
- .eslintrc.cjs
Expand Down Expand Up @@ -176,3 +175,4 @@ examples:
"200":
application/json: {"id": "cmpl-e5cc70bb28c444948073e77776eb30ef", "object": "chat.completion", "model": "mistral-small-latest", "usage": {"prompt_tokens": 16, "completion_tokens": 34, "total_tokens": 50}, "created": 1702256327, "choices": [{"index": 0, "finish_reason": "stop"}, {"index": 0, "finish_reason": "stop"}, {"index": 0, "finish_reason": "stop"}]}
"422": {}
generatedTests: {}
1 change: 1 addition & 0 deletions packages/mistralai-azure/.speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ typescript:
author: Speakeasy
clientServerStatusCodesAsErrors: true
defaultErrorName: SDKError
enableReactQuery: false
enumFormat: union
envVarPrefix: MISTRAL
flattenGlobalSecurity: true
Expand Down
12 changes: 11 additions & 1 deletion packages/mistralai-azure/RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,14 @@ Based on:
### Generated
- [typescript v1.3.4] packages/mistralai-azure
### Releases
- [NPM v1.3.4] https://www.npmjs.com/package/@mistralai/mistralai-azure/v/1.3.4 - packages/mistralai-azure
- [NPM v1.3.4] https://www.npmjs.com/package/@mistralai/mistralai-azure/v/1.3.4 - packages/mistralai-azure

## 2024-12-04 09:27:57
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.451.1 (2.470.1) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v1.3.5] packages/mistralai-azure
### Releases
- [NPM v1.3.5] https://www.npmjs.com/package/@mistralai/mistralai-azure/v/1.3.5 - packages/mistralai-azure
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ let value: ReferenceChunk = {

| Field | Type | Required | Description |
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
| `type` | [components.ReferenceChunkType](../../models/components/referencechunktype.md) | :heavy_minus_sign: | N/A |
| `referenceIds` | *number*[] | :heavy_check_mark: | N/A |
| `referenceIds` | *number*[] | :heavy_check_mark: | N/A |
| `type` | [components.ReferenceChunkType](../../models/components/referencechunktype.md) | :heavy_minus_sign: | N/A |
4 changes: 2 additions & 2 deletions packages/mistralai-azure/docs/models/components/textchunk.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ let value: TextChunk = {

| Field | Type | Required | Description |
| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
| `type` | [components.Type](../../models/components/type.md) | :heavy_minus_sign: | N/A |
| `text` | *string* | :heavy_check_mark: | N/A |
| `text` | *string* | :heavy_check_mark: | N/A |
| `type` | [components.Type](../../models/components/type.md) | :heavy_minus_sign: | N/A |
2 changes: 1 addition & 1 deletion packages/mistralai-azure/jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
"name": "@mistralai/mistralai-azure",
"version": "1.3.4",
"version": "1.3.5",
"exports": {
".": "./src/index.ts",
"./models/errors": "./src/models/errors/index.ts",
Expand Down
63 changes: 61 additions & 2 deletions packages/mistralai-azure/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion packages/mistralai-azure/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mistralai/mistralai-azure",
"version": "1.3.4",
"version": "1.3.5",
"author": "Speakeasy",
"main": "./index.js",
"sideEffects": false,
Expand All @@ -15,6 +15,8 @@
"prepublishOnly": "npm run build"
},
"peerDependencies": {
"react": "^18 || ^19",
"react-dom": "^18 || ^19",
"zod": ">= 3"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/mistralai-azure/src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
export const SDK_METADATA = {
language: "typescript",
openapiDocVersion: "0.0.2",
sdkVersion: "1.3.4",
genVersion: "2.457.2",
sdkVersion: "1.3.5",
genVersion: "2.470.1",
userAgent:
"speakeasy-sdk/typescript 1.3.4 2.457.2 0.0.2 @mistralai/mistralai-azure",
"speakeasy-sdk/typescript 1.3.5 2.470.1 0.0.2 @mistralai/mistralai-azure",
} as const;
2 changes: 1 addition & 1 deletion packages/mistralai-azure/src/lib/matchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export function match<T, E>(
raw = await response.json();
break;
case "bytes":
raw = await response.arrayBuffer();
raw = new Uint8Array(await response.arrayBuffer());
break;
case "stream":
raw = response.body;
Expand Down
62 changes: 62 additions & 0 deletions packages/mistralai-azure/src/lib/primitives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,65 @@ export function remap<

return out;
}

export function combineSignals(
...signals: Array<AbortSignal | null | undefined>
): AbortSignal | null {
const filtered: AbortSignal[] = [];
for (const signal of signals) {
if (signal) {
filtered.push(signal);
}
}

switch (filtered.length) {
case 0:
case 1:
return filtered[0] || null;
default:
if ("any" in AbortSignal && typeof AbortSignal.any === "function") {
return AbortSignal.any(filtered);
}
return abortSignalAny(filtered);
}
}

export function abortSignalAny(signals: AbortSignal[]): AbortSignal {
const controller = new AbortController();
const result = controller.signal;
if (!signals.length) {
return controller.signal;
}

if (signals.length === 1) {
return signals[0] || controller.signal;
}

for (const signal of signals) {
if (signal.aborted) {
return signal;
}
}

function abort(this: AbortSignal) {
controller.abort(this.reason);
clean();
}

const signalRefs: WeakRef<AbortSignal>[] = [];
function clean() {
for (const signalRef of signalRefs) {
const signal = signalRef.deref();
if (signal) {
signal.removeEventListener("abort", abort);
}
}
}

for (const signal of signals) {
signalRefs.push(new WeakRef(signal));
signal.addEventListener("abort", abort);
}

return result;
}
39 changes: 39 additions & 0 deletions packages/mistralai-azure/src/models/components/assistantmessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

import * as z from "zod";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { ClosedEnum } from "../../types/enums.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
ContentChunk,
ContentChunk$inboundSchema,
Expand Down Expand Up @@ -64,6 +67,24 @@ export namespace AssistantMessageContent$ {
export type Outbound = AssistantMessageContent$Outbound;
}

export function assistantMessageContentToJSON(
assistantMessageContent: AssistantMessageContent,
): string {
return JSON.stringify(
AssistantMessageContent$outboundSchema.parse(assistantMessageContent),
);
}

export function assistantMessageContentFromJSON(
jsonString: string,
): SafeParseResult<AssistantMessageContent, SDKValidationError> {
return safeParse(
jsonString,
(x) => AssistantMessageContent$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AssistantMessageContent' from JSON`,
);
}

/** @internal */
export const AssistantMessageRole$inboundSchema: z.ZodNativeEnum<
typeof AssistantMessageRole
Expand Down Expand Up @@ -141,3 +162,21 @@ export namespace AssistantMessage$ {
/** @deprecated use `AssistantMessage$Outbound` instead. */
export type Outbound = AssistantMessage$Outbound;
}

export function assistantMessageToJSON(
assistantMessage: AssistantMessage,
): string {
return JSON.stringify(
AssistantMessage$outboundSchema.parse(assistantMessage),
);
}

export function assistantMessageFromJSON(
jsonString: string,
): SafeParseResult<AssistantMessage, SDKValidationError> {
return safeParse(
jsonString,
(x) => AssistantMessage$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'AssistantMessage' from JSON`,
);
}
Loading

0 comments on commit da73a50

Please sign in to comment.