From 6609a6033fedfe601b8fffb9f7659a1feeb22cc0 Mon Sep 17 00:00:00 2001 From: Harrison Chase Date: Thu, 2 Nov 2023 15:32:31 -0700 Subject: [PATCH] fix vectorstore imports (#12804) Co-authored-by: Bagatur --- .../langchain/vectorstores/__init__.py | 3 + .../vectorstores/test_public_api.py | 75 +++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 libs/langchain/tests/unit_tests/vectorstores/test_public_api.py diff --git a/libs/langchain/langchain/vectorstores/__init__.py b/libs/langchain/langchain/vectorstores/__init__.py index 5e40a26d2f9..cdacbb57730 100644 --- a/libs/langchain/langchain/vectorstores/__init__.py +++ b/libs/langchain/langchain/vectorstores/__init__.py @@ -21,6 +21,8 @@ and retrieve the data that are 'most similar' to the embedded query. from typing import Any +from langchain.schema.vectorstore import VectorStore + def _import_alibaba_cloud_open_search() -> Any: from langchain.vectorstores.alibabacloud_opensearch import AlibabaCloudOpenSearch @@ -605,4 +607,5 @@ __all__ = [ "Zilliz", "TencentVectorDB", "AzureCosmosDBVectorSearch", + "VectorStore", ] diff --git a/libs/langchain/tests/unit_tests/vectorstores/test_public_api.py b/libs/langchain/tests/unit_tests/vectorstores/test_public_api.py new file mode 100644 index 00000000000..503b87e0358 --- /dev/null +++ b/libs/langchain/tests/unit_tests/vectorstores/test_public_api.py @@ -0,0 +1,75 @@ +"""Test the public API of the tools package.""" +from langchain.vectorstores import __all__ as public_api + +_EXPECTED = [ + "AlibabaCloudOpenSearch", + "AlibabaCloudOpenSearchSettings", + "AnalyticDB", + "Annoy", + "AtlasDB", + "AwaDB", + "AzureSearch", + "Bagel", + "Cassandra", + "Chroma", + "Clarifai", + "Clickhouse", + "ClickhouseSettings", + "DashVector", + "DeepLake", + "Dingo", + "DocArrayHnswSearch", + "DocArrayInMemorySearch", + "ElasticKnnSearch", + "ElasticVectorSearch", + "ElasticsearchStore", + "Epsilla", + "FAISS", + "Hologres", + "LanceDB", + "LLMRails", + "Marqo", + "MatchingEngine", + "Meilisearch", + "Milvus", + "MomentoVectorIndex", + "MongoDBAtlasVectorSearch", + "MyScale", + "MyScaleSettings", + "Neo4jVector", + "OpenSearchVectorSearch", + "PGEmbedding", + "PGVector", + "Pinecone", + "Qdrant", + "Redis", + "Rockset", + "SKLearnVectorStore", + "ScaNN", + "SemaDB", + "SingleStoreDB", + "SQLiteVSS", + "StarRocks", + "SupabaseVectorStore", + "Tair", + "Tigris", + "TimescaleVector", + "Typesense", + "USearch", + "Vald", + "Vearch", + "Vectara", + "VespaStore", + "Weaviate", + "ZepVectorStore", + "Zilliz", + "TencentVectorDB", + "AzureCosmosDBVectorSearch", + "VectorStore", +] + + +def test_public_api() -> None: + """Test for regressions or changes in the public API.""" + # Check that the public API is as expected + assert set(public_api) == set(_EXPECTED)