Skip to content

Commit 556c70f

Browse files
authored
Merge pull request #556 from mistralai/sync/latest
Sync docs to v1.4.3
2 parents fc5fe6e + 82f11c2 commit 556c70f

97 files changed

Lines changed: 4523 additions & 4292 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cookbooks.config.json

Lines changed: 78 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -252,26 +252,6 @@
252252
},
253253
"displayDate": true
254254
},
255-
{
256-
"path": "mistral/fine_tune/pixtral_finetune_on_satellite_data.ipynb",
257-
"labels": {
258-
"integrations": [],
259-
"useCases": [
260-
"Pixtral",
261-
"Finetuning"
262-
]
263-
},
264-
"availableInDocs": {
265-
"page": true,
266-
"displayed": true
267-
},
268-
"title": "",
269-
"mainSection": {
270-
"featured": "False",
271-
"latest": "True"
272-
},
273-
"displayDate": true
274-
},
275255
{
276256
"path": "quickstart.ipynb",
277257
"labels": {
@@ -1644,25 +1624,6 @@
16441624
},
16451625
"displayDate": true
16461626
},
1647-
{
1648-
"path": "mistral/fine_tune/mistral_finetune_api.ipynb",
1649-
"labels": {
1650-
"integrations": [],
1651-
"useCases": [
1652-
"Finetuning"
1653-
]
1654-
},
1655-
"availableInDocs": {
1656-
"page": true,
1657-
"displayed": true
1658-
},
1659-
"title": "",
1660-
"mainSection": {
1661-
"featured": "False",
1662-
"latest": "False"
1663-
},
1664-
"displayDate": true
1665-
},
16661627
{
16671628
"path": "mistral/embeddings/embeddings.ipynb",
16681629
"labels": {
@@ -2478,6 +2439,44 @@
24782439
},
24792440
"displayDate": true
24802441
},
2442+
{
2443+
"path": "mistral/agents/glm_code_modernizer/01-glm-code-modernizer.md",
2444+
"labels": {
2445+
"integrations": [],
2446+
"useCases": [
2447+
"Agents"
2448+
]
2449+
},
2450+
"availableInDocs": {
2451+
"page": true,
2452+
"displayed": true
2453+
},
2454+
"title": "Modernize legacy Python code using GLM and the GitHub connector",
2455+
"mainSection": {
2456+
"featured": "False",
2457+
"latest": "True"
2458+
},
2459+
"displayDate": true
2460+
},
2461+
{
2462+
"path": "mistral/agents/glm_game_generator/01-glm-game-generator.md",
2463+
"labels": {
2464+
"integrations": [],
2465+
"useCases": [
2466+
"Agents"
2467+
]
2468+
},
2469+
"availableInDocs": {
2470+
"page": true,
2471+
"displayed": true
2472+
},
2473+
"title": "Generate a playable HTML5 mini game using the GLM model via the Mistral API",
2474+
"mainSection": {
2475+
"featured": "False",
2476+
"latest": "True"
2477+
},
2478+
"displayDate": true
2479+
},
24812480
{
24822481
"path": "mistral/connectors/database-advisor-agent/01-connectors-management.md",
24832482
"labels": {
@@ -2518,6 +2517,46 @@
25182517
},
25192518
"displayDate": true
25202519
},
2520+
{
2521+
"path": "mistral/connectors/quickstart-generator-typescript/02-build-a-quickstart-generator-typescript.md",
2522+
"labels": {
2523+
"integrations": [],
2524+
"useCases": [
2525+
"Connectors",
2526+
"Agents"
2527+
]
2528+
},
2529+
"availableInDocs": {
2530+
"page": true,
2531+
"displayed": true
2532+
},
2533+
"title": "Build a Quickstart Generator with Connectors and Web Search (TypeScript)",
2534+
"mainSection": {
2535+
"featured": "False",
2536+
"latest": "True"
2537+
},
2538+
"displayDate": true
2539+
},
2540+
{
2541+
"path": "mistral/connectors/02-build-a-quickstart-generator.ipynb",
2542+
"labels": {
2543+
"integrations": [],
2544+
"useCases": [
2545+
"Connectors",
2546+
"Agents"
2547+
]
2548+
},
2549+
"availableInDocs": {
2550+
"page": true,
2551+
"displayed": true
2552+
},
2553+
"title": "Build a Quickstart Generator with Connectors and Web Search",
2554+
"mainSection": {
2555+
"featured": "False",
2556+
"latest": "True"
2557+
},
2558+
"displayDate": true
2559+
},
25212560
{
25222561
"path": "mistral/connectors/02-connectors-in-conversations-and-agents.md",
25232562
"labels": {

route-utils.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,19 @@ function collectModelCardRoutes(): string[] {
127127
walkFiles(modelFilesRoot, filePath => {
128128
if (!filePath.endsWith(".ts") || filePath.endsWith(`${path.sep}index.ts`)) return;
129129
const source = fs.readFileSync(filePath, "utf8");
130-
const match = source.match(/\bslug:\s*['"]([^'"]+)['"]/);
131-
if (match?.[1]) addRoute(routes, `/models/${match[1]}`);
130+
const slugMatch = source.match(/\bslug:\s*['"]([^'"]+)['"]/);
131+
const aliasMatch = source.match(/\bslugAliases:\s*\[([^\]]*)\]/);
132+
const apiNamesMatch = source.match(/\bapiNames:\s*\[([^\]]*)\]/);
133+
const aliases = aliasMatch?.[1]?.match(/['"]([^'"]+)['"]/g)
134+
?.map(alias => alias.slice(1, -1)) ?? [];
135+
const latestApiNames = apiNamesMatch?.[1]?.match(/['"]([^'"]+-latest)['"]/g)
136+
?.map(alias => alias.slice(1, -1)) ?? [];
137+
138+
for (const slug of [slugMatch?.[1], ...aliases, ...latestApiNames]) {
139+
if (!slug) continue;
140+
addRoute(routes, `/models/${slug}`);
141+
addRoute(routes, `/models/model-cards/${slug}`);
142+
}
132143
});
133144
return Array.from(routes);
134145
}

src/app/[locale]/(docs)/model-card/[slug]/model-page.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Metadata } from 'next';
22
import { notFound } from 'next/navigation';
3-
import { models, findModelBySlug, getModelLicenses, isLegacyModel, Model } from '@/schema';
3+
import { permanentRedirect } from '@/i18n/navigation.server';
4+
import { models, findModelBySlug, findModelBySlugAlias, getModelLicenses, getModelSlugAliases, isLegacyModel, Model } from '@/schema';
45
import { ThunderIcon, LampIcon, FlagIcon } from '@/components/icons/pixel';
56
import { AVATAR_ICONS, getModelIconFallback } from '@/lib/icons';
67
import { getModelColorFallback, MODEL_COLORS } from '@/lib/colors';
@@ -46,9 +47,10 @@ interface ModelPageProps {
4647

4748
// Generate static params for all models
4849
export async function generateStaticParams() {
49-
return models.map(model => ({
50-
slug: model.slug,
51-
}));
50+
return models.flatMap(model => [
51+
model.slug,
52+
...getModelSlugAliases(model),
53+
].map(slug => ({ slug })));
5254
}
5355

5456
export const dynamicParams = true;
@@ -59,7 +61,7 @@ export async function generateMetadata({
5961
}: ModelPageProps): Promise<Metadata> {
6062
const { locale, slug } = (await params) as { locale: Locale; slug: string };
6163
const l = await getLingo(locale);
62-
const model = findModelBySlug(slug);
64+
const model = findModelBySlug(slug) ?? findModelBySlugAlias(slug);
6365

6466
if (!model) {
6567
return {
@@ -143,12 +145,17 @@ const MAX_API_NAMES = 1;
143145
export default async function ModelPage({ params }: ModelPageProps) {
144146
const { locale, slug } = (await params) as { locale: Locale; slug: string };
145147
const l = await getLingo(locale);
146-
const model = findModelBySlug(slug);
148+
const aliasModel = findModelBySlugAlias(slug);
149+
const model = aliasModel ?? findModelBySlug(slug);
147150

148151
if (!model) {
149152
notFound();
150153
}
151154

155+
if (aliasModel) {
156+
permanentRedirect(`/models/${aliasModel.slug}`, locale);
157+
}
158+
152159
const { description } = model.describe(l);
153160
const showRatings = !model.hideRatings;
154161
const speed = showRatings ? speedRating(model.ratings.speed, l) : null;

src/app/[locale]/(docs)/models/model-cards/[slug]/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { permanentRedirect } from '@/i18n/navigation.server';
2+
import { findModelBySlugAlias } from '@/schema';
23
import type { Locale } from '@/i18n/config';
34

45
export {
@@ -13,5 +14,6 @@ export default async function OldModelCardPage({
1314
params: Promise<{ locale: string; slug: string }>;
1415
}) {
1516
const { locale, slug } = (await params) as { locale: Locale; slug: string };
16-
permanentRedirect(`/models/${slug}`, locale);
17+
const aliasModel = findModelBySlugAlias(slug);
18+
permanentRedirect(`/models/${aliasModel?.slug ?? slug}`, locale);
1719
}

src/content/en/docs/studio/connectors/management/page.mdx

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,56 @@ The `create` endpoint also accepts these optional fields:
117117

118118
<SectionTab as="h1" sectionId="get-auth-url">Authenticate a Connector</SectionTab>
119119

120+
When a Connector is first created, an authentication call is required to connect even without credentials.
121+
122+
To connect when credentials aren't needed, pass empty credentials:
123+
124+
<Tabs groupId="code">
125+
<TabItem value="python" label="python" default>
126+
127+
```python
128+
import asyncio
129+
from mistralai.client import Mistral
130+
131+
client = Mistral(api_key="your-api-key")
132+
133+
134+
async def main() -> None:
135+
await client.beta.connectors.create_or_update_user_credentials_async(
136+
connector_id_or_name="connector-name",
137+
name=f"credential-name",
138+
credentials={'headers':{}},
139+
is_default=True,
140+
)
141+
142+
asyncio.run(main())
143+
```
144+
145+
</TabItem>
146+
<TabItem value="typescript" label="typescript">
147+
148+
```typescript
149+
import { Mistral } from "@mistralai/mistralai";
150+
151+
const client = new Mistral({ apiKey: "your-api-key" });
152+
153+
async function main(): Promise<void> {
154+
await client.beta.connectors.createOrUpdateUserCredentials({
155+
connectorIdOrName: "connector-name",
156+
credentialsCreateOrUpdate: {
157+
name: "credential-name",
158+
credentials: { headers: {} },
159+
isDefault: true,
160+
},
161+
});
162+
}
163+
164+
main();
165+
```
166+
167+
</TabItem>
168+
</Tabs>
169+
120170
If the MCP server requires OAuth, retrieve the authorization URL and redirect the user so they can grant access. After the user completes the auth flow, they are redirected to `app_return_url`.
121171

122172
:::caution

0 commit comments

Comments
 (0)