Response Object
This page details the structure of the response objects returned by the Infuzu API. Understanding the structure and fields of these objects is crucial for effectively using the API and extracting the information you need.
Overview
Upon successfully making a request to the Infuzu API, you receive a JSON response containing various data points. The primary object is ChatCompletionsObject
, which encapsulates the AI's response(s), metadata, and usage information. This page describes the structure of the ChatCompletionsObject
and its related objects.
ChatCompletionsObject
The ChatCompletionsObject
is the top-level object returned by the API. It provides an overview of the entire chat completion operation.
Fields
Field | Type | Description |
---|---|---|
| string | Unique identifier for the chat completion. |
| array of | Array containing the different choices (responses) provided by the API. |
| int | Timestamp of when the completion was created (in Unix epoch format). |
| string | The model used for generating the completion (a list of models can be found in the pricing list). |
| string | Service tier associated with the request, if any. |
| string | Fingerprint of the system that generated the response. |
| string | Type of object, usually |
| object of | Usage statistics related to the request. |
Example
ChatCompletionsChoiceObject
Each ChatCompletionsChoiceObject
represents a single response option provided by the API. The Infuzu API might return multiple choices based on the model configuration (imsn
parameter).
Fields
Field | Type | Description |
---|---|---|
| string | Reason for finishing the completion. Can be |
| int | Index of the choice in the list of choices. |
| object of | Contains the actual message content. |
| object of | (Optional) Log probabilities of the tokens in the message. |
| object of | Model that generated this choice |
| object of | (Optional) Contains error information if an error occurred. |
| object of | Latency statistics related to the response. |
Example
ChatCompletionsChoiceMessageObject
This object contains the actual message content and role.
Fields
Field | Type | Description |
---|---|---|
| string | The role of the message sender (e.g., |
| string | The content of the message. |
Example
ChatCompletionsChoiceLogprobsObject (Optional)
This object contains log probabilities for the tokens in the message. It's only included if requested in the request parameters.
Fields
Field | Type | Description |
---|---|---|
| array of | Array of log probabilities for the content tokens. |
| array of | Array of log probabilities for refusal tokens, if the model refused to respond. |
Example
ChatCompletionsChoiceLogprobsItemObject (Optional)
This object contains log probability information for a single token.
Fields
Field | Type | Description |
---|---|---|
| string | The token. |
| float | The log probability of the token. |
| array of int | Byte representation of the token. |
| array of | Array of the most probable tokens at this position. |
ChatCompletionsChoiceLogprobsItemTopLogprobsObject (Optional)
This object contains information about the top log probabilities for a token.
Fields
Field | Type | Description |
---|---|---|
| string | The token. |
| float | The log probability of the token. |
| array of int | Byte representation of the token. |
ChatCompletionsUsageObject
This object provides usage statistics for the request, including token counts.
Fields
Field | Type | Description |
---|---|---|
| int | Number of tokens in the prompt. |
| int | Number of tokens in the generated completion. |
| int | Total number of tokens used (prompt + completion). |
Example
ChatCompletionsChoiceModelObject
This object describes the model used to generate the ChatCompletionsChoiceObject
.
Fields
Field | Type | Description |
---|---|---|
| string | The name or reference of the model that generated the completion |
| int | The rank of the model chosen for generation, based on Intelligent Model Selection |
Example
ChatCompletionsChoiceErrorObject
This object describes any error that may have occurred during the generation of a specific ChatCompletionsChoiceObject
.
Fields
Field | Type | Description |
---|---|---|
| string | A code describing the type of error that occurred |
| string | A human-readable error message |
Example
ChatCompletionsChoiceLatencyObject
This object contains information about the measured latency.
Fields
Field | Type | Description |
---|---|---|
| int | The time it took for the model to start generating the output in milliseconds |
| int | The total time for the model to generate the entire output in milliseconds |
Example
Code Examples
Here’s how you can access response data in Python:
By understanding these response objects, you can efficiently parse the API’s output and build applications that leverage the power of intelligent model selection.