Skip to content

Logging of REST API calls to the Gemini service #1914

@kolban-google

Description

@kolban-google

I am using the genai package and all is well. I believe it is making API calls to VertexAI at the endpoint:

aiplatform.googleapis.com

My question:

Can I log or otherwise debug the REST requests sent and received? Ideally, I would like to see the requests and responses sent from Python and received by Python. This is for education and debugging purposes.

I have tried:

import logging
logging.getLogger().setLevel(logging.DEBUG)

and that worked to an extent ... the logs did show a REST request but there was no logging of the payload and no logging of the response text. Ideally I would like to see a rich and complete set of data.

Metadata

Metadata

Assignees

Labels

priority: p3Desirable enhancement or fix. May not be included in next release.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions