mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix: merge tracking headers even when llm_request.config.http_options is not set in Gemini.generate_content_async
PiperOrigin-RevId: 788568620
This commit is contained in:
committed by
Copybara-Service
parent
646eb42533
commit
ec8dd5721a
@@ -116,9 +116,12 @@ class Gemini(BaseLlm):
|
||||
)
|
||||
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
|
||||
if llm_request.config and llm_request.config.http_options:
|
||||
# Always add tracking headers to custom headers given it will override
|
||||
# the headers set in the api client constructor to avoid tracking headers
|
||||
# being dropped if user provides custom headers or overrides the api client.
|
||||
if llm_request.config:
|
||||
if not llm_request.config.http_options:
|
||||
llm_request.config.http_options = types.HttpOptions()
|
||||
if not llm_request.config.http_options.headers:
|
||||
llm_request.config.http_options.headers = {}
|
||||
llm_request.config.http_options.headers.update(self._tracking_headers)
|
||||
|
||||
Reference in New Issue
Block a user