mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-16 12:12:56 -06:00
chore: Fixes type hints in google_api_tool_set.py.
PiperOrigin-RevId: 749844560
This commit is contained in:
parent
5ab43e804a
commit
1e752b1378
@ -112,9 +112,6 @@ adk eval \
|
|||||||
samples_for_testing/hello_world/hello_world_eval_set_001.evalset.json
|
samples_for_testing/hello_world/hello_world_eval_set_001.evalset.json
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🤖 A2A and ADK integration
|
|
||||||
|
|
||||||
For remote agent-to-agent communication, ADK integrates with the [A2A protocol](https://github.com/google/A2A/). See this [example](https://github.com/google/A2A/tree/main/samples/python/agents/google_adk) for how they can work together.
|
|
||||||
|
|
||||||
## 🤝 Contributing
|
## 🤝 Contributing
|
||||||
|
|
||||||
|
@ -11,10 +11,12 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
import os
|
import os
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from typing import Dict
|
|
||||||
from typing import Final
|
from typing import Final
|
||||||
from typing import List
|
from typing import List
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
@ -28,6 +30,7 @@ from .googleapi_to_openapi_converter import GoogleApiToOpenApiConverter
|
|||||||
|
|
||||||
|
|
||||||
class GoogleApiToolSet:
|
class GoogleApiToolSet:
|
||||||
|
"""Google API Tool Set."""
|
||||||
|
|
||||||
def __init__(self, tools: List[RestApiTool]):
|
def __init__(self, tools: List[RestApiTool]):
|
||||||
self.tools: Final[List[GoogleApiTool]] = [
|
self.tools: Final[List[GoogleApiTool]] = [
|
||||||
@ -45,10 +48,10 @@ class GoogleApiToolSet:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _load_tool_set_with_oidc_auth(
|
def _load_tool_set_with_oidc_auth(
|
||||||
spec_file: str = None,
|
spec_file: Optional[str] = None,
|
||||||
spec_dict: Dict[str, Any] = None,
|
spec_dict: Optional[dict[str, Any]] = None,
|
||||||
scopes: list[str] = None,
|
scopes: Optional[list[str]] = None,
|
||||||
) -> Optional[OpenAPIToolset]:
|
) -> OpenAPIToolset:
|
||||||
spec_str = None
|
spec_str = None
|
||||||
if spec_file:
|
if spec_file:
|
||||||
# Get the frame of the caller
|
# Get the frame of the caller
|
||||||
@ -90,18 +93,18 @@ class GoogleApiToolSet:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load_tool_set(
|
def load_tool_set(
|
||||||
cl: Type['GoogleApiToolSet'],
|
cls: Type[GoogleApiToolSet],
|
||||||
api_name: str,
|
api_name: str,
|
||||||
api_version: str,
|
api_version: str,
|
||||||
) -> 'GoogleApiToolSet':
|
) -> GoogleApiToolSet:
|
||||||
spec_dict = GoogleApiToOpenApiConverter(api_name, api_version).convert()
|
spec_dict = GoogleApiToOpenApiConverter(api_name, api_version).convert()
|
||||||
scope = list(
|
scope = list(
|
||||||
spec_dict['components']['securitySchemes']['oauth2']['flows'][
|
spec_dict['components']['securitySchemes']['oauth2']['flows'][
|
||||||
'authorizationCode'
|
'authorizationCode'
|
||||||
]['scopes'].keys()
|
]['scopes'].keys()
|
||||||
)[0]
|
)[0]
|
||||||
return cl(
|
return cls(
|
||||||
cl._load_tool_set_with_oidc_auth(
|
cls._load_tool_set_with_oidc_auth(
|
||||||
spec_dict=spec_dict, scopes=[scope]
|
spec_dict=spec_dict, scopes=[scope]
|
||||||
).get_tools()
|
).get_tools()
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user