Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/google/adk/models/google_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ async def connect(self, llm_request: LlmRequest) -> BaseLlmConnection:
],
)
llm_request.live_connect_config.tools = llm_request.config.tools
logger.info('Connecting to live with llm_request:%s', llm_request)
logger.debug('Connecting to live with llm_request:%s', llm_request)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While changing the log level to debug is a good step to reduce verbosity, the current implementation directly logs the llm_request object. This can still lead to very large log entries, especially if the request contains inline data (e.g., images), and is inconsistent with how requests are logged elsewhere in this file.

For consistency and to avoid logging potentially large data blobs, I suggest using the existing _build_request_log helper function, which is designed to create a safe and readable representation of the request. This function excludes raw byte data from logs.

Additionally, for better observability, you might consider adding a concise info-level log message that summarizes the connection attempt, similar to what's done in generate_content_async (lines 112-114). This would provide essential information in production logs without the excessive detail.

Here's a suggested implementation:

    logger.info('Connecting to live for model: %s', llm_request.model)
    logger.debug('Live connection request details: %s', _build_request_log(llm_request))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the background of why this log was added, but I assume it's intended to output connection information and similar details.
⁠_build_request_log appears to be a function designed to output ⁠contents and ⁠instruction, so I don't think it aligns with the intended purpose.

async with self._live_api_client.aio.live.connect(
model=llm_request.model, config=llm_request.live_connect_config
) as live_session:
Expand Down