You shouldn’t configure this integration if you’re already using another
integration like Langchain or LlamaIndex. Both integrations would
record the same generation and create duplicate steps in the UI.
To start your app, open a terminal and navigate to the directory containing app.py. Then run the following command:
chainlit run app.py -w
The -w flag tells Chainlit to enable auto-reloading, so you don’t need to restart the server every time you make changes to your application. Your chatbot UI should now be accessible at http://localhost:8000.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Chainlit","colors":{"primary":"#F80061","light":"#FFE7EB","dark":"#980039"},"logo":{"light":"https://mintcdn.com/chainlit-43/bY2N4qUEa_bGPLfY/logo/light.svg?fit=max\u0026auto=format\u0026n=bY2N4qUEa_bGPLfY\u0026q=85\u0026s=1b972cff6fb5980cf9bfb5c54d6b6821","dark":"https://mintcdn.com/chainlit-43/bY2N4qUEa_bGPLfY/logo/dark.svg?fit=max\u0026auto=format\u0026n=bY2N4qUEa_bGPLfY\u0026q=85\u0026s=2a67b9dc2c050be4fc5095c69d4adbb0","href":"https://github.com/Chainlit/chainlit"},"favicon":"https://mintcdn.com/chainlit-43/b2WeFP1vh0enOZXn/favicon.svg?fit=max\u0026auto=format\u0026n=b2WeFP1vh0enOZXn\u0026q=85\u0026s=513b4ccbfc1227b2ee36e6d5bb798e8e","appearance":{"default":"dark","strict":false},"background":{"color":{"dark":"#111010"}},"navbar":{"links":[{"href":"https://github.com/Chainlit/chainlit","label":"Github"}],"primary":{"type":"button","label":"Join Discord","href":"https://discord.gg/k73SQ3FyUh"}},"footer":{"socials":{"github":"https://github.com/Chainlit/chainlit","discord":"https://discord.gg/k73SQ3FyUh","x":"https://x.com/chainlit_io","linkedin":"https://www.linkedin.com/company/chainlit"}},"banner":{"content":"Chainlit is archived and no longer maintained. No bug fixes, security updates, or support are provided. [Read the project status](/get-started/project-status).","dismissible":false},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Chainlit Help","icon":"comment","href":"https://help.chainlit.io"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"chainlit-43","hasAudioNarration":false,"actualSubdomain":"chainlit-43","customDomains":["docs.chainlit.io"],"gitSource":{"type":"github","owner":"chainlit","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6adb25e2a0e78eb4aee8763a","collectionId":"50ed0ff5-a69b-41c0-b43c-04c8a1ce621f","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6adb25e2a0e78eb4aee8763a"},"feedback":{"thumbs":true,"edits":true,"issues":true},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6adb25e2a0e78eb4aee8763a","clientVersion":"0.0.4045","searchFilterCounts":[{"language":"default","tag":"Documentation","count":74},{"language":"default","tag":"API Reference","count":44},{"language":"default","tag":"Get Started","count":13},{"language":"default","tag":"Elements","count":11},{"language":"default","tag":"Integrations","count":11},{"language":"default","tag":"Deploy","count":10},{"language":"default","tag":"Examples","count":10},{"language":"default","tag":"Input Widgets","count":9},{"language":"default","tag":"Basic Concepts","count":9},{"language":"default","tag":"Platforms","count":9}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"integrations/mistralai","slug":"/integrations/mistralai","pageMetadata":{"title":"Mistral AI","description":null,"href":"/integrations/mistralai"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Warning,{children:_jsx(_components.p,{children:`You shouldn’t configure this integration if you’re already using another\nintegration like Langchain or LlamaIndex. Both integrations would\nrecord the same generation and create duplicate steps in the UI.`})}),`\n`,_jsx(Heading,{level:`2`,id:`prerequisites`,children:`Prerequisites`}),`\n`,_jsx(_components.p,{children:`Before getting started, make sure you have the following:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`A working installation of Chainlit`}),`\n`,_jsxs(_components.li,{children:[`The Mistral AI python client package installed, `,_jsx(_components.code,{children:`mistralai`})]}),`\n`,_jsxs(_components.li,{children:[`A `,_jsx(_components.a,{href:`https://console.mistral.ai/api-keys/`,children:`Mistral AI API key`})]}),`\n`,_jsx(_components.li,{children:`Basic understanding of Python programming`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`step-1-create-a-python-file`,children:`Step 1: Create a Python file`}),`\n`,_jsxs(_components.p,{children:[`Create a new Python file named `,_jsx(_components.code,{children:`app.py`}),` in your project directory. This file will contain the main logic for your LLM application.`]}),`\n`,_jsx(Heading,{level:`2`,id:`step-2-write-the-application-logic`,children:`Step 2: Write the Application Logic`}),`\n`,_jsxs(_components.p,{children:[`In `,_jsx(_components.code,{children:`app.py`}),`, import the necessary packages and define one function to handle messages incoming from the UI.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`27`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`27`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` chainlit `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` cl`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` mistralai `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Mistral`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Initialize the Mistral client`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`client `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Mistral(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`api_key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`os.getenv(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"MISTRAL_API_KEY\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@cl.on_message`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` on_message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: cl.Message):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.chat.complete_async(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"mistral-small-latest\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` max_tokens`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` temperature`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` stream`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`False`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # ... more setting`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` messages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"system\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"You are a helpful bot, you always reply in French.\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: message.content `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Content of the user message`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` cl.Message(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response.choices[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].message.content).send()`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`step-3-fill-the-environment-variables`,children:`Step 3: Fill the environment variables`}),`\n`,_jsxs(_components.p,{children:[`Create a file named `,_jsx(_components.code,{children:`.env`}),` in the same folder as your `,_jsx(_components.code,{children:`app.py`}),` file. Add your Mistral AI API key in the `,_jsx(_components.code,{children:`MISTRAL_API_KEY`}),` variable.`]}),`\n`,_jsx(Heading,{level:`2`,id:`step-4-run-the-application`,children:`Step 4: Run the Application`}),`\n`,_jsxs(_components.p,{children:[`To start your app, open a terminal and navigate to the directory containing `,_jsx(_components.code,{children:`app.py`}),`. Then run the following command:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`chainlit`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` run`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` app.py`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -w`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`-w`}),` flag tells Chainlit to enable auto-reloading, so you don’t need to restart the server every time you make changes to your application. Your chatbot UI should now be accessible at `,_jsx(_components.a,{href:`http://localhost:8000`,children:`http://localhost:8000`}),`.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Mistral AI","description":null,"href":"/integrations/mistralai"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Prerequisites","slug":"prerequisites","depth":2,"children":[]},{"title":"Step 1: Create a Python file","slug":"step-1-create-a-python-file","depth":2,"children":[]},{"title":"Step 2: Write the Application Logic","slug":"step-2-write-the-application-logic","depth":2,"children":[]},{"title":"Step 3: Fill the environment variables","slug":"step-3-fill-the-environment-variables","depth":2,"children":[]},{"title":"Step 4: Run the Application","slug":"step-4-run-the-application","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"chainlit-43","siteName":"Chainlit","title":"Mistral AI - Chainlit","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-23T09:16:26.059Z","originalFileLocation":"integrations/mistralai.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Chainlit\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/chainlit-43/dEvNex89E1YeuZx8/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/chainlit-43/dEvNex89E1YeuZx8/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/chainlit-43/dEvNex89E1YeuZx8/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/chainlit-43/dEvNex89E1YeuZx8/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/chainlit-43/dEvNex89E1YeuZx8/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/chainlit-43/dEvNex89E1YeuZx8/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/chainlit-43/dEvNex89E1YeuZx8/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/chainlit-43/dEvNex89E1YeuZx8/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/chainlit-43/dEvNex89E1YeuZx8/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Mistral AI - Chainlit\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Chainlit\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.chainlit.io/integrations/mistralai\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://chainlit-43.mintlify.app/_mintlify/api/og/v2?division=Integrations\u0026amp;title=Mistral+AI\u0026amp;theme=526b67ea84a41d792424ad38\u0026amp;signature=52af29b5019bdfdae303db5b31f3a79db71dc8e831fcc6dbea14b7f021d56001\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Mistral AI - Chainlit\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://chainlit-43.mintlify.app/_mintlify/api/og/v2?division=Integrations\u0026amp;title=Mistral+AI\u0026amp;theme=526b67ea84a41d792424ad38\u0026amp;signature=52af29b5019bdfdae303db5b31f3a79db71dc8e831fcc6dbea14b7f021d56001\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/chainlit-43/dEvNex89E1YeuZx8/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Chainlit\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#F80061\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.chainlit.io/integrations/mistralai\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/integrations/mistralai.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.chainlit.io/#organization\",\"name\":\"Chainlit\",\"url\":\"https://docs.chainlit.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/chainlit-43/bY2N4qUEa_bGPLfY/logo/light.svg?fit=max\u0026auto=format\u0026n=bY2N4qUEa_bGPLfY\u0026q=85\u0026s=1b972cff6fb5980cf9bfb5c54d6b6821\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.chainlit.io#website\",\"name\":\"Chainlit\",\"url\":\"https://docs.chainlit.io\",\"publisher\":{\"@id\":\"https://docs.chainlit.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.chainlit.io/integrations/mistralai#webpage\",\"url\":\"https://docs.chainlit.io/integrations/mistralai\",\"name\":\"Mistral AI\",\"dateModified\":\"2026-10-23T09:16:26.059Z\",\"isPartOf\":{\"@id\":\"https://docs.chainlit.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.chainlit.io/integrations/mistralai#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.chainlit.io/integrations/mistralai#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Get Started\",\"item\":\"https://docs.chainlit.io/get-started/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Integrations\",\"item\":\"https://docs.chainlit.io/integrations/fastapi\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Mistral AI\",\"item\":\"https://docs.chainlit.io/integrations/mistralai\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.chainlit.io/integrations/mistralai#article\",\"headline\":\"Mistral AI\",\"name\":\"Mistral AI\",\"url\":\"https://docs.chainlit.io/integrations/mistralai\",\"mainEntityOfPage\":{\"@id\":\"https://docs.chainlit.io/integrations/mistralai#webpage\"},\"dateModified\":\"2026-10-23T09:16:26.059Z\",\"publisher\":{\"@id\":\"https://docs.chainlit.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.chainlit.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Chainlit\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Chainlit","nav":{"global":{"anchors":[{"anchor":"Chainlit Help","icon":"comment","href":"https://help.chainlit.io"}]},"tabs":[{"tab":"Documentation","groups":[{"group":"Get Started","pages":[{"title":"Overview","href":"/get-started/overview"},{"title":"Project status","href":"/get-started/project-status"},{"title":"Installation","href":"/get-started/installation"},{"title":"In Pure Python","href":"/get-started/pure-python"},{"group":"Integrations","pages":[{"title":"FastAPI","href":"/integrations/fastapi"},{"title":"LangChain/LangGraph","href":"/integrations/langchain"},{"title":"OpenAI","href":"/integrations/openai"},{"title":"Semantic Kernel","description":null,"href":"/integrations/semantic-kernel"},{"title":"Mistral AI","href":"/integrations/mistralai"},{"title":"LiteLLM","description":null,"href":"/integrations/litellm"},{"title":"Llama Index","href":"/integrations/llama-index"},{"title":"Embedchain","href":"/integrations/embedchain"},{"title":"vLLM, LMStudio, HuggingFace","href":"/integrations/message-based"}]}]},{"group":"Deploy","pages":[{"title":"Overview","href":"/deploy/overview"},{"group":"Platforms","pages":[{"title":"Web App","href":"/deploy/webapp"},{"group":"React","pages":[{"title":"Overview","href":"/deploy/react/overview"},{"title":null,"href":"/deploy/react/installation-and-setup"},{"title":null,"href":"/deploy/react/usage"},{"title":null,"href":"/deploy/react/additional-resources"}]},{"title":"Copilot","href":"/deploy/copilot"},{"title":"Teams","href":"/deploy/teams"},{"title":"Slack","href":"/deploy/slack"},{"title":"Discord","href":"/deploy/discord"}]}]},{"group":"Basic Concepts","pages":[{"title":"Chat Life Cycle","href":"/concepts/chat-lifecycle"},{"title":"Starters","href":"/concepts/starters"},{"title":"Message","href":"/concepts/message"},{"title":"Step","href":"/concepts/step"},{"title":"User Session","href":"/concepts/user-session"},{"title":"Element","href":"/concepts/element"},{"title":"Action","href":"/concepts/action"},{"title":"Command","href":"/concepts/command"},{"title":"Modes","href":"/concepts/modes"}]},{"group":"Advanced Features","pages":[{"title":"Streaming","href":"/advanced-features/streaming"},{"title":"MCP","href":"/advanced-features/mcp"},{"title":"Ask User","href":"/advanced-features/ask-user"},{"title":"Multi-Modality","href":"/advanced-features/multi-modal"},{"title":"Chat Profiles","href":"/advanced-features/chat-profiles"},{"title":"Chat Settings","href":"/advanced-features/chat-settings"},{"title":"Testing \u0026 Debugging","href":"/advanced-features/test-debug"}]},{"group":"Data Persistence","pages":[{"title":"Overview","href":"/data-persistence/overview"},{"title":"Chat History","href":"/data-persistence/history"},{"title":"Human Feedback","href":"/data-persistence/feedback"},{"group":"Open Source Data Layers","pages":[{"title":"Overview","href":"/data-layers/overview"},{"title":"Official Data Layer","href":"/data-layers/official"},{"title":"SQLAlchemy Data Layer","href":"/data-layers/sqlalchemy"},{"title":"DynamoDB Data Layer","href":"/data-layers/dynamodb"}]},{"title":"Tags \u0026 Metadata","href":"/data-persistence/tags-metadata"}]},{"group":"Authentication","pages":[{"title":"Overview","href":"/authentication/overview"},{"title":"Password","href":"/authentication/password"},{"title":"Header","href":"/authentication/header"},{"title":"OAuth","href":"/authentication/oauth"}]},{"group":"Customisation","pages":[{"title":null,"href":"/customisation/overview"},{"title":"Translation","href":"/customisation/translation"},{"title":"Avatars","href":"/customisation/avatars"},{"title":"Logo and Favicon","href":"/customisation/custom-logo-and-favicon"},{"title":"Theme","href":"/customisation/theme"},{"title":"JS","href":"/customisation/custom-js"},{"title":"CSS","href":"/customisation/custom-css"}]},{"group":"Backend","pages":[{"group":"Config","pages":[{"title":"Overview","href":"/backend/config/overview"},{"title":"Project","href":"/backend/config/project"},{"title":"Features","href":"/backend/config/features"},{"title":"UI","href":"/backend/config/ui"}]},{"title":"Environment Variables","href":"/backend/env-variables"},{"title":"Command Line Options","href":"/backend/command-line"}]},{"group":"Guides","pages":[{"title":"Async / Sync","href":"/guides/sync-async"}]},{"group":"Migration Guides","pages":[{"title":"Migrate to Chainlit v2.9.4","href":"/guides/migration/2.9.4"},{"title":"Migrate to Chainlit v2.3.0","href":"/guides/migration/2.3.0"},{"title":"Migrate to Chainlit v2.1.0","href":"/guides/migration/2.1.0"},{"title":"Migrate to Chainlit v2.0.0","href":"/guides/migration/2.0.0"},{"title":"Migrate to Chainlit v1.1.404","href":"/guides/migration/1.1.404"},{"title":"Migrate to Chainlit v1.1.400","href":"/guides/migration/1.1.400"},{"title":"Migrate to Chainlit v1.1.300","href":"/guides/migration/1.1.300"},{"title":"Migrate to Chainlit v1.1.0","href":"/guides/migration/1.1.0"},{"title":"Migrate to Chainlit v1.0.500","href":"/guides/migration/1.0.500"}]}]},{"tab":"Examples","pages":[{"title":"Examples","href":"/examples/cookbook"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/lifecycle-hooks/on-chat-start"}]}]},"basePath":"","title":"Mistral AI - Chainlit","buildId":"dpl_36EDyZCDfRuoUD9af5CH4M1bqY2h","deploymentId":"dpl_36EDyZCDfRuoUD9af5CH4M1bqY2h","dynamics":["10e4515597"],"chunks":["BannerMarkdown-DHaG7hr_.js","dist-DKZWslLH.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","clsx-BIWXJmsZ.js","html-void-elements-mCSPHezU.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js"]}