-
Notifications
You must be signed in to change notification settings - Fork 61
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
j-rigg
wants to merge
2
commits into
mistralai:main
Choose a base branch
from
j-rigg:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
|
||
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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
@@ -52,6 +64,7 @@ print(chat_response.choices[0].message.content) | |
</TabItem> | ||
|
||
<TabItem value="typescript" label="typescript"> | ||
|
||
```typescript | ||
import { Mistral } from '@mistralai/mistralai'; | ||
|
||
|
@@ -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' \ | ||
|
@@ -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 | ||
|
@@ -109,6 +128,7 @@ print(embeddings_response) | |
</TabItem> | ||
|
||
<TabItem value="typescript" label="typescript"> | ||
|
||
```typescript | ||
import { Mistral } from '@mistralai/mistralai'; | ||
|
||
|
@@ -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' \ | ||
|
@@ -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. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.