Skip to content

Commit a70582a

Browse files
committed
Fix Typing
1 parent da15d0a commit a70582a

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

libs/langchain-mongodb/langchain_mongodb/index.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import logging
44
from time import monotonic, sleep
5-
from typing import Any, Callable, Dict, List, Optional
5+
from typing import Any, Callable, Dict, List, Optional, Union
66

77
from pymongo.collection import Collection
88
from pymongo.operations import SearchIndexModel
@@ -202,7 +202,7 @@ def _wait_for_predicate(
202202
def create_fulltext_search_index(
203203
collection: Collection,
204204
index_name: str,
205-
field: str | List[str],
205+
field: Union[str, List[str]],
206206
*,
207207
wait_until_complete: Optional[float] = None,
208208
**kwargs: Any,

libs/langchain-mongodb/langchain_mongodb/pipelines.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
- `Filter Example <https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/#atlas-vector-search-pre-filter>`_
88
"""
99

10-
from typing import Any, Dict, List, Optional
10+
from typing import Any, Dict, List, Optional, Union
1111

1212

1313
def text_search_stage(
1414
query: str,
15-
search_field: str | list[str],
15+
search_field: Union[str, List[str]],
1616
index_name: str,
1717
limit: Optional[int] = None,
1818
filter: Optional[Dict[str, Any]] = None,

libs/langchain-mongodb/langchain_mongodb/retrievers/full_text_search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Annotated, Any, Dict, List, Optional
1+
from typing import Annotated, Any, Dict, List, Optional, Union
22

33
from langchain_core.callbacks.manager import CallbackManagerForRetrieverRun
44
from langchain_core.documents import Document
@@ -17,7 +17,7 @@ class MongoDBAtlasFullTextSearchRetriever(BaseRetriever):
1717
"""MongoDB Collection on an Atlas cluster"""
1818
search_index_name: str
1919
"""Atlas Search Index name"""
20-
search_field: str | list[str]
20+
search_field: Union[str, List[str]]
2121
"""Collection field that contains the text to be searched. It must be indexed"""
2222
k: Optional[int] = None
2323
"""Number of documents to return. Default is no limit"""

libs/langchain-mongodb/langchain_mongodb/vectorstores.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def __init__(
204204
collection: Collection[Dict[str, Any]],
205205
embedding: Embeddings,
206206
index_name: str = "vector_index",
207-
text_key: str | list[str] = "text",
207+
text_key: Union[str, List[str]] = "text",
208208
embedding_key: str = "embedding",
209209
relevance_score_fn: str = "cosine",
210210
dimensions: int = -1,

0 commit comments

Comments
 (0)