@anvia/mistral
v0.3.5
Published
Mistral provider adapter for Anvia.
Readme
@anvia/mistral
Mistral completion and embedding provider adapter for Anvia.
Use this package when you want Anvia agents, extractors, pipelines, embeddings, or model listing to run on Mistral APIs.
Installation
pnpm add @anvia/mistral @anvia/coreIn this monorepo, the package is available through the workspace:
pnpm --filter @anvia/mistral buildUsage
import { AgentBuilder } from "@anvia/core";
import { MistralClient } from "@anvia/mistral";
const client = new MistralClient({ apiKey: process.env.MISTRAL_API_KEY });
const model = client.completionModel("mistral-large-latest");
const agent = new AgentBuilder("support", model)
.instructions("Answer clearly and concisely.")
.build();
const response = await agent.prompt("What should I check before launch?").send();
console.log(response.output);Embeddings
const embeddings = client.embeddingModel("mistral-embed");
const vectors = await embeddings.embedTexts(["Refunds take five business days."]);OCR
const ocr = client.ocrModel();
const result = await ocr.ocr({
source: {
type: "document_url",
url: "https://example.com/invoice.pdf",
documentName: "invoice.pdf",
},
});
console.log(result.markdown);Model Listing
const models = await client.listModels();Capabilities
The v1 adapter supports text completions, streaming, tools, tool choice, structured output, Mistral embeddings, OCR, and model listing. Chat image inputs, chat document file inputs, transcription, audio generation, and image generation are not implemented yet.
Exports
MistralClientMistralCompletionModelMistralEmbeddingModelMistralOcrModelMistralClientOptionsMistralEmbeddingModelOptionsMistralOcrRequestMistralOcrResponseMistralOcrSourceMistralOcrPageMistralOcrUploadedFileMISTRAL_OCR_LATESTmistralMessageHelpersmistral
Development
pnpm --filter @anvia/mistral typecheck
pnpm --filter @anvia/mistral test
pnpm --filter @anvia/mistral buildPackage-local typecheck and build scripts build @anvia/core first so core subpath types are available in a fresh worktree.
