@effect-uai/mistral 0.8.0
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/LICENSE +21 -0
- package/README.md +76 -0
- package/dist/Mistral.d.mts +48 -0
- package/dist/Mistral.d.mts.map +1 -0
- package/dist/Mistral.mjs +88 -0
- package/dist/Mistral.mjs.map +1 -0
- package/dist/MistralRealtimeTranscriber.d.mts +15 -0
- package/dist/MistralRealtimeTranscriber.d.mts.map +1 -0
- package/dist/MistralRealtimeTranscriber.mjs +34 -0
- package/dist/MistralRealtimeTranscriber.mjs.map +1 -0
- package/dist/MistralSynthesizer.d.mts +43 -0
- package/dist/MistralSynthesizer.d.mts.map +1 -0
- package/dist/MistralSynthesizer.mjs +121 -0
- package/dist/MistralSynthesizer.mjs.map +1 -0
- package/dist/MistralTranscriber.d.mts +44 -0
- package/dist/MistralTranscriber.d.mts.map +1 -0
- package/dist/MistralTranscriber.mjs +111 -0
- package/dist/MistralTranscriber.mjs.map +1 -0
- package/dist/audioCodec.d.mts +27 -0
- package/dist/audioCodec.d.mts.map +1 -0
- package/dist/audioCodec.mjs +82 -0
- package/dist/audioCodec.mjs.map +1 -0
- package/dist/chunk-CfYAbeIz.mjs +13 -0
- package/dist/codec.d.mts +100 -0
- package/dist/codec.d.mts.map +1 -0
- package/dist/codec.mjs +244 -0
- package/dist/codec.mjs.map +1 -0
- package/dist/codec.test.d.mts +1 -0
- package/dist/codec.test.mjs +13800 -0
- package/dist/codec.test.mjs.map +1 -0
- package/dist/http.d.mts +9 -0
- package/dist/http.d.mts.map +1 -0
- package/dist/http.mjs +41 -0
- package/dist/http.mjs.map +1 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.mjs +7 -0
- package/dist/magic-string.es-PAZgLX4h.mjs +1013 -0
- package/dist/magic-string.es-PAZgLX4h.mjs.map +1 -0
- package/dist/models-DnDmylpj.d.mts +22 -0
- package/dist/models-DnDmylpj.d.mts.map +1 -0
- package/dist/models.d.mts +2 -0
- package/dist/models.mjs +1 -0
- package/dist/realtimeStt-ClXWXbXX.d.mts +21 -0
- package/dist/realtimeStt-ClXWXbXX.d.mts.map +1 -0
- package/dist/realtimeStt.d.mts +2 -0
- package/dist/realtimeStt.mjs +136 -0
- package/dist/realtimeStt.mjs.map +1 -0
- package/package.json +82 -0
- package/src/Mistral.ts +189 -0
- package/src/MistralRealtimeTranscriber.ts +60 -0
- package/src/MistralSynthesizer.ts +285 -0
- package/src/MistralTranscriber.ts +224 -0
- package/src/audioCodec.ts +123 -0
- package/src/codec.test.ts +121 -0
- package/src/codec.ts +338 -0
- package/src/http.ts +46 -0
- package/src/index.ts +6 -0
- package/src/models.ts +47 -0
- package/src/realtimeStt.ts +256 -0
package/dist/http.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as AiError from "@effect-uai/core/AiError";
|
|
2
|
+
|
|
3
|
+
//#region src/http.d.ts
|
|
4
|
+
/** Map an HTTP status from any Mistral endpoint to an `AiError` variant. */
|
|
5
|
+
declare const httpStatusError: (status: number, body: string) => AiError.AiError;
|
|
6
|
+
declare const transportFailure: (cause: unknown) => AiError.AiError;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { httpStatusError, transportFailure };
|
|
9
|
+
//# sourceMappingURL=http.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.mts","names":[],"sources":["../src/http.ts"],"mappings":";;;;cAIa,eAAA,GAAkB,MAAA,UAAgB,IAAA,aAAiB,OAAA,CAAQ,OAAA;AAAA,cAwC3D,gBAAA,GAAoB,KAAA,cAAiB,OAAA,CAAQ,OAAA"}
|
package/dist/http.mjs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Match } from "effect";
|
|
2
|
+
import * as AiError from "@effect-uai/core/AiError";
|
|
3
|
+
//#region src/http.ts
|
|
4
|
+
/** Map an HTTP status from any Mistral endpoint to an `AiError` variant. */
|
|
5
|
+
const httpStatusError = (status, body) => Match.value(status).pipe(Match.when(429, () => new AiError.RateLimited({
|
|
6
|
+
provider: "mistral",
|
|
7
|
+
raw: body
|
|
8
|
+
})), Match.whenOr(408, 504, () => new AiError.Timeout({
|
|
9
|
+
provider: "mistral",
|
|
10
|
+
raw: body
|
|
11
|
+
})), Match.when(401, () => new AiError.AuthFailed({
|
|
12
|
+
provider: "mistral",
|
|
13
|
+
subtype: "auth",
|
|
14
|
+
raw: body
|
|
15
|
+
})), Match.when(403, () => new AiError.AuthFailed({
|
|
16
|
+
provider: "mistral",
|
|
17
|
+
subtype: "permission",
|
|
18
|
+
raw: body
|
|
19
|
+
})), Match.when(402, () => new AiError.AuthFailed({
|
|
20
|
+
provider: "mistral",
|
|
21
|
+
subtype: "billing",
|
|
22
|
+
raw: body
|
|
23
|
+
})), Match.when(413, () => new AiError.ContextLengthExceeded({
|
|
24
|
+
provider: "mistral",
|
|
25
|
+
raw: body
|
|
26
|
+
})), Match.when((n) => n >= 500, (n) => new AiError.Unavailable({
|
|
27
|
+
provider: "mistral",
|
|
28
|
+
status: n,
|
|
29
|
+
raw: body
|
|
30
|
+
})), Match.orElse(() => new AiError.InvalidRequest({
|
|
31
|
+
provider: "mistral",
|
|
32
|
+
raw: body
|
|
33
|
+
})));
|
|
34
|
+
const transportFailure = (cause) => new AiError.Unavailable({
|
|
35
|
+
provider: "mistral",
|
|
36
|
+
raw: cause
|
|
37
|
+
});
|
|
38
|
+
//#endregion
|
|
39
|
+
export { httpStatusError, transportFailure };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=http.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.mjs","names":[],"sources":["../src/http.ts"],"sourcesContent":["import { Match } from \"effect\"\nimport * as AiError from \"@effect-uai/core/AiError\"\n\n/** Map an HTTP status from any Mistral endpoint to an `AiError` variant. */\nexport const httpStatusError: (status: number, body: string) => AiError.AiError = (status, body) =>\n Match.value(status).pipe(\n Match.when(\n 429,\n (): AiError.AiError => new AiError.RateLimited({ provider: \"mistral\", raw: body }),\n ),\n Match.whenOr(\n 408,\n 504,\n (): AiError.AiError => new AiError.Timeout({ provider: \"mistral\", raw: body }),\n ),\n Match.when(\n 401,\n (): AiError.AiError =>\n new AiError.AuthFailed({ provider: \"mistral\", subtype: \"auth\", raw: body }),\n ),\n Match.when(\n 403,\n (): AiError.AiError =>\n new AiError.AuthFailed({ provider: \"mistral\", subtype: \"permission\", raw: body }),\n ),\n Match.when(\n 402,\n (): AiError.AiError =>\n new AiError.AuthFailed({ provider: \"mistral\", subtype: \"billing\", raw: body }),\n ),\n Match.when(\n 413,\n (): AiError.AiError => new AiError.ContextLengthExceeded({ provider: \"mistral\", raw: body }),\n ),\n Match.when(\n (n) => n >= 500,\n (n): AiError.AiError =>\n new AiError.Unavailable({ provider: \"mistral\", status: n, raw: body }),\n ),\n Match.orElse(\n (): AiError.AiError => new AiError.InvalidRequest({ provider: \"mistral\", raw: body }),\n ),\n )\n\nexport const transportFailure = (cause: unknown): AiError.AiError =>\n new AiError.Unavailable({ provider: \"mistral\", raw: cause })\n"],"mappings":";;;;AAIA,MAAa,mBAAsE,QAAQ,SACzF,MAAM,MAAM,OAAO,CAAC,KAClB,MAAM,KACJ,WACuB,IAAI,QAAQ,YAAY;CAAE,UAAU;CAAW,KAAK;CAAM,CAAC,CACnF,EACD,MAAM,OACJ,KACA,WACuB,IAAI,QAAQ,QAAQ;CAAE,UAAU;CAAW,KAAK;CAAM,CAAC,CAC/E,EACD,MAAM,KACJ,WAEE,IAAI,QAAQ,WAAW;CAAE,UAAU;CAAW,SAAS;CAAQ,KAAK;CAAM,CAAC,CAC9E,EACD,MAAM,KACJ,WAEE,IAAI,QAAQ,WAAW;CAAE,UAAU;CAAW,SAAS;CAAc,KAAK;CAAM,CAAC,CACpF,EACD,MAAM,KACJ,WAEE,IAAI,QAAQ,WAAW;CAAE,UAAU;CAAW,SAAS;CAAW,KAAK;CAAM,CAAC,CACjF,EACD,MAAM,KACJ,WACuB,IAAI,QAAQ,sBAAsB;CAAE,UAAU;CAAW,KAAK;CAAM,CAAC,CAC7F,EACD,MAAM,MACH,MAAM,KAAK,MACX,MACC,IAAI,QAAQ,YAAY;CAAE,UAAU;CAAW,QAAQ;CAAG,KAAK;CAAM,CAAC,CACzE,EACD,MAAM,aACmB,IAAI,QAAQ,eAAe;CAAE,UAAU;CAAW,KAAK;CAAM,CAAC,CACtF,CACF;AAEH,MAAa,oBAAoB,UAC/B,IAAI,QAAQ,YAAY;CAAE,UAAU;CAAW,KAAK;CAAO,CAAC"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { i as MistralTtsModel, n as MistralRealtimeModel, r as MistralTranscribeModel, t as MistralModel } from "./models-DnDmylpj.mjs";
|
|
2
|
+
import { t as Mistral_d_exports } from "./Mistral.mjs";
|
|
3
|
+
import { t as MistralTranscriber_d_exports } from "./MistralTranscriber.mjs";
|
|
4
|
+
import { t as MistralRealtimeTranscriber_d_exports } from "./MistralRealtimeTranscriber.mjs";
|
|
5
|
+
import { t as MistralSynthesizer_d_exports } from "./MistralSynthesizer.mjs";
|
|
6
|
+
import { t as codec_d_exports } from "./codec.mjs";
|
|
7
|
+
export { Mistral_d_exports as Mistral, MistralModel, MistralRealtimeModel, MistralRealtimeTranscriber_d_exports as MistralRealtimeTranscriber, MistralSynthesizer_d_exports as MistralSynthesizer, MistralTranscribeModel, MistralTranscriber_d_exports as MistralTranscriber, MistralTtsModel, codec_d_exports as codec };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { t as codec_exports } from "./codec.mjs";
|
|
2
|
+
import { t as Mistral_exports } from "./Mistral.mjs";
|
|
3
|
+
import { t as MistralTranscriber_exports } from "./MistralTranscriber.mjs";
|
|
4
|
+
import { t as MistralRealtimeTranscriber_exports } from "./MistralRealtimeTranscriber.mjs";
|
|
5
|
+
import { t as MistralSynthesizer_exports } from "./MistralSynthesizer.mjs";
|
|
6
|
+
import "./models.mjs";
|
|
7
|
+
export { Mistral_exports as Mistral, MistralRealtimeTranscriber_exports as MistralRealtimeTranscriber, MistralSynthesizer_exports as MistralSynthesizer, MistralTranscriber_exports as MistralTranscriber, codec_exports as codec };
|