mirascope.core.google.call_response
This module contains the GoogleCallResponse class.
Usage
Class GoogleCallResponse
A convenience wrapper around the Google API response.
When calling the Google API using a function decorated with google_call, the
response will be a GoogleCallResponse instance with properties that allow for
more convenient access to commonly used attributes.
Example:
from mirascope.core import prompt_template
from mirascope.core.google import google_call
@google_call("google-1.5-flash")
def recommend_book(genre: str) -> str:
    return f"Recommend a {genre} book"
response = recommend_book("fantasy")  # response is an `GoogleCallResponse` instance
print(response.content)Bases:
BaseCallResponse[GenerateContentResponse, GoogleTool, Tool, GoogleDynamicConfig, ContentListUnion | ContentListUnionDict, GoogleCallParams, ContentDict, GoogleMessageParamConverter]Attributes
| Name | Type | Description | 
|---|---|---|
| content | str | Returns the contained string content for the 0th choice. | 
| finish_reasons | list[str] | Returns the finish reasons of the response. | 
| model | str | Returns the model name. google.generativeai does not return model, so we return the model provided by the user. | 
| id | str | None | Returns the id of the response. google.generativeai does not return an id | 
| usage | GenerateContentResponseUsageMetadata | None | Returns the usage of the chat completion. google.generativeai does not have Usage, so we return None | 
| input_tokens | int | None | Returns the number of input tokens. | 
| cached_tokens | int | None | Returns the number of cached tokens. | 
| output_tokens | int | None | Returns the number of output tokens. | 
| message_param | ContentDict | Returns the models's response as a message parameter. | 
| tools | list[GoogleTool] | None | Returns the list of tools for the response. | 
| tool | GoogleTool | None | Returns the 0th tool for the 0th candidate's 0th content part. | 
| common_finish_reasons | list[FinishReason] | None | - | 
| common_message_param | BaseMessageParam | - | 
| common_user_message_param | BaseMessageParam | None | - | 
| cost_metadata | CostMetadata | - | 
Function tool_message_params
Returns the tool message parameters for tool call results.
Parameters
| Name | Type | Description | 
|---|---|---|
| cls | Any | - | 
| tools_and_outputs | Sequence[tuple[GoogleTool, str]] | The sequence of tools and their outputs from which the tool message parameters should be constructed. | 
Returns
| Type | Description | 
|---|---|
| list[ContentDict] | The list of constructed `FunctionResponse` parameters. |