Skip to content

feat(genai): add include_response_headers support to ChatGoogleGenerativeAI - #1554

Open
Roaim (Roaimkhan) wants to merge 12 commits into
langchain-ai:mainfrom
Roaimkhan:headers
Open

feat(genai): add include_response_headers support to ChatGoogleGenerativeAI#1554
Roaim (Roaimkhan) wants to merge 12 commits into
langchain-ai:mainfrom
Roaimkhan:headers

Conversation

@Roaimkhan

Copy link
Copy Markdown
Contributor

Description

Including "include_response_headers" flag to ChatGoogleGenerativeAI

Relevant issues

fixes #1553

Type

🆕 New Feature

Changes(optional)

Testing(optional)

Note(optional)

@Roaimkhan Roaim (Roaimkhan) changed the title feat(google-genai): add include_response_headers support to ChatGoogleGenerativeAI feat(genai): add include_response_headers support to ChatGoogleGenerativeAI Feb 3, 2026
@Roaimkhan
Roaim (Roaimkhan) marked this pull request as draft February 4, 2026 14:57
@Roaimkhan
Roaim (Roaimkhan) marked this pull request as ready for review February 5, 2026 12:24
@Roaimkhan

Copy link
Copy Markdown
Contributor Author

Mason Daugherty (@mdrxy) The PR has been approved. Could a maintainer please merge this when ready? Thanks!

def _response_to_result(
response: GenerateContentResponse,
stream: bool = False,
include_response_headers: bool = False,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This appears to be added with no way to override the default? Is that intended?

@mdrxy

Copy link
Copy Markdown
Member

Roaim (@Roaimkhan) see comment above

@Roaimkhan

Copy link
Copy Markdown
Contributor Author

Mason Daugherty (@mdrxy)
You're right — include_response_headers is defined in _response_to_result but isn't currently exposed by ChatGoogleGenerativeAI.
If you'd like, I can expose it as a configurable field and propagate it through the sync, async, and streaming paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add response headers in AiMessage.response_metadata

3 participants