community[patch]: fix main unit tests (#26189)

This commit is contained in:
Bagatur
2024-09-09 10:35:41 -07:00
committed by GitHub
parent 71268f7a15
commit 0f4a087186
4 changed files with 16 additions and 8 deletions

View File

@@ -15,12 +15,7 @@ from langchain_community.utilities.vertexai import get_client_info
if TYPE_CHECKING:
from google.api_core.client_options import ClientOptions
from google.cloud.discoveryengine_v1beta import (
ConversationalSearchServiceClient,
SearchRequest,
SearchResult,
SearchServiceClient,
)
from google.cloud.discoveryengine_v1beta import SearchRequest, SearchResult
class _BaseGoogleVertexAISearchRetriever(BaseModel):
@@ -243,7 +238,8 @@ class GoogleVertexAISearchRetriever(BaseRetriever, _BaseGoogleVertexAISearchRetr
Search will be based on the corrected query if found.
"""
_client: SearchServiceClient
# type is SearchServiceClient but can't be set due to optional imports
_client: Any
_serving_config: str
model_config = ConfigDict(
@@ -408,7 +404,8 @@ class GoogleVertexAIMultiTurnSearchRetriever(
conversation_id: str = "-"
"""Vertex AI Search Conversation ID."""
_client: ConversationalSearchServiceClient
# type is ConversationalSearchServiceClient but can't be set due to optional imports
_client: Any
_serving_config: str
model_config = ConfigDict(

View File

@@ -65,6 +65,9 @@ markers = [
"compile: mark placeholder test used to compile integration tests without running them",
]
asyncio_mode = "auto"
filterwarnings = [
"ignore::langchain_core._api.deprecation.LangChainDeprecationWarning:test",
]
[tool.poetry.group.test]
optional = true

View File

@@ -120,6 +120,11 @@ def test_serializable_mapping() -> None:
"bedrock",
"ChatBedrock",
),
("langchain_google_genai", "chat_models", "ChatGoogleGenerativeAI"): (
"langchain_google_genai",
"chat_models",
"ChatGoogleGenerativeAI",
),
}
serializable_modules = import_all_modules("langchain")

View File

@@ -93,6 +93,9 @@ def test_test_group_dependencies(poetry_conf: Mapping[str, Any]) -> None:
"responses",
"syrupy",
"requests-mock",
# TODO: Hack to get around cffi 1.17.1 not working with py3.9, remove when
# fix is released.
"cffi",
]
)