Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restructure quickstart #150

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 35 additions & 19 deletions docs/getting-started/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,37 @@ import TabItem from '@theme/TabItem';

[platform_url]: https://console.mistral.ai/


:::tip[ ]
Looking for La Plateforme? Head to [console.mistral.ai][platform_url]
:::

## Getting started with Mistral AI API
## Getting started with the Mistral AI API

The Mistral AI API provides a seamless way for you to integrate Mistral's
state-of-the-art models into your applications and production workflows with
just a few lines of code.
Our API is currently available through [La Plateforme][platform_url].

<a target="_blank" href="https://colab.research.google.com/github/mistralai/cookbook/blob/main/quickstart.ipynb">
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/>
</a>
Comment on lines 22 to 24
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On other pages this button is often after the introductory text, but not always. It would be good to standardize this.


Mistral AI API provides a seamless way for developers to integrate Mistral's state-of-the-art
models into their applications and production workflows with just a few lines of code.
Our API is currently available through [La Plateforme][platform_url].
You need to activate payments on your account to enable your API keys.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer true because there's a free plan now.

### Get an API key

1. Go to [console.mistral.ai][platform_url] and sign in or create an account.
2. In the **Billing** section of the left menu, click **Workspace**.
3. Click **Go to to the billing plans page**, then select a plan.
4. In the **API** section of the left menu, click **API Keys**.
5. Click **Create new key**, then click **Create key** to confirm.
6. Click **Copy**. Save the API key securely, and do not share it with anyone.

### Try the Chat Completion API

After a few moments, you will be able to use our `chat` endpoint:

<Tabs>
<TabItem value="python" label="python" default>

```python
import os
from mistralai import Mistral
Expand All @@ -52,6 +64,7 @@ print(chat_response.choices[0].message.content)
</TabItem>

<TabItem value="typescript" label="typescript">

```typescript
import { Mistral } from '@mistralai/mistralai';

Expand All @@ -66,9 +79,11 @@ const chatResponse = await client.chat.complete({

console.log('Chat:', chatResponse.choices[0].message.content);
```

</TabItem>

<TabItem value="curl" label="curl">

```bash
curl --location "https://api.mistral.ai/v1/chat/completions" \
--header 'Content-Type: application/json' \
Expand All @@ -79,16 +94,20 @@ curl --location "https://api.mistral.ai/v1/chat/completions" \
"messages": [{"role": "user", "content": "Who is the most renowned French painter?"}]
}'
```

</TabItem>
</Tabs>

To generate text embeddings using Mistral AI's embeddings API, we can make a request to the API
endpoint and specify the embedding model `mistral-embed`, along with providing a list of input texts.
The API will then return the corresponding embeddings as numerical vectors, which can be used for
further analysis or processing in NLP applications.
### Try the Embeddings API

To generate text embeddings, you can make a request that specifies the model
`mistral-embed` and includes a list of input texts.
The API returns the corresponding embeddings as numerical vectors, which you can
use for further analysis or processing in NLP applications.

<Tabs>
<TabItem value="python" label="python" default>

```python
import os
from mistralai import Mistral
Expand All @@ -109,6 +128,7 @@ print(embeddings_response)
</TabItem>

<TabItem value="typescript" label="typescript">

```typescript
import { Mistral } from '@mistralai/mistralai';

Expand All @@ -123,9 +143,11 @@ const embeddingsResponse = await client.embeddings.create({

console.log(embeddingsResponse);
```

</TabItem>

<TabItem value="curl" label="curl">

```bash
curl --location "https://api.mistral.ai/v1/embeddings" \
--header 'Content-Type: application/json' \
Expand All @@ -136,16 +158,10 @@ curl --location "https://api.mistral.ai/v1/embeddings" \
"input": ["Embed this sentence.", "As well as this one."]
}'
```

</TabItem>
</Tabs>

For a full description of the models offered by the API, see the
**[Models Overview](../models/models_overview)**.


For a full description of the models offered on the API, head on to the **[model documentation](../models/models_overview)**.

## Account setup

- To get started, create a Mistral account or sign in at [console.mistral.ai][platform_url].
- Then, navigate to "Workspace" and "Billing" to add your payment information and activate payments on your account.
- After that, go to the "API keys" page and make a new API key by clicking "Create new key".
Make sure to copy the API key, save it safely, and do not share it with anyone.