You've already forked adk-python
mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix: Move some API request and responses to DEBUG logging level
Please set --log_level to DEBUG, if you are interested in having those API request and responses in logs. NOTE: Generally it is not recommended to have DEBUG log level for services that run in a production setting. It is our recommendation to only use DEBUG log level in a debug or development setting. PiperOrigin-RevId: 785972338
This commit is contained in:
committed by
Copybara-Service
parent
d4f01afc15
commit
ff31f57dc9
@@ -481,11 +481,11 @@ class RemoteA2aAgent(BaseAgent):
|
||||
),
|
||||
)
|
||||
|
||||
logger.info(build_a2a_request_log(a2a_request))
|
||||
logger.debug(build_a2a_request_log(a2a_request))
|
||||
|
||||
try:
|
||||
a2a_response = await self._a2a_client.send_message(request=a2a_request)
|
||||
logger.info(build_a2a_response_log(a2a_response))
|
||||
logger.debug(build_a2a_response_log(a2a_response))
|
||||
|
||||
event = await self._handle_a2a_response(a2a_response, ctx)
|
||||
|
||||
|
||||
@@ -894,7 +894,8 @@ def get_fast_api_app(
|
||||
new_message=req.new_message,
|
||||
)
|
||||
]
|
||||
logger.info("Generated %s events in agent run: %s", len(events), events)
|
||||
logger.info("Generated %s events in agent run", len(events))
|
||||
logger.debug("Events generated: %s", events)
|
||||
return events
|
||||
|
||||
@app.post("/run_sse")
|
||||
@@ -920,7 +921,7 @@ def get_fast_api_app(
|
||||
):
|
||||
# Format as SSE data
|
||||
sse_event = event.model_dump_json(exclude_none=True, by_alias=True)
|
||||
logger.info("Generated event in agent run streaming: %s", sse_event)
|
||||
logger.debug("Generated event in agent run streaming: %s", sse_event)
|
||||
yield f"data: {sse_event}\n\n"
|
||||
except Exception as e:
|
||||
logger.exception("Error in event_generator: %s", e)
|
||||
|
||||
@@ -86,7 +86,8 @@ class VertexAiMemoryBankService(BaseMemoryService):
|
||||
path=f'reasoningEngines/{self._agent_engine_id}/memories:generate',
|
||||
request_dict=request_dict,
|
||||
)
|
||||
logger.info('Generate memory response: %s', api_response)
|
||||
logger.info('Generate memory response received.')
|
||||
logger.debug('Generate memory response: %s', api_response)
|
||||
else:
|
||||
logger.info('No events to add to memory.')
|
||||
|
||||
@@ -108,7 +109,8 @@ class VertexAiMemoryBankService(BaseMemoryService):
|
||||
},
|
||||
)
|
||||
api_response = _convert_api_response(api_response)
|
||||
logger.info('Search memory response: %s', api_response)
|
||||
logger.info('Search memory response received.')
|
||||
logger.debug('Search memory response: %s', api_response)
|
||||
|
||||
if not api_response or not api_response.get('retrievedMemories', None):
|
||||
return SearchMemoryResponse()
|
||||
|
||||
@@ -174,7 +174,8 @@ def content_block_to_part(
|
||||
def message_to_generate_content_response(
|
||||
message: anthropic_types.Message,
|
||||
) -> LlmResponse:
|
||||
logger.info(
|
||||
logger.info("Received response from Claude.")
|
||||
logger.debug(
|
||||
"Claude response: %s",
|
||||
message.model_dump_json(indent=2, exclude_none=True),
|
||||
)
|
||||
|
||||
@@ -96,7 +96,7 @@ class Gemini(BaseLlm):
|
||||
self._api_backend,
|
||||
stream,
|
||||
)
|
||||
logger.info(_build_request_log(llm_request))
|
||||
logger.debug(_build_request_log(llm_request))
|
||||
|
||||
# add tracking headers to custom headers given it will override the headers
|
||||
# set in the api client constructor
|
||||
@@ -121,7 +121,7 @@ class Gemini(BaseLlm):
|
||||
# previous partial content. The only difference is bidi rely on
|
||||
# complete_turn flag to detect end while sse depends on finish_reason.
|
||||
async for response in responses:
|
||||
logger.info(_build_response_log(response))
|
||||
logger.debug(_build_response_log(response))
|
||||
llm_response = LlmResponse.create(response)
|
||||
usage_metadata = llm_response.usage_metadata
|
||||
if (
|
||||
@@ -179,7 +179,8 @@ class Gemini(BaseLlm):
|
||||
contents=llm_request.contents,
|
||||
config=llm_request.config,
|
||||
)
|
||||
logger.info(_build_response_log(response))
|
||||
logger.info('Response received from the model.')
|
||||
logger.debug(_build_response_log(response))
|
||||
yield LlmResponse.create(response)
|
||||
|
||||
@cached_property
|
||||
|
||||
@@ -109,7 +109,8 @@ class VertexAiSessionService(BaseSessionService):
|
||||
request_dict=session_json_dict,
|
||||
)
|
||||
api_response = _convert_api_response(api_response)
|
||||
logger.info(f'Create Session response {api_response}')
|
||||
logger.info('Create session response received.')
|
||||
logger.debug('Create session response: %s', api_response)
|
||||
|
||||
session_id = api_response['name'].split('/')[-3]
|
||||
operation_id = api_response['name'].split('/')[-1]
|
||||
|
||||
Reference in New Issue
Block a user