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] |
β |
N/A |
page_token |
Optional[str] |
β |
N/A |
alias |
Optional[str] |
β |
N/A |
fields |
List[str] |
β |
N/A |
retries |
Optional[utils.RetryConfig] |
β |
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 |
βοΈ |
Stable object name. |
definition |
models.PromptDefinition |
βοΈ |
Versioned prompt content. |
title |
OptionalNullable[str] |
β |
Display title. |
description |
OptionalNullable[str] |
β |
Display description. |
notes |
OptionalNullable[str] |
β |
Notes for this version. |
sharing_scope |
Optional[models.RegistrySharingScope] |
β |
N/A |
aliases |
List[str] |
β |
Aliases pointing to this version. |
retries |
Optional[utils.RetryConfig] |
β |
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 |
βοΈ |
N/A |
|
version |
Optional[int] |
β |
N/A |
1 |
alias |
Optional[str] |
β |
N/A |
|
fields |
List[str] |
β |
N/A |
|
retries |
Optional[utils.RetryConfig] |
β |
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 |
βοΈ |
N/A |
retries |
Optional[utils.RetryConfig] |
β |
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 |
βοΈ |
N/A |
title |
OptionalNullable[str] |
β |
Display title. |
description |
OptionalNullable[str] |
β |
Display description. |
sharing_scope |
Optional[models.RegistrySharingScope] |
β |
N/A |
retries |
Optional[utils.RetryConfig] |
β |
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 |
βοΈ |
N/A |
retries |
Optional[utils.RetryConfig] |
β |
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 |
βοΈ |
N/A |
definition |
models.PromptDefinition |
βοΈ |
Versioned prompt content. |
notes |
OptionalNullable[str] |
β |
Notes for this version. |
aliases |
List[str] |
β |
Aliases pointing to this version. |
retries |
Optional[utils.RetryConfig] |
β |
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 |
βοΈ |
N/A |
|
version |
int |
βοΈ |
N/A |
1 |
fields |
List[str] |
β |
N/A |
|
retries |
Optional[utils.RetryConfig] |
β |
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 |
βοΈ |
N/A |
|
version |
int |
βοΈ |
N/A |
1 |
notes |
OptionalNullable[str] |
β |
Notes for this version. |
|
aliases |
Optional[models.AliasList] |
β |
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] |
β |
Configuration to override the default retry behavior of the client. |
|
models.Prompt
| Error Type |
Status Code |
Content Type |
| errors.SDKError |
4XX, 5XX |
*/* |