mirascope.core.azure.tool
Module tool
The AzureTool
class for easy tool usage with Azure LLM calls.
Usage
Class GenerateAzureStrictToolJsonSchema
Bases:
GenerateJsonSchemaNoTitlesClass AzureToolConfig
A tool configuration for Azure-specific features.
Bases:
ToolConfigAttributes
Name | Type | Description |
---|---|---|
strict | bool | - |
Class AzureTool
A class for defining tools for Azure LLM calls.
Example:
from mirascope.core import prompt_template
from mirascope.core.azure import azure_call
def format_book(title: str, author: str) -> str:
return f"{title} by {author}"
@azure_call("gpt-4o-mini", tools=[format_book])
def recommend_book(genre: str) -> str:
return f"Recommend a {genre} book"
response = recommend_book("fantasy")
if tool := response.tool: # returns an `AzureTool` instance
print(tool.call())
Bases:
BaseToolAttributes
Name | Type | Description |
---|---|---|
tool_call | SkipJsonSchema[ChatCompletionsToolCall] | - |
Function tool_schema
Constructs a JSON Schema tool schema from the BaseModel
schema defined.
Example:
from mirascope.core.azure import AzureTool
def format_book(title: str, author: str) -> str:
return f"{title} by {author}"
tool_type = AzureTool.type_from_fn(format_book)
print(tool_type.tool_schema()) # prints the Azure-specific tool schema
Parameters
Name | Type | Description |
---|---|---|
cls | Any | - |
Returns
Type | Description |
---|---|
ChatCompletionsToolDefinition | - |
Function from_tool_call
Constructs an AzureTool
instance from a tool_call
.
Parameters
Name | Type | Description |
---|---|---|
cls | Any | - |
tool_call | ChatCompletionsToolCall | The Azure tool call from which to construct this tool instance. |
Returns
Type | Description |
---|---|
AzureTool | - |