8000 fix: remove labels from config when using API key from Google AI Stud… · sonnet115/adk-python@5d29716 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5d29716

Browse files
seanzhougooglecopybara-github
authored andcommitted
fix: remove labels from config when using API key from Google AI Studio to call model
PiperOrigin-RevId: 765448305
1 parent 3ec496d commit 5d29716

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/google/adk/models/google_llm.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async def generate_content_async(
8383
Yields:
8484
LlmResponse: The model response.
8585
"""
86-
86+
self._preprocess_request(llm_request)
8787
self._maybe_append_user_content(llm_request)
8888
logger.info(
8989
'Sending out request, model: %s, backend: %s, stream: %s',
@@ -237,6 +237,12 @@ async def connect(self, llm_request: LlmRequest) -> BaseLlmConnection:
237237
) as live_session:
238238
yield GeminiLlmConnection(live_session)
239239

240+
def _preprocess_request(self, llm_request: LlmRequest) -> None:
241+
242+
if llm_request.config and self._api_backend == 'ml_dev':
243+
# Using API key from Google AI Studio to call model doesn't support labels.
244+
llm_request.config.labels = None
245+
240246

241247
def _build_function_declaration_log(
242248
func_decl: types.FunctionDeclaration,

0 commit comments

Comments
 (0)
0