Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
### ⚠ BREAKING CHANGES

* Auth: expose `access_token` and `refresh_token` at top level of auth
credentails, instead of a `dict`
credentials, instead of a `dict`
([commit](https://github.com/google/adk-python/commit/956fb912e8851b139668b1ccb8db10fd252a6990)).

### Features
Expand All @@ -50,7 +50,7 @@

### Miscellaneous Chores

* README.md impprovements.
* README.md improvements.
* Various code improvements.
* Various typo fixes.
* Bump min version of google-genai to 1.11.0.
Expand Down Expand Up @@ -108,4 +108,4 @@
* Built-in evaluation support
* Development UI that makes local development easy
* Deploy to Google Cloud Run, Agent Engine
* (Experimental) Live(Bidi) auido/video agent support and Compositional Function Calling(CFC) support
* (Experimental) Live(Bidi) audio/video agent support and Compositional Function Calling(CFC) support
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def mock_operation_parser(self):
return mock_parser

@pytest.fixture
def sample_endpiont(self):
def sample_endpoint(self):
return OperationEndpoint(
base_url="https://example.com", path="/test", method="GET"
)
Expand Down Expand Up @@ -131,38 +131,38 @@ def sample_auth_credential(self):

def test_init(
self,
sample_endpiont,
sample_endpoint,
sample_operation,
sample_auth_scheme,
sample_auth_credential,
):
tool = RestApiTool(
name="test_tool",
description="Test Tool",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=sample_operation,
auth_scheme=sample_auth_scheme,
auth_credential=sample_auth_credential,
)
assert tool.name == "test_tool"
assert tool.description == "Test Tool"
assert tool.endpoint == sample_endpiont
assert tool.endpoint == sample_endpoint
assert tool.operation == sample_operation
assert tool.auth_credential == sample_auth_credential
assert tool.auth_scheme == sample_auth_scheme
assert tool.credential_exchanger is not None

def test_from_parsed_operation_str(
self,
sample_endpiont,
sample_endpoint,
sample_api_parameters,
sample_return_parameter,
sample_operation,
):
parsed_operation_str = json.dumps({
"name": "test_operation",
"description": "Test Description",
"endpoint": sample_endpiont.model_dump(),
"endpoint": sample_endpoint.model_dump(),
"operation": sample_operation.model_dump(),
"auth_scheme": None,
"auth_credential": None,
Expand All @@ -174,12 +174,12 @@ def test_from_parsed_operation_str(
assert tool.name == "test_operation"

def test_get_declaration(
self, sample_endpiont, sample_operation, mock_operation_parser
self, sample_endpoint, sample_operation, mock_operation_parser
):
tool = RestApiTool(
name="test_tool",
description="Test description",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=sample_operation,
should_parse_operation=False,
)
Expand All @@ -198,7 +198,7 @@ def test_call_success(
self,
mock_request,
mock_tool_context,
sample_endpiont,
sample_endpoint,
sample_operation,
sample_auth_scheme,
sample_auth_credential,
Expand All @@ -210,7 +210,7 @@ def test_call_success(
tool = RestApiTool(
name="test_tool",
description="Test Tool",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=sample_operation,
auth_scheme=sample_auth_scheme,
auth_credential=sample_auth_credential,
Expand All @@ -228,7 +228,7 @@ def test_call_success(
def test_call_auth_pending(
self,
mock_request,
sample_endpiont,
sample_endpoint,
sample_operation,
sample_auth_scheme,
sample_auth_credential,
Expand All @@ -237,7 +237,7 @@ def test_call_auth_pending(
tool = RestApiTool(
name="test_tool",
description="Test Tool",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=sample_operation,
auth_scheme=sample_auth_scheme,
auth_credential=sample_auth_credential,
Expand All @@ -258,7 +258,7 @@ def test_call_auth_pending(
}

def test_prepare_request_params_query_body(
self, sample_endpiont, sample_auth_credential, sample_auth_scheme
self, sample_endpoint, sample_auth_credential, sample_auth_scheme
):
# Create a mock Operation object
mock_operation = Operation(
Expand Down Expand Up @@ -288,7 +288,7 @@ def test_prepare_request_params_query_body(
tool = RestApiTool(
name="test_tool",
description="test",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=mock_operation,
auth_credential=sample_auth_credential,
auth_scheme=sample_auth_scheme,
Expand Down Expand Up @@ -327,7 +327,7 @@ def test_prepare_request_params_query_body(
assert request_params["params"] == {"testQueryParam": "query_value"}

def test_prepare_request_params_array(
self, sample_endpiont, sample_auth_scheme, sample_auth_credential
self, sample_endpoint, sample_auth_scheme, sample_auth_credential
):
mock_operation = Operation(
operationId="test_op",
Expand All @@ -345,7 +345,7 @@ def test_prepare_request_params_array(
tool = RestApiTool(
name="test_tool",
description="test",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=mock_operation,
auth_credential=sample_auth_credential,
auth_scheme=sample_auth_scheme,
Expand All @@ -367,7 +367,7 @@ def test_prepare_request_params_array(
assert request_params["json"] == ["item1", "item2"]

def test_prepare_request_params_string(
self, sample_endpiont, sample_auth_credential, sample_auth_scheme
self, sample_endpoint, sample_auth_credential, sample_auth_scheme
):
mock_operation = Operation(
operationId="test_op",
Expand All @@ -380,7 +380,7 @@ def test_prepare_request_params_string(
tool = RestApiTool(
name="test_tool",
description="Test Tool",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=mock_operation,
auth_credential=sample_auth_credential,
auth_scheme=sample_auth_scheme,
Expand All @@ -401,7 +401,7 @@ def test_prepare_request_params_string(
assert request_params["headers"]["Content-Type"] == "text/plain"

def test_prepare_request_params_form_data(
self, sample_endpiont, sample_auth_scheme, sample_auth_credential
self, sample_endpoint, sample_auth_scheme, sample_auth_credential
):
mock_operation = Operation(
operationId="test_op",
Expand All @@ -419,7 +419,7 @@ def test_prepare_request_params_form_data(
tool = RestApiTool(
name="test_tool",
description="test",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=mock_operation,
auth_credential=sample_auth_credential,
auth_scheme=sample_auth_scheme,
Expand All @@ -443,7 +443,7 @@ def test_prepare_request_params_form_data(
)

def test_prepare_request_params_multipart(
self, sample_endpiont, sample_auth_credential, sample_auth_scheme
self, sample_endpoint, sample_auth_credential, sample_auth_scheme
):
mock_operation = Operation(
operationId="test_op",
Expand All @@ -465,7 +465,7 @@ def test_prepare_request_params_multipart(
tool = RestApiTool(
name="test_tool",
description="test",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=mock_operation,
auth_credential=sample_auth_credential,
auth_scheme=sample_auth_scheme,
Expand All @@ -486,7 +486,7 @@ def test_prepare_request_params_multipart(
assert request_params["headers"]["Content-Type"] == "multipart/form-data"

def test_prepare_request_params_octet_stream(
self, sample_endpiont, sample_auth_scheme, sample_auth_credential
self, sample_endpoint, sample_auth_scheme, sample_auth_credential
):
mock_operation = Operation(
operationId="test_op",
Expand All @@ -501,7 +501,7 @@ def test_prepare_request_params_octet_stream(
tool = RestApiTool(
name="test_tool",
description="test",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=mock_operation,
auth_credential=sample_auth_credential,
auth_scheme=sample_auth_scheme,
Expand All @@ -524,13 +524,13 @@ def test_prepare_request_params_octet_stream(
)

def test_prepare_request_params_path_param(
self, sample_endpiont, sample_auth_credential, sample_auth_scheme
self, sample_endpoint, sample_auth_credential, sample_auth_scheme
):
mock_operation = Operation(operationId="test_op")
tool = RestApiTool(
name="test_tool",
description="Test Tool",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=mock_operation,
auth_credential=sample_auth_credential,
auth_scheme=sample_auth_scheme,
Expand All @@ -557,15 +557,15 @@ def test_prepare_request_params_path_param(

def test_prepare_request_params_header_param(
self,
sample_endpiont,
sample_endpoint,
sample_auth_credential,
sample_auth_scheme,
sample_operation,
):
tool = RestApiTool(
name="test_tool",
description="Test Tool",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=sample_operation,
auth_credential=sample_auth_credential,
auth_scheme=sample_auth_scheme,
Expand All @@ -586,15 +586,15 @@ def test_prepare_request_params_header_param(

def test_prepare_request_params_cookie_param(
self,
sample_endpiont,
sample_endpoint,
sample_auth_credential,
sample_auth_scheme,
sample_operation,
):
tool = RestApiTool(
name="test_tool",
description="Test Tool",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=sample_operation,
auth_credential=sample_auth_credential,
auth_scheme=sample_auth_scheme,
Expand All @@ -614,7 +614,7 @@ def test_prepare_request_params_cookie_param(
assert request_params["cookies"]["session_id"] == "cookie_value"

def test_prepare_request_params_multiple_mime_types(
self, sample_endpiont, sample_auth_credential, sample_auth_scheme
self, sample_endpoint, sample_auth_credential, sample_auth_scheme
):
# Test what happens when multiple mime types are specified. It should take
# the first one.
Expand All @@ -632,7 +632,7 @@ def test_prepare_request_params_multiple_mime_types(
tool = RestApiTool(
name="test_tool",
description="Test Tool",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=mock_operation,
auth_credential=sample_auth_credential,
auth_scheme=sample_auth_scheme,
Expand All @@ -653,15 +653,15 @@ def test_prepare_request_params_multiple_mime_types(

def test_prepare_request_params_unknown_parameter(
self,
sample_endpiont,
sample_endpoint,
sample_auth_credential,
sample_auth_scheme,
sample_operation,
):
tool = RestApiTool(
name="test_tool",
description="Test Tool",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=sample_operation,
auth_credential=sample_auth_credential,
auth_scheme=sample_auth_scheme,
Expand Down Expand Up @@ -719,15 +719,15 @@ def test_prepare_request_params_base_url_handling(

def test_prepare_request_params_no_unrecognized_query_parameter(
self,
sample_endpiont,
sample_endpoint,
sample_auth_credential,
sample_auth_scheme,
sample_operation,
):
tool = RestApiTool(
name="test_tool",
description="Test Tool",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=sample_operation,
auth_credential=sample_auth_credential,
auth_scheme=sample_auth_scheme,
Expand All @@ -748,13 +748,13 @@ def test_prepare_request_params_no_unrecognized_query_parameter(

def test_prepare_request_params_no_credential(
self,
sample_endpiont,
sample_endpoint,
sample_operation,
):
tool = RestApiTool(
name="test_tool",
description="Test Tool",
endpoint=sample_endpiont,
endpoint=sample_endpoint,
operation=sample_operation,
auth_credential=None,
auth_scheme=None,
Expand Down