-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from mistralai/doc/v0.0.77
Update docs to v0.0.77
- Loading branch information
Showing
7 changed files
with
8,851 additions
and
6,707 deletions.
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
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
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
--- | ||
id: sfcortex | ||
title: Snowflake Cortex | ||
sidebar_position: 3.24 | ||
--- | ||
|
||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
|
||
## Introduction | ||
|
||
Mistral AI's open and commercial models can be leveraged from the Snowflake Cortex platform | ||
as fully managed endpoints. Mistral models on Snowflake Cortex are serverless services so | ||
you don't have to manage any infrastructure. | ||
|
||
As of today, the following models are available: | ||
|
||
- Mistral Large | ||
- Mistral 7B | ||
|
||
For more details, visit the [models](../../../getting-started/models) page. | ||
|
||
## Getting started | ||
|
||
The following sections outline the steps to query the latest version of Mistral Large | ||
on the Snowflake Cortex platform. | ||
|
||
### Getting access to the model | ||
|
||
The following items are required: | ||
|
||
- The associated Snowflake account must be in a compatible region (see the | ||
[region list](https://docs.snowflake.com/en/user-guide/snowflake-cortex/llm-functions#availability) | ||
in the Snowflake documentation). | ||
- The principal that is calling the model must have the `CORTEX_USER` database role. | ||
|
||
### Querying the model (chat completion) | ||
|
||
The model can be called either directly in SQL or in Python using Snowpark ML. | ||
It is exposed via the | ||
[`COMPLETE` _LLM function_](https://docs.snowflake.com/en/sql-reference/functions/complete-snowflake-cortex). | ||
|
||
<Tabs> | ||
<TabItem value="sql" label="SQL"> | ||
```SQL | ||
SELECT SNOWFLAKE.CORTEX.COMPLETE('mistral-large2', 'Who is the best French painter? Answer in one short sentence.'); | ||
``` | ||
</TabItem> | ||
<TabItem value="Python" label="Python"> | ||
Execute this code either from a hosted Snowflake notebook or from your local machine. | ||
|
||
For local execution you need to: | ||
- Create a virtual environment with the following package: | ||
- `snowflake-ml-python` (tested with version `1.6.1`) | ||
- Ensure that you have a [configuration file](https://docs.snowflake.com/en/user-guide/snowsql-config) | ||
with the proper credentials on your system. The example below assumes that you have a named connection | ||
called `mistral` that is configured appropriately. | ||
|
||
```python | ||
from snowflake.snowpark import Session | ||
from snowflake.ml.utils import connection_params | ||
from snowflake.cortex import Complete | ||
|
||
# Start session (local execution only) | ||
params = connection_params.SnowflakeLoginOptions(connection_name="mistral") | ||
session = Session.builder.configs(params).create() | ||
|
||
# Query the model | ||
prompt = "Who is the best French painter? Answer in one short sentence." | ||
completion = Complete(model="mistral-large2", prompt=prompt) | ||
print(completion) | ||
``` | ||
</TabItem> | ||
</Tabs> | ||
|
||
## Going further | ||
|
||
For more information and examples, you can check the Snowflake documentation for: | ||
|
||
- [LLM functions](https://docs.snowflake.com/en/user-guide/snowflake-cortex/llm-functions) | ||
- The API of the `COMPLETE` function in | ||
[SQL](https://docs.snowflake.com/en/sql-reference/functions/complete-snowflake-cortex) | ||
and [Python](https://docs.snowflake.com/en/developer-guide/snowpark-ml/reference/latest/api/model/snowflake.cortex.Complete). |
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 |
---|---|---|
|
@@ -15,23 +15,24 @@ | |
"typecheck": "tsc" | ||
}, | ||
"dependencies": { | ||
"@docusaurus/core": "3.2.1", | ||
"@docusaurus/preset-classic": "3.2.1", | ||
"@easyops-cn/docusaurus-search-local": "^0.38.1", | ||
"@mdx-js/react": "^3.0.0", | ||
"@docusaurus/core": "3.5.2", | ||
"@docusaurus/preset-classic": "3.5.2", | ||
"@docusaurus/theme-common": "3.5.2", | ||
"@easyops-cn/docusaurus-search-local": "^0.44.5", | ||
"@mdx-js/react": "^3.0.1", | ||
"clsx": "^1.2.1", | ||
"docusaurus-lunr-search": "^3.3.1", | ||
"docusaurus-lunr-search": "^3.4.0", | ||
"lunr": "^2.3.9", | ||
"prism-react-renderer": "^2.3.1", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"redocusaurus": "^2.0.2" | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
"redocusaurus": "^2.1.1" | ||
}, | ||
"devDependencies": { | ||
"@docusaurus/module-type-aliases": "3.2.1", | ||
"@docusaurus/tsconfig": "^3.2.1", | ||
"@types/react": "^18.2.42", | ||
"typescript": "^5.3.2" | ||
"@docusaurus/tsconfig": "^3.5.2", | ||
"@types/react": "^18.3.4", | ||
"typescript": "^5.5.4" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
|
@@ -47,5 +48,6 @@ | |
}, | ||
"engines": { | ||
"node": ">=18.0" | ||
} | ||
}, | ||
"packageManager": "[email protected]+sha256.56a9e76b51796ca7f73b85e44cf83712862091f4d498c0ce4d5b7ecdc6ba18f7" | ||
} |
Oops, something went wrong.