mirascope.core.azure.call_response¶
This module contains the AzureCallResponse
class.
Usage Documentation
AzureCallResponse
¶
Bases: BaseCallResponse[ChatCompletions, AzureTool, ChatCompletionsToolDefinition, AsyncAzureDynamicConfig | AzureDynamicConfig, ChatRequestMessage, AzureCallParams, UserMessage]
A convenience wrapper around the Azure ChatCompletion
response.
When calling the Azure API using a function decorated with azure_call
, the
response will be an AzureCallResponse
instance with properties that allow for
more convenience access to commonly used attributes.
Example:
from mirascope.core import prompt_template
from mirascope.core.azure import azure_call
@azure_call("gpt-4o")
def recommend_book(genre: str) -> str:
return f"Recommend a {genre} book"
response = recommend_book("fantasy") # response is an `AzureCallResponse` instance
print(response.content)
message_param
property
¶
Returns the assistants's response as a message parameter.
tools
property
¶
Returns any available tool calls as their AzureTool
definition.
Raises:
Type | Description |
---|---|
ValidationError
|
if a tool call doesn't match the tool's schema. |
ValueError
|
if the model refused to response, in which case the error message will be the refusal. |
tool
property
¶
tool: AzureTool | None
Returns the 0th tool for the 0th choice message.
Raises:
Type | Description |
---|---|
ValidationError
|
if the tool call doesn't match the tool's schema. |
ValueError
|
if the model refused to response, in which case the error message will be the refusal. |
tool_message_params
classmethod
¶
Returns the tool message parameters for tool call results.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tools_and_outputs |
list[tuple[AzureTool, str]]
|
The list of tools and their outputs from which the tool message parameters should be constructed. |
required |
Returns:
Type | Description |
---|---|
list[ToolMessage]
|
The list of constructed |