Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed unittest & lint #3

Merged
merged 1 commit into from
Jun 14, 2023
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
8 changes: 4 additions & 4 deletions langchain/retrievers/self_query/myscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

def DEFAULT_COMPOSER(op_name: str) -> Callable:
def f(*args: Any) -> str:
args: Tuple[str] = map(str, args)
return f" {op_name} ".join(args)
args_: map[str] = map(str, args)
return f" {op_name} ".join(args_)
return f


def FUNCTION_COMPOSER(op_name: str) -> Callable:
def f(*args: Any) -> str:
args: Tuple[str] = map(str, args)
return f"{op_name}({','.join(args)})"
args_: map[str] = map(str, args)
return f"{op_name}({','.join(args_)})"
return f


Expand Down
12 changes: 4 additions & 8 deletions langchain/vectorstores/mongodb_atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
Iterable,
List,
Optional,
Sequence,
Mapping,
Tuple,
TypeVar,
Union,
)

Expand All @@ -23,8 +21,6 @@
if TYPE_CHECKING:
from pymongo.collection import Collection

MongoDBDocumentType = TypeVar("MongoDBDocumentType", bound=Dict[str, Any])

logger = logging.getLogger(__name__)

DEFAULT_INSERT_BATCH_SIZE = 100
Expand Down Expand Up @@ -53,7 +49,7 @@ class MongoDBAtlasVectorSearch(VectorStore):

def __init__(
self,
collection: Collection[MongoDBDocumentType],
collection: Collection[Dict[str, Any]],
embedding: Embeddings,
*,
index_name: str = "default",
Expand Down Expand Up @@ -131,7 +127,7 @@ def _insert_texts(self, texts: List[str], metadatas: List[Dict[str, Any]]) -> Li
return []
# Embed and create the documents
embeddings = self._embedding.embed_documents(texts)
to_insert: List[MongoDBDocumentType] = [
to_insert: List[Dict[str, Any]] = [
{self._text_key: t, self._embedding_key: embedding, **m}
for t, m, embedding in zip(texts, metadatas, embeddings)
]
Expand Down Expand Up @@ -174,7 +170,7 @@ def similarity_search_with_score(
}
if pre_filter:
knn_beta["filter"] = pre_filter
pipeline: Sequence[Mapping[str, Any]] = [
pipeline: List[Mapping[str, Any]] = [
{
"$search": {
"index": self._index_name,
Expand Down Expand Up @@ -235,7 +231,7 @@ def from_texts(
texts: List[str],
embedding: Embeddings,
metadatas: Optional[List[dict]] = None,
collection: Optional[Collection[MongoDBDocumentType]] = None,
collection: Optional[Collection[Dict[str, Any]]] = None,
**kwargs: Any,
) -> MongoDBAtlasVectorSearch:
"""Construct MongoDBAtlasVectorSearch wrapper from raw documents.
Expand Down