/** * ============================================================================= * MISTRAL PAGE - SDK Examples Dashboard * ============================================================================= * * Showcases all Mistral SDK integration patterns with real-world examples. * * INTERVIEW NOTES: * - Demonstrates familiarity with Mistral's API capabilities * - Shows proper React patterns for AI integrations * - Includes streaming, function calling, and code generation */ import ChatExample from '@/components/examples/ChatExample'; import StreamingExample from '@/components/examples/StreamingExample'; import ConversationExample from '@/components/examples/ConversationExample'; import CodeExample from '@/components/examples/CodeExample'; import FunctionCallingExample from '@/components/examples/FunctionCallingExample'; const MISTRAL_FEATURES = [ { name: 'Chat Completion', description: 'Single-turn request/response pattern', model: 'mistral-small-latest', }, { name: 'Streaming', description: 'Real-time token-by-token generation', model: 'mistral-small-latest', }, { name: 'Conversations', description: 'Multi-turn with maintained context', model: 'mistral-small-latest', }, { name: 'Code Generation', description: 'Specialized coding model', model: 'codestral-latest', }, { name: 'Function Calling', description: 'Tool use and external integrations', model: 'mistral-large-latest', }, ]; export default function MistralPage() { return (
Real-world integration patterns using the official @mistralai/mistralai SDK.
{feature.description}
{feature.model}
Set your MISTRAL_API_KEY in the server environment to enable these examples.
Get your API key from{' '}
console.mistral.ai
npm install @mistralai/mistralai
{`import { Mistral } from '@mistralai/mistralai';
const client = new Mistral({ apiKey: process.env.MISTRAL_API_KEY });
// Chat completion
const response = await client.chat.complete({
model: 'mistral-small-latest',
messages: [
{ role: 'system', content: 'You are helpful.' },
{ role: 'user', content: 'Hello!' }
]
});
// Streaming
const stream = await client.chat.stream({
model: 'mistral-small-latest',
messages: [{ role: 'user', content: 'Tell me a story' }]
});
for await (const chunk of stream) {
process.stdout.write(chunk.data.choices[0].delta.content || '');
}`}