genkitx-mistral
Version:
Firebase Genkit AI framework plugin for Mistral AI APIs.
72 lines • 1.97 kB
JavaScript
import {
__async
} from "./chunk-MLCSNVBT.mjs";
import { genkitPlugin } from "genkit/plugin";
import { Mistral } from "@mistralai/mistralai";
import { mistralEmbedder, SUPPORTED_EMBEDDING_MODELS } from "./embedders";
import { SUPPORTED_MISTRAL_MODELS, mistralModel } from "./mistral_llms";
import { OCRModel } from "./ocr";
import {
openMistral7B,
openMistral8x7B,
openMixtral8x22B,
openMinistral3B,
openMinistral8B,
openMistralSmall,
openMistralMedium,
openMistralLarge,
openMistralNemo,
openCodestralMambda,
openCodestral,
openMistralSaba,
openPixtralLarge,
openPixtral
} from "./mistral_llms";
import { ocr } from "./ocr";
import { mistralembed } from "./embedders";
const mistral = (options) => genkitPlugin("mistral", (ai) => __async(void 0, null, function* () {
let apiKey = (options == null ? void 0 : options.apiKey) || process.env.MISTRAL_API_KEY;
if (!apiKey) {
throw new Error(
"Please pass in the API key or set the MISTRAL_API_KEY environment variable"
);
}
let customModels = (options == null ? void 0 : options.customModels) || {};
if (Object.keys(customModels).length > 0) {
for (const [name, model] of Object.entries(customModels)) {
if (model) {
SUPPORTED_MISTRAL_MODELS[name] = model;
}
}
}
const client = new Mistral(options);
for (const name of Object.keys(SUPPORTED_MISTRAL_MODELS)) {
mistralModel(ai, name, client);
}
for (const name of Object.keys(SUPPORTED_EMBEDDING_MODELS)) {
mistralEmbedder(ai, name, client);
}
OCRModel(ai, client);
}));
var src_default = mistral;
export {
src_default as default,
mistral,
mistralembed,
ocr,
openCodestral,
openCodestralMambda,
openMinistral3B,
openMinistral8B,
openMistral7B,
openMistral8x7B,
openMistralLarge,
openMistralMedium,
openMistralNemo,
openMistralSaba,
openMistralSmall,
openMixtral8x22B,
openPixtral,
openPixtralLarge
};
//# sourceMappingURL=index.mjs.map