Skip to content

Commit 6481123

Browse files
authored
Merge branch 'main' into fix/display-name
2 parents 8b7f661 + be71208 commit 6481123

File tree

13 files changed

+213
-438
lines changed

13 files changed

+213
-438
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
from . import agent
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
from . import agent

src/google/adk/agents/llm_agent.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,6 @@ class LlmAgent(BaseAgent):
204204
"""
205205
# Advance features - End
206206

207-
# TODO: remove below fields after migration. - Start
208-
# These fields are added back for easier migration.
209-
examples: Optional[ExamplesUnion] = None
210-
# TODO: remove above fields after migration. - End
211-
212207
# Callbacks - Start
213208
before_model_callback: Optional[BeforeModelCallback] = None
214209
"""Callback or list of callbacks to be called before calling the LLM.

src/google/adk/auth/auth_handler.py

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def exchange_auth_token(
112112

113113
def parse_and_store_auth_response(self, state: State) -> None:
114114

115-
credential_key = self.get_credential_key()
115+
credential_key = "temp:" + self.auth_config.get_credential_key()
116116

117117
state[credential_key] = self.auth_config.exchanged_auth_credential
118118
if not isinstance(
@@ -130,7 +130,7 @@ def _validate(self) -> None:
130130
raise ValueError("auth_scheme is empty.")
131131

132132
def get_auth_response(self, state: State) -> AuthCredential:
133-
credential_key = self.get_credential_key()
133+
credential_key = "temp:" + self.auth_config.get_credential_key()
134134
return state.get(credential_key, None)
135135

136136
def generate_auth_request(self) -> AuthConfig:
@@ -192,29 +192,6 @@ def generate_auth_request(self) -> AuthConfig:
192192
exchanged_auth_credential=exchanged_credential,
193193
)
194194

195-
def get_credential_key(self) -> str:
196-
"""Generates a unique key for the given auth scheme and credential."""
197-
auth_scheme = self.auth_config.auth_scheme
198-
auth_credential = self.auth_config.raw_auth_credential
199-
if auth_scheme.model_extra:
200-
auth_scheme = auth_scheme.model_copy(deep=True)
201-
auth_scheme.model_extra.clear()
202-
scheme_name = (
203-
f"{auth_scheme.type_.name}_{hash(auth_scheme.model_dump_json())}"
204-
if auth_scheme
205-
else ""
206-
)
207-
if auth_credential.model_extra:
208-
auth_credential = auth_credential.model_copy(deep=True)
209-
auth_credential.model_extra.clear()
210-
credential_name = (
211-
f"{auth_credential.auth_type.value}_{hash(auth_credential.model_dump_json())}"
212-
if auth_credential
213-
else ""
214-
)
215-
216-
return f"temp:adk_{scheme_name}_{credential_name}"
217-
218195
def generate_auth_uri(
219196
self,
220197
) -> AuthCredential:

src/google/adk/auth/auth_tool.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from __future__ import annotations
16+
1517
from .auth_credential import AuthCredential
1618
from .auth_credential import BaseModelWithConfig
1719
from .auth_schemes import AuthScheme
@@ -43,6 +45,34 @@ class AuthConfig(BaseModelWithConfig):
4345
this field to guide the user through the OAuth2 flow and fill auth response in
4446
this field"""
4547

48+
def get_credential_key(self):
49+
"""Generates a hash key based on auth_scheme and raw_auth_credential. This
50+
hash key can be used to store / retrieve exchanged_auth_credential in a
51+
credentials store.
52+
"""
53+
auth_scheme = self.auth_scheme
54+
55+
if auth_scheme.model_extra:
56+
auth_scheme = auth_scheme.model_copy(deep=True)
57+
auth_scheme.model_extra.clear()
58+
scheme_name = (
59+
f"{auth_scheme.type_.name}_{hash(auth_scheme.model_dump_json())}"
60+
if auth_scheme
61+
else ""
62+
)
63+
64+
auth_credential = self.raw_auth_credential
65+
if auth_credential.model_extra:
66+
auth_credential = auth_credential.model_copy(deep=True)
67+
auth_credential.model_extra.clear()
68+
credential_name = (
69+
f"{auth_credential.auth_type.value}_{hash(auth_credential.model_dump_json())}"
70+
if auth_credential
71+
else ""
72+
)
73+
74+
return f"adk_{scheme_name}_{credential_name}"
75+
4676

4777
class AuthToolArguments(BaseModelWithConfig):
4878
"""the arguments for the special long running function tool that is used to

src/google/adk/cli/browser/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@
2929
<style>html{color-scheme:dark}html{--mat-sys-background:light-dark(#fcf9f8, #131314);--mat-sys-error:light-dark(#ba1a1a, #ffb4ab);--mat-sys-error-container:light-dark(#ffdad6, #93000a);--mat-sys-inverse-on-surface:light-dark(#f3f0f0, #313030);--mat-sys-inverse-primary:light-dark(#c1c7cd, #595f65);--mat-sys-inverse-surface:light-dark(#313030, #e5e2e2);--mat-sys-on-background:light-dark(#1c1b1c, #e5e2e2);--mat-sys-on-error:light-dark(#ffffff, #690005);--mat-sys-on-error-container:light-dark(#410002, #ffdad6);--mat-sys-on-primary:light-dark(#ffffff, #2b3136);--mat-sys-on-primary-container:light-dark(#161c21, #dde3e9);--mat-sys-on-primary-fixed:light-dark(#161c21, #161c21);--mat-sys-on-primary-fixed-variant:light-dark(#41474d, #41474d);--mat-sys-on-secondary:light-dark(#ffffff, #003061);--mat-sys-on-secondary-container:light-dark(#001b3c, #d5e3ff);--mat-sys-on-secondary-fixed:light-dark(#001b3c, #001b3c);--mat-sys-on-secondary-fixed-variant:light-dark(#0f4784, #0f4784);--mat-sys-on-surface:light-dark(#1c1b1c, #e5e2e2);--mat-sys-on-surface-variant:light-dark(#44474a, #e1e2e6);--mat-sys-on-tertiary:light-dark(#ffffff, #2b3136);--mat-sys-on-tertiary-container:light-dark(#161c21, #dde3e9);--mat-sys-on-tertiary-fixed:light-dark(#161c21, #161c21);--mat-sys-on-tertiary-fixed-variant:light-dark(#41474d, #41474d);--mat-sys-outline:light-dark(#74777b, #8e9194);--mat-sys-outline-variant:light-dark(#c4c7ca, #44474a);--mat-sys-primary:light-dark(#595f65, #c1c7cd);--mat-sys-primary-container:light-dark(#dde3e9, #41474d);--mat-sys-primary-fixed:light-dark(#dde3e9, #dde3e9);--mat-sys-primary-fixed-dim:light-dark(#c1c7cd, #c1c7cd);--mat-sys-scrim:light-dark(#000000, #000000);--mat-sys-secondary:light-dark(#305f9d, #a7c8ff);--mat-sys-secondary-container:light-dark(#d5e3ff, #0f4784);--mat-sys-secondary-fixed:light-dark(#d5e3ff, #d5e3ff);--mat-sys-secondary-fixed-dim:light-dark(#a7c8ff, #a7c8ff);--mat-sys-shadow:light-dark(#000000, #000000);--mat-sys-surface:light-dark(#fcf9f8, #131314);--mat-sys-surface-bright:light-dark(#fcf9f8, #393939);--mat-sys-surface-container:light-dark(#f0eded, #201f20);--mat-sys-surface-container-high:light-dark(#eae7e7, #2a2a2a);--mat-sys-surface-container-highest:light-dark(#e5e2e2, #393939);--mat-sys-surface-container-low:light-dark(#f6f3f3, #1c1b1c);--mat-sys-surface-container-lowest:light-dark(#ffffff, #0e0e0e);--mat-sys-surface-dim:light-dark(#dcd9d9, #131314);--mat-sys-surface-tint:light-dark(#595f65, #c1c7cd);--mat-sys-surface-variant:light-dark(#e1e2e6, #44474a);--mat-sys-tertiary:light-dark(#595f65, #c1c7cd);--mat-sys-tertiary-container:light-dark(#dde3e9, #41474d);--mat-sys-tertiary-fixed:light-dark(#dde3e9, #dde3e9);--mat-sys-tertiary-fixed-dim:light-dark(#c1c7cd, #c1c7cd);--mat-sys-neutral-variant20:#2d3134;--mat-sys-neutral10:#1c1b1c}html{--mat-sys-level0:0px 0px 0px 0px rgba(0, 0, 0, .2), 0px 0px 0px 0px rgba(0, 0, 0, .14), 0px 0px 0px 0px rgba(0, 0, 0, .12)}html{--mat-sys-level1:0px 2px 1px -1px rgba(0, 0, 0, .2), 0px 1px 1px 0px rgba(0, 0, 0, .14), 0px 1px 3px 0px rgba(0, 0, 0, .12)}html{--mat-sys-level2:0px 3px 3px -2px rgba(0, 0, 0, .2), 0px 3px 4px 0px rgba(0, 0, 0, .14), 0px 1px 8px 0px rgba(0, 0, 0, .12)}html{--mat-sys-level3:0px 3px 5px -1px rgba(0, 0, 0, .2), 0px 6px 10px 0px rgba(0, 0, 0, .14), 0px 1px 18px 0px rgba(0, 0, 0, .12)}html{--mat-sys-level4:0px 5px 5px -3px rgba(0, 0, 0, .2), 0px 8px 10px 1px rgba(0, 0, 0, .14), 0px 3px 14px 2px rgba(0, 0, 0, .12)}html{--mat-sys-level5:0px 7px 8px -4px rgba(0, 0, 0, .2), 0px 12px 17px 2px rgba(0, 0, 0, .14), 0px 5px 22px 4px rgba(0, 0, 0, .12)}html{--mat-sys-corner-extra-large:28px;--mat-sys-corner-extra-large-top:28px 28px 0 0;--mat-sys-corner-extra-small:4px;--mat-sys-corner-extra-small-top:4px 4px 0 0;--mat-sys-corner-full:9999px;--mat-sys-corner-large:16px;--mat-sys-corner-large-end:0 16px 16px 0;--mat-sys-corner-large-start:16px 0 0 16px;--mat-sys-corner-large-top:16px 16px 0 0;--mat-sys-corner-medium:12px;--mat-sys-corner-none:0;--mat-sys-corner-small:8px}html{--mat-sys-dragged-state-layer-opacity:.16;--mat-sys-focus-state-layer-opacity:.12;--mat-sys-hover-state-layer-opacity:.08;--mat-sys-pressed-state-layer-opacity:.12}html{font-family:Google Sans,Helvetica Neue,sans-serif!important}body{height:100vh;margin:0}:root{--mat-sys-primary:black;--mdc-checkbox-selected-icon-color:white;--mat-sys-background:#131314;--mat-tab-header-active-label-text-color:#8AB4F8;--mat-tab-header-active-hover-label-text-color:#8AB4F8;--mat-tab-header-active-focus-label-text-color:#8AB4F8;--mat-tab-header-label-text-weight:500;--mdc-text-button-label-text-color:#89b4f8}:root{--mdc-dialog-container-color:#2b2b2f}:root{--mdc-dialog-subhead-color:white}:root{--mdc-circular-progress-active-indicator-color:#a8c7fa}:root{--mdc-circular-progress-size:80}</style><link rel="stylesheet" href="./styles-4VDSPQ37.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="./styles-4VDSPQ37.css"></noscript></head>
3030
<body>
3131
<app-root></app-root>
32-
<script src="./polyfills-FFHMD2TL.js" type="module"></script><script src="./main-DY547BWY.js" type="module"></script></body>
32+
<script src="./polyfills-FFHMD2TL.js" type="module"></script><script src="./main-VEXTCQ7U.js" type="module"></script></body>
3333
</html>

0 commit comments

Comments
 (0)