You've already forked adk-python
mirror of
https://github.com/encounter/adk-python.git
synced 2026-03-30 10:57:20 -07:00
fix: Fix the broken langchain importing caused their 1.0.0 release
PiperOrigin-RevId: 822279014
This commit is contained in:
committed by
Copybara-Service
parent
ed37e343f0
commit
c850da3a07
@@ -17,17 +17,19 @@ This agent aims to test the Langchain tool with Langchain's StructuredTool
|
||||
"""
|
||||
from google.adk.agents.llm_agent import Agent
|
||||
from google.adk.tools.langchain_tool import LangchainTool
|
||||
from langchain.tools import tool
|
||||
from langchain_core.tools import tool
|
||||
from langchain_core.tools.structured import StructuredTool
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
async def add(x, y) -> int:
|
||||
"""Adds two numbers."""
|
||||
return x + y
|
||||
|
||||
|
||||
@tool
|
||||
def minus(x, y) -> int:
|
||||
"""Subtracts two numbers."""
|
||||
return x - y
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -114,7 +114,7 @@ test = [
|
||||
"anthropic>=0.43.0", # For anthropic model tests
|
||||
"kubernetes>=29.0.0", # For GkeCodeExecutor
|
||||
"langchain-community>=0.3.17",
|
||||
"langgraph>=0.2.60, <= 0.4.10", # For LangGraphAgent
|
||||
"langgraph>=0.2.60, <0.4.8", # For LangGraphAgent
|
||||
"litellm>=1.75.5, <2.0.0", # For LiteLLM tests
|
||||
"llama-index-readers-file>=0.4.0", # For retrieval tests
|
||||
"openai>=1.100.2", # For LiteLLM
|
||||
@@ -144,7 +144,7 @@ extensions = [
|
||||
"crewai[tools];python_version>='3.10'", # For CrewaiTool
|
||||
"docker>=7.0.0", # For ContainerCodeExecutor
|
||||
"kubernetes>=29.0.0", # For GkeCodeExecutor
|
||||
"langgraph>=0.2.60", # For LangGraphAgent
|
||||
"langgraph>=0.2.60, <0.4.8", # For LangGraphAgent
|
||||
"litellm>=1.75.5", # For LiteLlm class. Currently has OpenAI limitations. TODO: once LiteLlm fix it
|
||||
"llama-index-readers-file>=0.4.0", # For retrieval using LlamaIndex.
|
||||
"llama-index-embeddings-google-genai>=0.3.0",# For files retrieval using LlamaIndex.
|
||||
|
||||
@@ -18,8 +18,8 @@ from typing import Optional
|
||||
from typing import Union
|
||||
|
||||
from google.genai import types
|
||||
from langchain.agents import Tool
|
||||
from langchain_core.tools import BaseTool as LangchainBaseTool
|
||||
from langchain_core.tools import Tool
|
||||
from langchain_core.tools.structured import StructuredTool
|
||||
from typing_extensions import override
|
||||
|
||||
|
||||
@@ -12,22 +12,13 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import pytest
|
||||
|
||||
# TODO: Re-enable this test after verifying LangchainTool and
|
||||
# LangGraphAgent against langchain's 1.0.0 release.
|
||||
pytest.skip(
|
||||
allow_module_level=True,
|
||||
reason="Langchain just made 1.0.0 release that breaks existing import.",
|
||||
)
|
||||
|
||||
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from google.adk.tools.langchain_tool import LangchainTool
|
||||
from langchain.tools import tool
|
||||
from langchain_core.tools import tool
|
||||
from langchain_core.tools.structured import StructuredTool
|
||||
from pydantic import BaseModel
|
||||
import pytest
|
||||
|
||||
|
||||
@tool
|
||||
|
||||
Reference in New Issue
Block a user