ListPrompts
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.list()
while res is not None:
# Handle items
res = res.next()
| Parameter | Type | Required | Description |
|---|
page_size | Optional[int] | :heavy_minus_sign: | N/A |
page_token | Optional[str] | :heavy_minus_sign: | N/A |
alias | Optional[str] | :heavy_minus_sign: | N/A |
fields | List[str] | :heavy_minus_sign: | N/A |
sort_field | Optional[models.ListSortField] | :heavy_minus_sign: | Defaults to created_at when omitted. |
sort_direction_query_parameter | Optional[models.ListSortDirection] | :heavy_minus_sign: | Defaults to descending for timestamp fields and ascending for text fields. |
sort_by | Optional[str] | :heavy_minus_sign: | REST-friendly alias for sort.field. Supported values: created_at, last_modified_at, name, title. |
sort_direction_query_parameter1 | Optional[str] | :heavy_minus_sign: | REST-friendly alias for sort.direction. Supported values: asc, desc. |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
models.PromptsListResponse
| Error Type | Status Code | Content Type |
|---|
| errors.SDKError | 4XX, 5XX | */* |
CreatePrompt
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.create(name="<value>", definition={
"content": "<value>",
})
# Handle response
print(res)
| Parameter | Type | Required | Description |
|---|
name | str | :heavy_check_mark: | Stable object name. |
definition | models.PromptDefinition | :heavy_check_mark: | Versioned prompt content. |
title | OptionalNullable[str] | :heavy_minus_sign: | Display title. |
description | OptionalNullable[str] | :heavy_minus_sign: | Display description. |
notes | OptionalNullable[str] | :heavy_minus_sign: | Notes for this version. |
sharing_scope | Optional[models.RegistrySharingScope] | :heavy_minus_sign: | N/A |
aliases | List[str] | :heavy_minus_sign: | Aliases pointing to this version. |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
models.Prompt
| Error Type | Status Code | Content Type |
|---|
| errors.SDKError | 4XX, 5XX | */* |
GetPrompt
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.get(prompt_id="<id>", version=1)
# Handle response
print(res)
| Parameter | Type | Required | Description | Example |
|---|
prompt_id | str | :heavy_check_mark: | N/A | |
version | Optional[int] | :heavy_minus_sign: | N/A | 1 |
alias | Optional[str] | :heavy_minus_sign: | N/A | |
fields | List[str] | :heavy_minus_sign: | N/A | |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
models.Prompt
| Error Type | Status Code | Content Type |
|---|
| errors.SDKError | 4XX, 5XX | */* |
DeletePrompt
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.delete(prompt_id="<id>")
# Handle response
print(res)
| Parameter | Type | Required | Description |
|---|
prompt_id | str | :heavy_check_mark: | N/A |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
models.DeletePromptResponse
| Error Type | Status Code | Content Type |
|---|
| errors.SDKError | 4XX, 5XX | */* |
UpdatePrompt
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.update_metadata(prompt_id="<id>")
# Handle response
print(res)
| Parameter | Type | Required | Description |
|---|
prompt_id | str | :heavy_check_mark: | N/A |
title | OptionalNullable[str] | :heavy_minus_sign: | Display title. |
description | OptionalNullable[str] | :heavy_minus_sign: | Display description. |
sharing_scope | Optional[models.RegistrySharingScope] | :heavy_minus_sign: | N/A |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
models.Prompt
| Error Type | Status Code | Content Type |
|---|
| errors.SDKError | 4XX, 5XX | */* |
ListPromptVersions
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.list_versions(prompt_id="<id>")
# Handle response
print(res)
| Parameter | Type | Required | Description |
|---|
prompt_id | str | :heavy_check_mark: | N/A |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
models.ListPromptVersionsResponse
| Error Type | Status Code | Content Type |
|---|
| errors.SDKError | 4XX, 5XX | */* |
CreatePromptVersion
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.create_version(prompt_id="<id>", definition={
"content": "<value>",
})
# Handle response
print(res)
| Parameter | Type | Required | Description |
|---|
prompt_id | str | :heavy_check_mark: | N/A |
definition | models.PromptDefinition | :heavy_check_mark: | Versioned prompt content. |
notes | OptionalNullable[str] | :heavy_minus_sign: | Notes for this version. |
aliases | List[str] | :heavy_minus_sign: | Aliases pointing to this version. |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
models.CreatePromptVersionResponse
| Error Type | Status Code | Content Type |
|---|
| errors.SDKError | 4XX, 5XX | */* |
GetPromptVersion
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.get_version(prompt_id="<id>", version=1)
# Handle response
print(res)
| Parameter | Type | Required | Description | Example |
|---|
prompt_id | str | :heavy_check_mark: | N/A | |
version | int | :heavy_check_mark: | N/A | 1 |
fields | List[str] | :heavy_minus_sign: | N/A | |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
models.Prompt
| Error Type | Status Code | Content Type |
|---|
| errors.SDKError | 4XX, 5XX | */* |
UpdatePromptVersionMetadata
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.prompts.update_version_metadata(prompt_id="<id>", version=1)
# Handle response
print(res)
| Parameter | Type | Required | Description | Example |
|---|
prompt_id | str | :heavy_check_mark: | N/A | |
version | int | :heavy_check_mark: | N/A | 1 |
notes | OptionalNullable[str] | :heavy_minus_sign: | Notes for this version. | |
aliases | Optional[models.AliasList] | :heavy_minus_sign: | Presence wrapper for a set of alias labels on update RPCs. As a message field it carries presence, so callers can distinguish "leave aliases unchanged" (field omitted) from "clear all aliases" (field set, empty values). | |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
models.Prompt
| Error Type | Status Code | Content Type |
|---|
| errors.SDKError | 4XX, 5XX | */* |