mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-16 04:02:55 -06:00
chore: Fix reqeust -> request typo
Copybara import of the project: -- 6beac4451fef1774365e75ab67779253c5ac79be by Calvin Giles <calvin.giles@trademe.co.nz>: chore: Fix reqeust -> request typo #non-breaking COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/883 from calvingiles:fix-reqeust-typo cfe592e6ad4ebc79bd2b3ebcd0370f868b57ff10 PiperOrigin-RevId: 765354040
This commit is contained in:
parent
ba5b80d5d7
commit
4075290a1d
@ -185,7 +185,7 @@ class ToolAuthHandler:
|
|||||||
)
|
)
|
||||||
self.credential_store.store_credential(key, auth_credential)
|
self.credential_store.store_credential(key, auth_credential)
|
||||||
|
|
||||||
def _reqeust_credential(self) -> None:
|
def _request_credential(self) -> None:
|
||||||
"""Handles the case where an OpenID Connect or OAuth2 authentication request is needed."""
|
"""Handles the case where an OpenID Connect or OAuth2 authentication request is needed."""
|
||||||
if self.auth_scheme.type_ in (
|
if self.auth_scheme.type_ in (
|
||||||
AuthSchemeType.openIdConnect,
|
AuthSchemeType.openIdConnect,
|
||||||
@ -223,11 +223,6 @@ class ToolAuthHandler:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
def _request_credential(self, auth_config: AuthConfig):
|
|
||||||
if not self.tool_context:
|
|
||||||
return
|
|
||||||
self.tool_context.request_credential(auth_config)
|
|
||||||
|
|
||||||
def prepare_auth_credentials(
|
def prepare_auth_credentials(
|
||||||
self,
|
self,
|
||||||
) -> AuthPreparationResult:
|
) -> AuthPreparationResult:
|
||||||
@ -260,7 +255,7 @@ class ToolAuthHandler:
|
|||||||
auth_credential=exchanged_credential,
|
auth_credential=exchanged_credential,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self._reqeust_credential()
|
self._request_credential()
|
||||||
return AuthPreparationResult(
|
return AuthPreparationResult(
|
||||||
state="pending",
|
state="pending",
|
||||||
auth_scheme=self.auth_scheme,
|
auth_scheme=self.auth_scheme,
|
||||||
|
@ -136,13 +136,13 @@ def test_function_request_euc():
|
|||||||
function_call_ids = list(events[2].actions.requested_auth_configs.keys())
|
function_call_ids = list(events[2].actions.requested_auth_configs.keys())
|
||||||
|
|
||||||
for idx, part in enumerate(events[1].content.parts):
|
for idx, part in enumerate(events[1].content.parts):
|
||||||
reqeust_euc_function_call = part.function_call
|
request_euc_function_call = part.function_call
|
||||||
assert reqeust_euc_function_call is not None
|
assert request_euc_function_call is not None
|
||||||
assert (
|
assert (
|
||||||
reqeust_euc_function_call.name
|
request_euc_function_call.name
|
||||||
== functions.REQUEST_EUC_FUNCTION_CALL_NAME
|
== functions.REQUEST_EUC_FUNCTION_CALL_NAME
|
||||||
)
|
)
|
||||||
args = AuthToolArguments.model_validate(reqeust_euc_function_call.args)
|
args = AuthToolArguments.model_validate(request_euc_function_call.args)
|
||||||
|
|
||||||
assert args.function_call_id == function_call_ids[idx]
|
assert args.function_call_id == function_call_ids[idx]
|
||||||
args.auth_config.auth_scheme.model_extra.clear()
|
args.auth_config.auth_scheme.model_extra.clear()
|
||||||
@ -336,8 +336,8 @@ def test_function_get_auth_response():
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert function_invoked == 4
|
assert function_invoked == 4
|
||||||
reqeust = mock_model.requests[-1]
|
request = mock_model.requests[-1]
|
||||||
content = reqeust.contents[-1]
|
content = request.contents[-1]
|
||||||
parts = content.parts
|
parts = content.parts
|
||||||
assert len(parts) == 2
|
assert len(parts) == 2
|
||||||
assert parts[0].function_response.name == 'call_external_api1'
|
assert parts[0].function_response.name == 'call_external_api1'
|
||||||
|
@ -247,8 +247,8 @@ def test_function_call_id():
|
|||||||
agent = Agent(name='root_agent', model=mock_model, tools=[increase_by_one])
|
agent = Agent(name='root_agent', model=mock_model, tools=[increase_by_one])
|
||||||
runner = testing_utils.InMemoryRunner(agent)
|
runner = testing_utils.InMemoryRunner(agent)
|
||||||
events = runner.run('test')
|
events = runner.run('test')
|
||||||
for reqeust in mock_model.requests:
|
for request in mock_model.requests:
|
||||||
for content in reqeust.contents:
|
for content in request.contents:
|
||||||
for part in content.parts:
|
for part in content.parts:
|
||||||
if part.function_call:
|
if part.function_call:
|
||||||
assert part.function_call.id is None
|
assert part.function_call.id is None
|
||||||
|
Loading…
Reference in New Issue
Block a user