Mistral AI API | Mistral AI Large Language Models (original) (raw)
Mistral AI API (1.0.0)
Download OpenAPI specification:Download
Our Chat Completion and Embeddings APIs specification. Create your account on La Plateforme to get access and read the docs to learn how to use it.
Chat
Chat Completion
Request Body schema: application/json
required
modelrequired | string (Model) ID of the model to use. You can use the List Available Models API to see all of your available models, or see our Model overview for model descriptions. |
---|---|
Temperature (number) or Temperature (null) (Temperature) What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both. The default value varies depending on the model you are targeting. Call the /models endpoint to retrieve the appropriate value. | |
top_p | number (Top P) [ 0 .. 1 ] Default: 1 Nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both. |
Max Tokens (integer) or Max Tokens (null) (Max Tokens) The maximum number of tokens to generate in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length. | |
stream | boolean (Stream) Default: false Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON. |
Stop (string) or Array of Stop (strings) (Stop) Stop generation if this token is detected. Or if one of these tokens is detected when providing an array | |
Random Seed (integer) or Random Seed (null) (Random Seed) The seed to use for random sampling. If set, different calls will generate deterministic results. | |
required | Array of any (Messages) The prompt(s) to generate completions for, encoded as a list of dict with role and content. |
object (ResponseFormat) | |
Array of Tools (objects) or Tools (null) (Tools) | |
ToolChoice (object) or ToolChoiceEnum (string) (Tool Choice) Default: "auto" | |
presence_penalty | number (Presence Penalty) [ -2 .. 2 ] Default: 0 presence_penalty determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative. |
frequency_penalty | number (Frequency Penalty) [ -2 .. 2 ] Default: 0 frequency_penalty penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition. |
N (integer) or N (null) (N) Number of completions to return for each request, input tokens are only billed once. | |
object (Prediction) Default: {"type":"content","content":""} Enable users to specify expected results, optimizing response times by leveraging known or predictable content. This approach is especially effective for updating text documents or code files with minimal changes, reducing latency while maintaining high-quality results. | |
parallel_tool_calls | boolean (Parallel Tool Calls) Default: true |
safe_prompt | boolean Default: false Whether to inject a safety prompt before all conversations. |
Responses
Request samples
- Payload
Content type
application/json
`{
- "model": "mistral-small-latest",
- "temperature": 1.5,
- "top_p": 1,
- "max_tokens": 0,
- "stream": false,
- "stop": "string",
- "random_seed": 0,
- "messages": [
- {
* "role": "user",
* "content": "Who is the best French painter? Answer in one short sentence."
}
], - {
- "response_format": {
- "type": "text",
- "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
}, - "tools": [
- {
* "type": "function",
* "function": {
* "name": "string",
* "description": "",
* "strict": false,
* "parameters": { }
}
}
], - {
- "tool_choice": "auto",
- "presence_penalty": 0,
- "frequency_penalty": 0,
- "n": 1,
- "prediction": {
- "type": "content",
- "content": ""
},
- "parallel_tool_calls": true,
- "safe_prompt": false }`
Response samples
- 200
- 422
`{
- "id": "cmpl-e5cc70bb28c444948073e77776eb30ef",
- "object": "chat.completion",
- "model": "mistral-small-latest",
- "usage": {
- "prompt_tokens": 16,
- "completion_tokens": 34,
- "total_tokens": 50
},
- "created": 1702256327,
- "choices": [
- {
* "index": 0,
* "message": {
* "content": "string",
* "tool_calls": [
* {
* "id": "null",
* "type": "function",
* "function": {
* "name": "string",
* "arguments": { }
},
* "index": 0
}
],
* "prefix": false,
* "role": "assistant"
},
* "finish_reason": "stop"
}
] }` - {
FIM
Fim Completion
Request Body schema: application/json
required
modelrequired | string (Model) Default: "codestral-2405" ID of the model to use. Only compatible for now with: codestral-2405 codestral-latest |
---|---|
Temperature (number) or Temperature (null) (Temperature) What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both. The default value varies depending on the model you are targeting. Call the /models endpoint to retrieve the appropriate value. | |
top_p | number (Top P) [ 0 .. 1 ] Default: 1 Nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both. |
Max Tokens (integer) or Max Tokens (null) (Max Tokens) The maximum number of tokens to generate in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length. | |
stream | boolean (Stream) Default: false Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON. |
Stop (string) or Array of Stop (strings) (Stop) Stop generation if this token is detected. Or if one of these tokens is detected when providing an array | |
Random Seed (integer) or Random Seed (null) (Random Seed) The seed to use for random sampling. If set, different calls will generate deterministic results. | |
promptrequired | string (Prompt) The text/code to complete. |
Suffix (string) or Suffix (null) (Suffix) Default: "" Optional text/code that adds more context for the model. When given a prompt and a suffix the model will fill what is between them. When suffix is not provided, the model will simply execute completion starting with prompt. | |
Min Tokens (integer) or Min Tokens (null) (Min Tokens) The minimum number of tokens to generate in the completion. |
Responses
Request samples
- Payload
Content type
application/json
`{
- "model": "codestral-2405",
- "temperature": 1.5,
- "top_p": 1,
- "max_tokens": 0,
- "stream": false,
- "stop": "string",
- "random_seed": 0,
- "prompt": "def",
- "suffix": "return a+b",
- "min_tokens": 0 }`
Response samples
- 200
- 422
`{
- "id": "cmpl-e5cc70bb28c444948073e77776eb30ef",
- "object": "chat.completion",
- "model": "codestral-latest",
- "usage": {
- "prompt_tokens": 16,
- "completion_tokens": 34,
- "total_tokens": 50
},
- "created": 1702256327,
- "choices": [
- {
* "index": 0,
* "message": {
* "content": "string",
* "tool_calls": [
* {
* "id": "null",
* "type": "function",
* "function": {
* "name": "string",
* "arguments": { }
},
* "index": 0
}
],
* "prefix": false,
* "role": "assistant"
},
* "finish_reason": "stop"
}
] }` - {
Agents
Agents Completion
Request Body schema: application/json
required
Max Tokens (integer) or Max Tokens (null) (Max Tokens) The maximum number of tokens to generate in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length. | |
---|---|
stream | boolean (Stream) Default: false Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON. |
Stop (string) or Array of Stop (strings) (Stop) Stop generation if this token is detected. Or if one of these tokens is detected when providing an array | |
Random Seed (integer) or Random Seed (null) (Random Seed) The seed to use for random sampling. If set, different calls will generate deterministic results. | |
required | Array of any (Messages) The prompt(s) to generate completions for, encoded as a list of dict with role and content. |
object (ResponseFormat) | |
Array of Tools (objects) or Tools (null) (Tools) | |
ToolChoice (object) or ToolChoiceEnum (string) (Tool Choice) Default: "auto" | |
presence_penalty | number (Presence Penalty) [ -2 .. 2 ] Default: 0 presence_penalty determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative. |
frequency_penalty | number (Frequency Penalty) [ -2 .. 2 ] Default: 0 frequency_penalty penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition. |
N (integer) or N (null) (N) Number of completions to return for each request, input tokens are only billed once. | |
object (Prediction) Default: {"type":"content","content":""} Enable users to specify expected results, optimizing response times by leveraging known or predictable content. This approach is especially effective for updating text documents or code files with minimal changes, reducing latency while maintaining high-quality results. | |
parallel_tool_calls | boolean (Parallel Tool Calls) Default: true |
agent_idrequired | string The ID of the agent to use for this completion. |
Responses
Request samples
- Payload
Content type
application/json
`{
- "max_tokens": 0,
- "stream": false,
- "stop": "string",
- "random_seed": 0,
- "messages": [
- {
* "role": "user",
* "content": "Who is the best French painter? Answer in one short sentence."
}
], - {
- "response_format": {
- "type": "text",
- "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
}, - "tools": [
- {
* "type": "function",
* "function": {
* "name": "string",
* "description": "",
* "strict": false,
* "parameters": { }
}
}
], - {
- "tool_choice": "auto",
- "presence_penalty": 0,
- "frequency_penalty": 0,
- "n": 1,
- "prediction": {
- "type": "content",
- "content": ""
},
- "parallel_tool_calls": true,
- "agent_id": "string" }`
Response samples
- 200
- 422
Content type
application/json
`{
- "id": "cmpl-e5cc70bb28c444948073e77776eb30ef",
- "object": "chat.completion",
- "model": "mistral-small-latest",
- "usage": {
- "prompt_tokens": 16,
- "completion_tokens": 34,
- "total_tokens": 50
},
- "created": 1702256327,
- "choices": [
- {
* "index": 0,
* "message": {
* "content": "string",
* "tool_calls": [
* {
* "id": "null",
* "type": "function",
* "function": {
* "name": "string",
* "arguments": { }
},
* "index": 0
}
],
* "prefix": false,
* "role": "assistant"
},
* "finish_reason": "stop"
}
] }` - {
Embeddings
Embeddings
Request Body schema: application/json
required
modelrequired | |
---|---|
required | Input (string) or Array of Input (strings) (Input) |
Output Dimension (integer) or Output Dimension (null) (Output Dimension) The dimension of the output embeddings. | |
output_dtype | string (EmbeddingDtype) Default: "float" Enum: "float" "int8" "uint8" "binary" "ubinary" The data type of the output embeddings. |
Responses
Request samples
- Payload
Content type
application/json
`{
- "model": "mistral-embed",
- "input": [
- "Embed this sentence.",
- "As well as this one."
],
- "output_dimension": 0,
- "output_dtype": "float" }`
Response samples
- 200
- 422
Content type
application/json
`{
- "id": "cmpl-e5cc70bb28c444948073e77776eb30ef",
- "object": "chat.completion",
- "model": "mistral-small-latest",
- "usage": {
- "prompt_tokens": 16,
- "completion_tokens": 34,
- "total_tokens": 50
},
- "data": [
- {
* "object": "embedding",
* "embedding": [
* 0.1,
* 0.2,
* 0.3
],
* "index": 0
}
] }` - {
Classifiers
Moderations
Request Body schema: application/json
required
modelrequired | |
---|---|
required | Input (string) or Array of Input (strings) (Input) |
Responses
Request samples
- Payload
Content type
application/json
`{
- "model": "string",
- "input": "string" }`
Response samples
- 200
- 422
Content type
application/json
`{
- "id": "mod-e5cc70bb28c444948073e77776eb30ef",
- "model": "string",
- "results": [
- {
* "categories": {
* "property1": true,
* "property2": true
},
* "category_scores": {
* "property1": 0,
* "property2": 0
}
}
] }` - {
Chat Moderations
Request Body schema: application/json
required
required | Array of Input (any) or Array of Input (any) (Input) |
---|---|
modelrequired |
Responses
Request samples
- Payload
Content type
application/json
`{
- "input": [
- {
* "content": "string",
* "role": "system"
}
], - {
- "model": "string" }`
Response samples
- 200
- 422
Content type
application/json
`{
- "id": "mod-e5cc70bb28c444948073e77776eb30ef",
- "model": "string",
- "results": [
- {
* "categories": {
* "property1": true,
* "property2": true
},
* "category_scores": {
* "property1": 0,
* "property2": 0
}
}
] }` - {
Classifications
Request Body schema: application/json
required
modelrequired | |
---|---|
required | Input (string) or Array of Input (strings) (Input) |
Responses
Request samples
- Payload
Content type
application/json
`{
- "model": "string",
- "input": "string" }`
Response samples
- 200
- 422
Content type
application/json
`{
- "id": "mod-e5cc70bb28c444948073e77776eb30ef",
- "model": "string",
- "results": [
- {
* "property1": {
* "scores": {
* "property1": 0,
* "property2": 0
}
},
* "property2": {
* "scores": {
* "property1": 0,
* "property2": 0
}
}
}
] }` - {
Chat Classifications
Request Body schema: application/json
required
modelrequired | |
---|---|
required | InstructRequest (object) or Array of ChatClassificationRequestInputs (objects) (ChatClassificationRequestInputs) |
Responses
Request samples
- Payload
Content type
application/json
`{
- "model": "string",
- "input": {
- "messages": [
* {
* "content": "string",
* "role": "system"
}
]
} }` - "messages": [
Response samples
- 200
- 422
Content type
application/json
`{
- "id": "mod-e5cc70bb28c444948073e77776eb30ef",
- "model": "string",
- "results": [
- {
* "property1": {
* "scores": {
* "property1": 0,
* "property2": 0
}
},
* "property2": {
* "scores": {
* "property1": 0,
* "property2": 0
}
}
}
] }` - {
Files
Upload File
Upload a file that can be used across various endpoints.
The size of individual files can be a maximum of 512 MB. The Fine-tuning API only supports .jsonl files.
Please contact us if you need to increase these storage limits.
Request Body schema: multipart/form-data
required
filerequired | string <binary> (File) The File object (not file name) to be uploaded. To upload a file and specify a custom file name you should format your request as such: file=@path/to/your/file.jsonl;filename=custom_name.jsonl Otherwise, you can just keep the original file name: file=@path/to/your/file.jsonl |
---|---|
purpose | string (FilePurpose) Enum: "fine-tune" "batch" "ocr" |
Responses
Response samples
- 200
Content type
application/json
`{
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f09",
- "object": "file",
- "bytes": 13000,
- "created_at": 1716963433,
- "filename": "files_upload.jsonl",
- "purpose": "fine-tune",
- "sample_type": "pretrain",
- "num_lines": 0,
- "source": "upload" }`
List Files
Returns a list of files that belong to the user's organization.
query Parameters
page | integer (Page) Default: 0 |
---|---|
page_size | integer (Page Size) Default: 100 |
Array of Sample Type (strings) or Sample Type (null) (Sample Type) | |
Array of Source (strings) or Source (null) (Source) | |
Search (string) or Search (null) (Search) | |
FilePurpose (string) or null |
Responses
Response samples
- 200
Content type
application/json
`{
- "data": [
- {
* "id": "497f6eca-6276-4993-bfeb-53cbbbba6f09",
* "object": "file",
* "bytes": 13000,
* "created_at": 1716963433,
* "filename": "files_upload.jsonl",
* "purpose": "fine-tune",
* "sample_type": "pretrain",
* "num_lines": 0,
* "source": "upload"
}
], - {
- "object": "string",
- "total": 0 }`
Retrieve File
Returns information about a specific file.
path Parameters
file_idrequired |
---|
Responses
Response samples
- 200
Content type
application/json
`{
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f09",
- "object": "file",
- "bytes": 13000,
- "created_at": 1716963433,
- "filename": "files_upload.jsonl",
- "purpose": "fine-tune",
- "sample_type": "pretrain",
- "num_lines": 0,
- "source": "upload",
- "deleted": true }`
Delete File
path Parameters
file_idrequired |
---|
Responses
Response samples
- 200
Content type
application/json
`{
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f09",
- "object": "file",
- "deleted": false }`
Download File
path Parameters
file_idrequired |
---|
Responses
Get Signed Url
path Parameters
file_idrequired |
---|
query Parameters
expiry | integer (Expiry) Default: 24 Number of hours before the url becomes invalid. Defaults to 24h |
---|
Responses
Response samples
- 200
Content type
application/json
Fine Tuning
Get Fine Tuning Jobs
Get a list of fine-tuning jobs for your organization and user.
query Parameters
page | integer (Page) Default: 0 The page number of the results to be returned. |
---|---|
page_size | integer (Page Size) Default: 100 The number of items to return per page. |
Model (string) or Model (null) (Model) The model name used for fine-tuning to filter on. When set, the other results are not displayed. | |
Created After (string) or Created After (null) (Created After) The date/time to filter on. When set, the results for previous creation times are not displayed. | |
Created Before (string) or Created Before (null) (Created Before) | |
created_by_me | boolean (Created By Me) Default: false When set, only return results for jobs created by the API caller. Other results are not displayed. |
Status (string) or Status (null) (Status) The current job state to filter on. When set, the other results are not displayed. | |
Wandb Project (string) or Wandb Project (null) (Wandb Project) The Weights and Biases project to filter on. When set, the other results are not displayed. | |
Wandb Name (string) or Wandb Name (null) (Wandb Name) The Weight and Biases run name to filter on. When set, the other results are not displayed. | |
Suffix (string) or Suffix (null) (Suffix) The model suffix to filter on. When set, the other results are not displayed. |
Responses
Response samples
- 200
Content type
application/json
`{
- "data": [ ],
- "object": "list",
- "total": 0 }`
Create Fine Tuning Job
Create a new fine-tuning job, it will be queued for processing.
query Parameters
Dry Run (boolean) or Dry Run (null) (Dry Run) If true the job is not spawned, instead the query returns a handful of useful metadata for the user to perform sanity checks (see LegacyJobMetadataOut response). Otherwise, the job is started and the query returns the job ID along with some of the input parameters (see JobOut response). |
---|
Request Body schema: application/json
required
modelrequired | string (FineTuneableModel) Enum: "open-mistral-7b" "mistral-small-latest" "codestral-latest" "mistral-large-latest" "open-mistral-nemo" "ministral-3b-latest" "ministral-8b-latest" The name of the model to fine-tune. |
---|---|
Array of objects (Training Files) Default: [] | |
Array of Validation Files (strings) or Validation Files (null) (Validation Files) A list containing the IDs of uploaded files that contain validation data. If you provide these files, the data is used to generate validation metrics periodically during fine-tuning. These metrics can be viewed in checkpoints when getting the status of a running fine-tuning job. The same data should not be present in both train and validation files. | |
Suffix (string) or Suffix (null) (Suffix) A string that will be added to your fine-tuning model name. For example, a suffix of "my-great-model" would produce a model name like ft:open-mistral-7b:my-great-model:xxx... | |
Array of Integrations (any) or Integrations (null) (Integrations) A list of integrations to enable for your fine-tuning job. | |
auto_start | boolean (Auto Start) This field will be required in a future release. |
invalid_sample_skip_percentage | number (Invalid Sample Skip Percentage) [ 0 .. 0.5 ] Default: 0 |
FineTuneableModelType (string) or null | |
required | CompletionTrainingParametersIn (object) or ClassifierTrainingParametersIn (object) (Hyperparameters) |
Array of Repositories (any) or Repositories (null) (Repositories) | |
Array of Classifier Targets (objects) or Classifier Targets (null) (Classifier Targets) |
Responses
Request samples
- Payload
Content type
application/json
`{
- "model": "open-mistral-7b",
- "training_files": [ ],
- "validation_files": [
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
- "suffix": "string",
- "integrations": [
- {
* "type": "wandb",
* "project": "string",
* "name": "string",
* "api_key": "stringstringstringstringstringstringstri",
* "run_name": "string"
}
], - {
- "auto_start": true,
- "invalid_sample_skip_percentage": 0,
- "job_type": "completion",
- "hyperparameters": {
- "training_steps": 1,
- "learning_rate": 0.0001,
- "weight_decay": 0.1,
- "warmup_fraction": 0.05,
- "epochs": 0,
- "seq_len": 100,
- "fim_ratio": 0.9
},
- "repositories": [
- {
* "type": "github",
* "name": "string",
* "owner": "string",
* "ref": "string",
* "weight": 1,
* "token": "string"
}
], - {
- "classifier_targets": [
- {
* "name": "string",
* "weight": 1,
* "loss_function": "single_class"
}
] }` - {
Response samples
- 200
Content type
application/json
`{
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "auto_start": true,
- "model": "open-mistral-7b",
- "status": "QUEUED",
- "created_at": 0,
- "modified_at": 0,
- "training_files": [
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
- "validation_files": [ ],
- "object": "job",
- "fine_tuned_model": "string",
- "suffix": "string",
- "integrations": [
- {
* "type": "wandb",
* "project": "string",
* "name": "string",
* "run_name": "string",
* "url": "string"
}
], - {
- "trained_tokens": 0,
- "metadata": {
- "expected_duration_seconds": 0,
- "cost": 0,
- "cost_currency": "string",
- "train_tokens_per_step": 0,
- "train_tokens": 0,
- "data_tokens": 0,
- "estimated_start_time": 0
},
- "job_type": "completion",
- "hyperparameters": {
- "training_steps": 1,
- "learning_rate": 0.0001,
- "weight_decay": 0.1,
- "warmup_fraction": 0.05,
- "epochs": 0,
- "seq_len": 100,
- "fim_ratio": 0.9
},
- "repositories": [ ] }`
Get Fine Tuning Job
Get a fine-tuned job details by its UUID.
path Parameters
job_idrequired | string <uuid> (Job Id) The ID of the job to analyse. |
---|
Responses
Response samples
- 200
Content type
application/json
`{
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "auto_start": true,
- "model": "open-mistral-7b",
- "status": "QUEUED",
- "created_at": 0,
- "modified_at": 0,
- "training_files": [
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
- "validation_files": [ ],
- "object": "job",
- "fine_tuned_model": "string",
- "suffix": "string",
- "integrations": [
- {
* "type": "wandb",
* "project": "string",
* "name": "string",
* "run_name": "string",
* "url": "string"
}
], - {
- "trained_tokens": 0,
- "metadata": {
- "expected_duration_seconds": 0,
- "cost": 0,
- "cost_currency": "string",
- "train_tokens_per_step": 0,
- "train_tokens": 0,
- "data_tokens": 0,
- "estimated_start_time": 0
},
- "job_type": "classifier",
- "hyperparameters": {
- "training_steps": 1,
- "learning_rate": 0.0001,
- "weight_decay": 0.1,
- "warmup_fraction": 0.05,
- "epochs": 0,
- "seq_len": 100
},
- "events": [ ],
- "checkpoints": [ ],
- "classifier_targets": [
- {
* "name": "string",
* "weight": 0,
* "loss_function": "single_class"
}
] }` - {
Cancel Fine Tuning Job
Request the cancellation of a fine tuning job.
path Parameters
job_idrequired | string <uuid> (Job Id) The ID of the job to cancel. |
---|
Responses
Response samples
- 200
Content type
application/json
`{
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "auto_start": true,
- "model": "open-mistral-7b",
- "status": "QUEUED",
- "created_at": 0,
- "modified_at": 0,
- "training_files": [
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
- "validation_files": [ ],
- "object": "job",
- "fine_tuned_model": "string",
- "suffix": "string",
- "integrations": [
- {
* "type": "wandb",
* "project": "string",
* "name": "string",
* "run_name": "string",
* "url": "string"
}
], - {
- "trained_tokens": 0,
- "metadata": {
- "expected_duration_seconds": 0,
- "cost": 0,
- "cost_currency": "string",
- "train_tokens_per_step": 0,
- "train_tokens": 0,
- "data_tokens": 0,
- "estimated_start_time": 0
},
- "job_type": "classifier",
- "hyperparameters": {
- "training_steps": 1,
- "learning_rate": 0.0001,
- "weight_decay": 0.1,
- "warmup_fraction": 0.05,
- "epochs": 0,
- "seq_len": 100
},
- "events": [ ],
- "checkpoints": [ ],
- "classifier_targets": [
- {
* "name": "string",
* "weight": 0,
* "loss_function": "single_class"
}
] }` - {
Start Fine Tuning Job
Request the start of a validated fine tuning job.
path Parameters
job_idrequired |
---|
Responses
Response samples
- 200
Content type
application/json
`{
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "auto_start": true,
- "model": "open-mistral-7b",
- "status": "QUEUED",
- "created_at": 0,
- "modified_at": 0,
- "training_files": [
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
- "validation_files": [ ],
- "object": "job",
- "fine_tuned_model": "string",
- "suffix": "string",
- "integrations": [
- {
* "type": "wandb",
* "project": "string",
* "name": "string",
* "run_name": "string",
* "url": "string"
}
], - {
- "trained_tokens": 0,
- "metadata": {
- "expected_duration_seconds": 0,
- "cost": 0,
- "cost_currency": "string",
- "train_tokens_per_step": 0,
- "train_tokens": 0,
- "data_tokens": 0,
- "estimated_start_time": 0
},
- "job_type": "classifier",
- "hyperparameters": {
- "training_steps": 1,
- "learning_rate": 0.0001,
- "weight_decay": 0.1,
- "warmup_fraction": 0.05,
- "epochs": 0,
- "seq_len": 100
},
- "events": [ ],
- "checkpoints": [ ],
- "classifier_targets": [
- {
* "name": "string",
* "weight": 0,
* "loss_function": "single_class"
}
] }` - {
List Models
List all models available to the user.
Responses
Response samples
- 200
- 422
Content type
application/json
`{
- "object": "list",
- "data": [
- {
* "id": "string",
* "object": "model",
* "created": 0,
* "owned_by": "mistralai",
* "capabilities": {
* "completion_chat": true,
* "completion_fim": false,
* "function_calling": true,
* "fine_tuning": false,
* "vision": false
},
* "name": "string",
* "description": "string",
* "max_context_length": 32768,
* "aliases": [ ],
* "deprecation": "2019-08-24T14:15:22Z",
* "default_model_temperature": 0,
* "type": "base"
}
] }` - {
Retrieve Model
Retrieve a model information.
path Parameters
model_idrequired | string (Model Id) Example: ft:open-mistral-7b:587a6b29:20240514:7e773925The ID of the model to retrieve. |
---|
Responses
Response samples
- 200
- 422
Content type
application/json
`{
- "id": "string",
- "object": "model",
- "created": 0,
- "owned_by": "mistralai",
- "capabilities": {
- "completion_chat": true,
- "completion_fim": false,
- "function_calling": true,
- "fine_tuning": false,
- "vision": false
},
- "name": "string",
- "description": "string",
- "max_context_length": 32768,
- "aliases": [ ],
- "deprecation": "2019-08-24T14:15:22Z",
- "default_model_temperature": 0,
- "type": "base" }`
Delete Model
Delete a fine-tuned model.
path Parameters
model_idrequired | string (Model Id) Example: ft:open-mistral-7b:587a6b29:20240514:7e773925The ID of the model to delete. |
---|
Responses
Response samples
- 200
- 422
Content type
application/json
`{
- "id": "ft:open-mistral-7b:587a6b29:20240514:7e773925",
- "object": "model",
- "deleted": true }`
Update Fine Tuned Model
Update a model name or description.
path Parameters
model_idrequired | string (Model Id) Example: ft:open-mistral-7b:587a6b29:20240514:7e773925The ID of the model to update. |
---|
Request Body schema: application/json
required
Name (string) or Name (null) (Name) |
---|
Description (string) or Description (null) (Description) |
Responses
Request samples
- Payload
Content type
application/json
`{
- "name": "string",
- "description": "string" }`
Response samples
- 200
Content type
application/json
`{
- "id": "string",
- "object": "model",
- "created": 0,
- "owned_by": "string",
- "root": "string",
- "archived": true,
- "name": "string",
- "description": "string",
- "capabilities": {
- "completion_chat": true,
- "completion_fim": false,
- "function_calling": false,
- "fine_tuning": false,
- "classification": false
},
- "max_context_length": 32768,
- "aliases": [ ],
- "job": "4bbaedb0-902b-4b27-8218-8f40d3470a54",
- "classifier_targets": [
- {
* "name": "string",
* "weight": 0,
* "loss_function": "single_class"
}
], - {
- "model_type": "classifier" }`
Archive Fine Tuned Model
Archive a fine-tuned model.
path Parameters
model_idrequired | string (Model Id) Example: ft:open-mistral-7b:587a6b29:20240514:7e773925The ID of the model to archive. |
---|
Responses
Response samples
- 200
Content type
application/json
`{
- "id": "string",
- "object": "model",
- "archived": true }`
Unarchive Fine Tuned Model
Un-archive a fine-tuned model.
path Parameters
model_idrequired | string (Model Id) Example: ft:open-mistral-7b:587a6b29:20240514:7e773925The ID of the model to unarchive. |
---|
Responses
Response samples
- 200
Content type
application/json
`{
- "id": "string",
- "object": "model",
- "archived": false }`
Batch
Get Batch Jobs
Get a list of batch jobs for your organization and user.
query Parameters
page | integer (Page) Default: 0 |
---|---|
page_size | integer (Page Size) Default: 100 |
Model (string) or Model (null) (Model) | |
Metadata (object) or Metadata (null) (Metadata) | |
Created After (string) or Created After (null) (Created After) | |
created_by_me | boolean (Created By Me) Default: false |
Array of Status (strings) or Status (null) (Status) |
Responses
Response samples
- 200
Content type
application/json
`{
- "data": [ ],
- "object": "list",
- "total": 0 }`
Create Batch Job
Create a new batch job, it will be queued for processing.
Request Body schema: application/json
required
input_filesrequired | Array of strings <uuid> (Input Files) [ items <uuid > ] |
---|---|
endpointrequired | string (ApiEndpoint) Enum: "/v1/chat/completions" "/v1/embeddings" "/v1/fim/completions" "/v1/moderations" "/v1/chat/moderations" |
modelrequired | |
Metadata (object) or Metadata (null) (Metadata) | |
timeout_hours | integer (Timeout Hours) Default: 24 |
Responses
Request samples
- Payload
Content type
application/json
`{
- "input_files": [
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
- "endpoint": "/v1/chat/completions",
- "model": "string",
- "metadata": {
- "property1": "string",
- "property2": "string"
},
- "timeout_hours": 24 }`
Response samples
- 200
Content type
application/json
`{
- "id": "string",
- "object": "batch",
- "input_files": [
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
- "metadata": { },
- "endpoint": "string",
- "model": "string",
- "output_file": "c7c9cb17-f818-4ee3-85de-0d2f8954882c",
- "error_file": "6b79e6a4-c3aa-4da1-8fb4-9e2520d26bfa",
- "errors": [
- {
* "message": "string",
* "count": 1
}
], - {
- "status": "QUEUED",
- "created_at": 0,
- "total_requests": 0,
- "completed_requests": 0,
- "succeeded_requests": 0,
- "failed_requests": 0,
- "started_at": 0,
- "completed_at": 0 }`
Get Batch Job
Get a batch job details by its UUID.
path Parameters
job_idrequired |
---|
Responses
Response samples
- 200
Content type
application/json
`{
- "id": "string",
- "object": "batch",
- "input_files": [
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
- "metadata": { },
- "endpoint": "string",
- "model": "string",
- "output_file": "c7c9cb17-f818-4ee3-85de-0d2f8954882c",
- "error_file": "6b79e6a4-c3aa-4da1-8fb4-9e2520d26bfa",
- "errors": [
- {
* "message": "string",
* "count": 1
}
], - {
- "status": "QUEUED",
- "created_at": 0,
- "total_requests": 0,
- "completed_requests": 0,
- "succeeded_requests": 0,
- "failed_requests": 0,
- "started_at": 0,
- "completed_at": 0 }`
Cancel Batch Job
Request the cancellation of a batch job.
path Parameters
job_idrequired |
---|
Responses
Response samples
- 200
Content type
application/json
`{
- "id": "string",
- "object": "batch",
- "input_files": [
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
- "497f6eca-6276-4993-bfeb-53cbbbba6f08"
- "metadata": { },
- "endpoint": "string",
- "model": "string",
- "output_file": "c7c9cb17-f818-4ee3-85de-0d2f8954882c",
- "error_file": "6b79e6a4-c3aa-4da1-8fb4-9e2520d26bfa",
- "errors": [
- {
* "message": "string",
* "count": 1
}
], - {
- "status": "QUEUED",
- "created_at": 0,
- "total_requests": 0,
- "completed_requests": 0,
- "succeeded_requests": 0,
- "failed_requests": 0,
- "started_at": 0,
- "completed_at": 0 }`
OCR API
OCR
Request Body schema: application/json
required
required | Model (string) or Model (null) (Model) |
---|---|
id | string (Id) |
required | DocumentURLChunk (object) or ImageURLChunk (object) (Document) Document to run OCR on |
Array of Pages (integers) or Pages (null) (Pages) Specific pages user wants to process in various formats: single number, range, or list of both. Starts from 0 | |
Include Image Base64 (boolean) or Include Image Base64 (null) (Include Image Base64) Include image URLs in response | |
Image Limit (integer) or Image Limit (null) (Image Limit) Max images to extract | |
Image Min Size (integer) or Image Min Size (null) (Image Min Size) Minimum height and width of image to extract | |
ResponseFormat (object) or null Structured output class for extracting useful information from each extracted bounding box / image from document. Only json_schema is valid for this field | |
ResponseFormat (object) or null Structured output class for extracting useful information from the entire document. Only json_schema is valid for this field |
Responses
Request samples
- Payload
Content type
application/json
`{
- "model": "string",
- "id": "string",
- "document": {
- "document_url": "string",
- "document_name": "string",
- "type": "document_url"
},
- "pages": [
- 0
],
- 0
- "include_image_base64": true,
- "image_limit": 0,
- "image_min_size": 0,
- "bbox_annotation_format": {
- "type": "text",
- "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
}, - "document_annotation_format": {
- "type": "text",
- "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
} }`
Response samples
- 200
- 422
Content type
application/json
`{
- "pages": [
- {
* "index": 0,
* "markdown": "string",
* "images": [
* {
* "id": "string",
* "top_left_x": 0,
* "top_left_y": 0,
* "bottom_right_x": 0,
* "bottom_right_y": 0,
* "image_base64": "string",
* "image_annotation": "string"
}
],
* "dimensions": {
* "dpi": 0,
* "height": 0,
* "width": 0
}
}
], - {
- "model": "string",
- "document_annotation": "string",
- "usage_info": {
- "pages_processed": 0,
- "doc_size_bytes": 0
} }`
(beta) Agents API
Create a agent that can be used within a conversation.
Create a new agent giving it instructions, tools, description. The agent is then available to be used as a regular assistant in a conversation or as part of an agent pool from which it can be used.
Request Body schema: application/json
required
Instructions (string) or Instructions (null) (Instructions) Instruction prompt the model will follow during the conversation. | |
---|---|
Array of any (Tools) List of tools which are available to the model during the conversation. | |
object (CompletionArgs) Completion arguments that will be used to generate assistant responses. Can be overridden at each message request. | |
modelrequired | string (Model) |
namerequired | string (Name) |
Description (string) or Description (null) (Description) | |
Array of Handoffs (strings) or Handoffs (null) (Handoffs) |
Responses
Request samples
- Payload
Content type
application/json
`{
- "instructions": "string",
- "tools": [
- {
* "type": "function",
* "function": {
* "name": "string",
* "description": "",
* "strict": false,
* "parameters": { }
}
}
], - {
- "completion_args": {
- "stop": "string",
- "presence_penalty": -2,
- "frequency_penalty": -2,
- "temperature": 0.3,
- "top_p": 1,
- "max_tokens": 0,
- "random_seed": 0,
- "prediction": {
* "type": "content",
* "content": ""
},
- "response_format": {
* "type": "text",
* "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
},
- "tool_choice": "auto"
},
- "model": "string",
- "name": "string",
- "description": "string",
- "handoffs": [
- "string"
] }`
- "string"
Response samples
- 200
- 422
Content type
application/json
`{
- "instructions": "string",
- "tools": [
- {
* "type": "function",
* "function": {
* "name": "string",
* "description": "",
* "strict": false,
* "parameters": { }
}
}
], - {
- "completion_args": {
- "stop": "string",
- "presence_penalty": -2,
- "frequency_penalty": -2,
- "temperature": 0.3,
- "top_p": 1,
- "max_tokens": 0,
- "random_seed": 0,
- "prediction": {
* "type": "content",
* "content": ""
},
- "response_format": {
* "type": "text",
* "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
},
- "tool_choice": "auto"
},
- "model": "string",
- "name": "string",
- "description": "string",
- "handoffs": [
- "string"
],
- "string"
- "object": "agent",
- "id": "string",
- "version": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z" }`
List agent entities.
Retrieve a list of agent entities sorted by creation time.
query Parameters
page | integer (Page) Default: 0 |
---|---|
page_size | integer (Page Size) Default: 20 |
Responses
Response samples
- 200
- 422
Content type
application/json
`[
- {
- "instructions": "string",
- "tools": [
* {
* "type": "function",
* "function": {
* "name": "string",
* "description": "",
* "strict": false,
* "parameters": { }
}
}
],
- "completion_args": {
* "stop": "string",
* "presence_penalty": -2,
* "frequency_penalty": -2,
* "temperature": 0.3,
* "top_p": 1,
* "max_tokens": 0,
* "random_seed": 0,
* "prediction": {
* "type": "content",
* "content": ""
},
* "response_format": {
* "type": "text",
* "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
},
* "tool_choice": "auto"
},
- "model": "string",
- "name": "string",
- "description": "string",
- "object": "agent",
- "id": "string",
- "version": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
} ]`
Retrieve an agent entity.
Given an agent retrieve an agent entity with its attributes.
path Parameters
agent_idrequired |
---|
Responses
Response samples
- 200
- 422
Content type
application/json
`{
- "instructions": "string",
- "tools": [
- {
* "type": "function",
* "function": {
* "name": "string",
* "description": "",
* "strict": false,
* "parameters": { }
}
}
], - {
- "completion_args": {
- "stop": "string",
- "presence_penalty": -2,
- "frequency_penalty": -2,
- "temperature": 0.3,
- "top_p": 1,
- "max_tokens": 0,
- "random_seed": 0,
- "prediction": {
* "type": "content",
* "content": ""
},
- "response_format": {
* "type": "text",
* "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
},
- "tool_choice": "auto"
},
- "model": "string",
- "name": "string",
- "description": "string",
- "handoffs": [
- "string"
],
- "string"
- "object": "agent",
- "id": "string",
- "version": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z" }`
Update an agent entity.
Update an agent attributes and create a new version.
path Parameters
agent_idrequired |
---|
Request Body schema: application/json
required
Instructions (string) or Instructions (null) (Instructions) Instruction prompt the model will follow during the conversation. |
---|
Array of any (Tools) List of tools which are available to the model during the conversation. |
object (CompletionArgs) Completion arguments that will be used to generate assistant responses. Can be overridden at each message request. |
Model (string) or Model (null) (Model) |
Name (string) or Name (null) (Name) |
Description (string) or Description (null) (Description) |
Array of Handoffs (strings) or Handoffs (null) (Handoffs) |
Responses
Request samples
- Payload
Content type
application/json
`{
- "instructions": "string",
- "tools": [
- {
* "type": "function",
* "function": {
* "name": "string",
* "description": "",
* "strict": false,
* "parameters": { }
}
}
], - {
- "completion_args": {
- "stop": "string",
- "presence_penalty": -2,
- "frequency_penalty": -2,
- "temperature": 0.3,
- "top_p": 1,
- "max_tokens": 0,
- "random_seed": 0,
- "prediction": {
* "type": "content",
* "content": ""
},
- "response_format": {
* "type": "text",
* "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
},
- "tool_choice": "auto"
},
- "model": "string",
- "name": "string",
- "description": "string",
- "handoffs": [
- "string"
] }`
- "string"
Response samples
- 200
- 422
Content type
application/json
`{
- "instructions": "string",
- "tools": [
- {
* "type": "function",
* "function": {
* "name": "string",
* "description": "",
* "strict": false,
* "parameters": { }
}
}
], - {
- "completion_args": {
- "stop": "string",
- "presence_penalty": -2,
- "frequency_penalty": -2,
- "temperature": 0.3,
- "top_p": 1,
- "max_tokens": 0,
- "random_seed": 0,
- "prediction": {
* "type": "content",
* "content": ""
},
- "response_format": {
* "type": "text",
* "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
},
- "tool_choice": "auto"
},
- "model": "string",
- "name": "string",
- "description": "string",
- "handoffs": [
- "string"
],
- "string"
- "object": "agent",
- "id": "string",
- "version": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z" }`
Update an agent version.
Switch the version of an agent.
path Parameters
agent_idrequired |
---|
query Parameters
versionrequired |
---|
Responses
Response samples
- 200
- 422
Content type
application/json
`{
- "instructions": "string",
- "tools": [
- {
* "type": "function",
* "function": {
* "name": "string",
* "description": "",
* "strict": false,
* "parameters": { }
}
}
], - {
- "completion_args": {
- "stop": "string",
- "presence_penalty": -2,
- "frequency_penalty": -2,
- "temperature": 0.3,
- "top_p": 1,
- "max_tokens": 0,
- "random_seed": 0,
- "prediction": {
* "type": "content",
* "content": ""
},
- "response_format": {
* "type": "text",
* "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
},
- "tool_choice": "auto"
},
- "model": "string",
- "name": "string",
- "description": "string",
- "handoffs": [
- "string"
],
- "string"
- "object": "agent",
- "id": "string",
- "version": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z" }`
(beta) Conversations API
Create a conversation and append entries to it.
Create a new conversation, using a base model or an agent and append entries. Completion and tool executions are run and the response is appended to the conversation.Use the returned conversation_id to continue the conversation.
Request Body schema: application/json
required
required | ConversationInputs (string) or (Array of InputEntries (MessageInputEntry (object) or FunctionResultEntry (object))) (ConversationInputs) |
---|---|
Stream (boolean) or Stream (boolean) (Stream) Default: false Value: false | |
Store (boolean) or Store (null) (Store) Default: null | |
Handoff Execution (string) or Handoff Execution (null) (Handoff Execution) Default: null | |
Instructions (string) or Instructions (null) (Instructions) Default: null | |
Array of Tools (any) or Tools (null) (Tools) Default: null | |
CompletionArgs (object) or null Default: null | |
Name (string) or Name (null) (Name) Default: null | |
Description (string) or Description (null) (Description) Default: null | |
Agent Id (string) or Agent Id (null) (Agent Id) Default: null | |
Model (string) or Model (null) (Model) Default: null |
Responses
Request samples
- Payload
Content type
application/json
`{
- "inputs": "string",
- "stream": false,
- "store": null,
- "handoff_execution": null,
- "instructions": null,
- "tools": null,
- "completion_args": null,
- "name": null,
- "description": null,
- "agent_id": null,
- "model": null }`
Response samples
- 200
- 422
Content type
application/json
`{
- "object": "conversation.response",
- "conversation_id": "string",
- "outputs": [
- {
* "object": "entry",
* "type": "message.output",
* "created_at": "2019-08-24T14:15:22Z",
* "completed_at": "2019-08-24T14:15:22Z",
* "id": "string",
* "agent_id": "string",
* "model": "string",
* "role": "assistant",
* "content": "string"
}
], - {
- "usage": {
- "prompt_tokens": 0,
- "completion_tokens": 0,
- "total_tokens": 0,
- "connector_tokens": null,
- "connectors": null
} }`
List all created conversations.
Retrieve a list of conversation entities sorted by creation time.
query Parameters
page | integer (Page) Default: 0 |
---|---|
page_size | integer (Page Size) Default: 100 |
Responses
Response samples
- 200
- 422
Content type
application/json
`[
- {
- "instructions": "string",
- "tools": [
* {
* "type": "function",
* "function": {
* "name": "string",
* "description": "",
* "strict": false,
* "parameters": { }
}
}
],
- "completion_args": {
* "stop": "string",
* "presence_penalty": -2,
* "frequency_penalty": -2,
* "temperature": 0.3,
* "top_p": 1,
* "max_tokens": 0,
* "random_seed": 0,
* "prediction": {
* "type": "content",
* "content": ""
},
* "response_format": {
* "type": "text",
* "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
},
* "tool_choice": "auto"
},
- "name": "string",
- "description": "string",
- "object": "conversation",
- "id": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "model": "string"
} ]`
Retrieve a conversation information.
Given a conversation_id retrieve a conversation entity with its attributes.
path Parameters
conversation_idrequired |
---|
Responses
Response samples
- 200
- 422
Content type
application/json
`{
- "instructions": "string",
- "tools": [
- {
* "type": "function",
* "function": {
* "name": "string",
* "description": "",
* "strict": false,
* "parameters": { }
}
}
], - {
- "completion_args": {
- "stop": "string",
- "presence_penalty": -2,
- "frequency_penalty": -2,
- "temperature": 0.3,
- "top_p": 1,
- "max_tokens": 0,
- "random_seed": 0,
- "prediction": {
* "type": "content",
* "content": ""
},
- "response_format": {
* "type": "text",
* "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
},
- "tool_choice": "auto"
},
- "name": "string",
- "description": "string",
- "object": "conversation",
- "id": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "model": "string" }`
Append new entries to an existing conversation.
Run completion on the history of the conversation and the user entries. Return the new created entries.
path Parameters
conversation_idrequired | string (Conversation Id) ID of the conversation to which we append entries. |
---|
Request Body schema: application/json
required
required | ConversationInputs (string) or (Array of InputEntries (MessageInputEntry (object) or FunctionResultEntry (object))) (ConversationInputs) |
---|---|
stream | boolean (Stream) Default: false Value: false Whether to stream back partial progress. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON. |
store | boolean (Store) Default: true Whether to store the results into our servers or not. |
handoff_execution | string (Handoff Execution) Default: "server" Enum: "client" "server" |
object (CompletionArgs) Completion arguments that will be used to generate assistant responses. Can be overridden at each message request. |
Responses
Request samples
- Payload
Content type
application/json
`{
- "inputs": "string",
- "stream": false,
- "store": true,
- "handoff_execution": "client",
- "completion_args": {
- "stop": "string",
- "presence_penalty": -2,
- "frequency_penalty": -2,
- "temperature": 0.3,
- "top_p": 1,
- "max_tokens": 0,
- "random_seed": 0,
- "prediction": {
* "type": "content",
* "content": ""
},
- "response_format": {
* "type": "text",
* "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
},
- "tool_choice": "auto"
} }`
Response samples
- 200
- 422
Content type
application/json
`{
- "object": "conversation.response",
- "conversation_id": "string",
- "outputs": [
- {
* "object": "entry",
* "type": "message.output",
* "created_at": "2019-08-24T14:15:22Z",
* "completed_at": "2019-08-24T14:15:22Z",
* "id": "string",
* "agent_id": "string",
* "model": "string",
* "role": "assistant",
* "content": "string"
}
], - {
- "usage": {
- "prompt_tokens": 0,
- "completion_tokens": 0,
- "total_tokens": 0,
- "connector_tokens": null,
- "connectors": null
} }`
Retrieve all entries in a conversation.
Given a conversation_id retrieve all the entries belonging to that conversation. The entries are sorted in the order they were appended, those can be messages, connectors or function_call.
path Parameters
conversation_idrequired |
---|
Responses
Response samples
- 200
- 422
Content type
application/json
`{
- "object": "conversation.history",
- "conversation_id": "string",
- "entries": [
- {
* "object": "entry",
* "type": "message.input",
* "created_at": "2019-08-24T14:15:22Z",
* "completed_at": "2019-08-24T14:15:22Z",
* "id": "string",
* "role": "assistant",
* "content": "string"
}
] }` - {
Retrieve all messages in a conversation.
Given a conversation_id retrieve all the messages belonging to that conversation. This is similar to retrieving all entries except we filter the messages only.
path Parameters
conversation_idrequired |
---|
Responses
Response samples
- 200
- 422
Content type
application/json
`{
- "object": "conversation.messages",
- "conversation_id": "string",
- "messages": [
- {
* "object": "entry",
* "type": "message.input",
* "created_at": "2019-08-24T14:15:22Z",
* "completed_at": "2019-08-24T14:15:22Z",
* "id": "string",
* "role": "assistant",
* "content": "string"
}
] }` - {
Restart a conversation starting from a given entry.
Given a conversation_id and an id, recreate a conversation from this point and run completion. A new conversation is returned with the new entries returned.
path Parameters
conversation_idrequired |
---|
Request Body schema: application/json
required
required | ConversationInputs (string) or (Array of InputEntries (MessageInputEntry (object) or FunctionResultEntry (object))) (ConversationInputs) |
---|---|
stream | boolean (Stream) Default: false Value: false Whether to stream back partial progress. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON. |
store | boolean (Store) Default: true Whether to store the results into our servers or not. |
handoff_execution | string (Handoff Execution) Default: "server" Enum: "client" "server" |
from_entry_idrequired | string (From Entry Id) |
object (CompletionArgs) Completion arguments that will be used to generate assistant responses. Can be overridden at each message request. |
Responses
Request samples
- Payload
Content type
application/json
`{
- "inputs": "string",
- "stream": false,
- "store": true,
- "handoff_execution": "client",
- "from_entry_id": "string",
- "completion_args": {
- "stop": "string",
- "presence_penalty": -2,
- "frequency_penalty": -2,
- "temperature": 0.3,
- "top_p": 1,
- "max_tokens": 0,
- "random_seed": 0,
- "prediction": {
* "type": "content",
* "content": ""
},
- "response_format": {
* "type": "text",
* "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
},
- "tool_choice": "auto"
} }`
Response samples
- 200
- 422
Content type
application/json
`{
- "object": "conversation.response",
- "conversation_id": "string",
- "outputs": [
- {
* "object": "entry",
* "type": "message.output",
* "created_at": "2019-08-24T14:15:22Z",
* "completed_at": "2019-08-24T14:15:22Z",
* "id": "string",
* "agent_id": "string",
* "model": "string",
* "role": "assistant",
* "content": "string"
}
], - {
- "usage": {
- "prompt_tokens": 0,
- "completion_tokens": 0,
- "total_tokens": 0,
- "connector_tokens": null,
- "connectors": null
} }`
Create a conversation and append entries to it.
Create a new conversation, using a base model or an agent and append entries. Completion and tool executions are run and the response is appended to the conversation.Use the returned conversation_id to continue the conversation.
Request Body schema: application/json
required
required | ConversationInputs (string) or (Array of InputEntries (MessageInputEntry (object) or FunctionResultEntry (object))) (ConversationInputs) |
---|---|
Stream (boolean) or Stream (boolean) (Stream) Default: true Value: true | |
Store (boolean) or Store (null) (Store) Default: null | |
Handoff Execution (string) or Handoff Execution (null) (Handoff Execution) Default: null | |
Instructions (string) or Instructions (null) (Instructions) Default: null | |
Array of Tools (any) or Tools (null) (Tools) Default: null | |
CompletionArgs (object) or null Default: null | |
Name (string) or Name (null) (Name) Default: null | |
Description (string) or Description (null) (Description) Default: null | |
Agent Id (string) or Agent Id (null) (Agent Id) Default: null | |
Model (string) or Model (null) (Model) Default: null |
Responses
Request samples
- Payload
Content type
application/json
`{
- "inputs": "string",
- "stream": true,
- "store": null,
- "handoff_execution": null,
- "instructions": null,
- "tools": null,
- "completion_args": null,
- "name": null,
- "description": null,
- "agent_id": null,
- "model": null }`
Response samples
- 422
Content type
application/json
`{
- "detail": [
- {
* "msg": "string",
* "type": "string"
}
] }` - {
Append new entries to an existing conversation.
Run completion on the history of the conversation and the user entries. Return the new created entries.
path Parameters
conversation_idrequired | string (Conversation Id) ID of the conversation to which we append entries. |
---|
Request Body schema: application/json
required
required | ConversationInputs (string) or (Array of InputEntries (MessageInputEntry (object) or FunctionResultEntry (object))) (ConversationInputs) |
---|---|
stream | boolean (Stream) Default: true Value: true Whether to stream back partial progress. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON. |
store | boolean (Store) Default: true Whether to store the results into our servers or not. |
handoff_execution | string (Handoff Execution) Default: "server" Enum: "client" "server" |
object (CompletionArgs) Completion arguments that will be used to generate assistant responses. Can be overridden at each message request. |
Responses
Request samples
- Payload
Content type
application/json
`{
- "inputs": "string",
- "stream": true,
- "store": true,
- "handoff_execution": "client",
- "completion_args": {
- "stop": "string",
- "presence_penalty": -2,
- "frequency_penalty": -2,
- "temperature": 0.3,
- "top_p": 1,
- "max_tokens": 0,
- "random_seed": 0,
- "prediction": {
* "type": "content",
* "content": ""
},
- "response_format": {
* "type": "text",
* "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
},
- "tool_choice": "auto"
} }`
Response samples
- 422
Content type
application/json
`{
- "detail": [
- {
* "msg": "string",
* "type": "string"
}
] }` - {
Restart a conversation starting from a given entry.
Given a conversation_id and an id, recreate a conversation from this point and run completion. A new conversation is returned with the new entries returned.
path Parameters
conversation_idrequired |
---|
Request Body schema: application/json
required
required | ConversationInputs (string) or (Array of InputEntries (MessageInputEntry (object) or FunctionResultEntry (object))) (ConversationInputs) |
---|---|
stream | boolean (Stream) Default: true Value: true Whether to stream back partial progress. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON. |
store | boolean (Store) Default: true Whether to store the results into our servers or not. |
handoff_execution | string (Handoff Execution) Default: "server" Enum: "client" "server" |
from_entry_idrequired | string (From Entry Id) |
object (CompletionArgs) Completion arguments that will be used to generate assistant responses. Can be overridden at each message request. |
Responses
Request samples
- Payload
Content type
application/json
`{
- "inputs": "string",
- "stream": true,
- "store": true,
- "handoff_execution": "client",
- "from_entry_id": "string",
- "completion_args": {
- "stop": "string",
- "presence_penalty": -2,
- "frequency_penalty": -2,
- "temperature": 0.3,
- "top_p": 1,
- "max_tokens": 0,
- "random_seed": 0,
- "prediction": {
* "type": "content",
* "content": ""
},
- "response_format": {
* "type": "text",
* "json_schema": {
* "name": "string",
* "description": "string",
* "schema": { },
* "strict": false
}
},
- "tool_choice": "auto"
} }`
Response samples
- 422
Content type
application/json
`{
- "detail": [
- {
* "msg": "string",
* "type": "string"
}
] }` - {