Source code for langchain_elasticsearch.vectorstores
fromtypingimportAny,Optionalfromlangchain_elasticsearch._async.vectorstoresimport(AsyncBM25Strategyas_AsyncBM25Strategy,)fromlangchain_elasticsearch._async.vectorstoresimport(AsyncDenseVectorScriptScoreStrategyas_AsyncDenseVectorScriptScoreStrategy,)fromlangchain_elasticsearch._async.vectorstoresimport(AsyncDenseVectorStrategyas_AsyncDenseVectorStrategy,)fromlangchain_elasticsearch._async.vectorstoresimport(AsyncElasticsearchStoreas_AsyncElasticsearchStore,)fromlangchain_elasticsearch._async.vectorstoresimport(AsyncRetrievalStrategyas_AsyncRetrievalStrategy,)fromlangchain_elasticsearch._async.vectorstoresimport(AsyncSparseVectorStrategyas_AsyncSparseVectorStrategy,)fromlangchain_elasticsearch._async.vectorstoresimport(DistanceMetric,# noqa: F401Document,Embeddings,)fromlangchain_elasticsearch._sync.vectorstoresimport(BM25Strategyas_BM25Strategy,)fromlangchain_elasticsearch._sync.vectorstoresimport(DenseVectorScriptScoreStrategyas_DenseVectorScriptScoreStrategy,)fromlangchain_elasticsearch._sync.vectorstoresimport(DenseVectorStrategyas_DenseVectorStrategy,)fromlangchain_elasticsearch._sync.vectorstoresimport(ElasticsearchStoreas_ElasticsearchStore,)fromlangchain_elasticsearch._sync.vectorstoresimport(RetrievalStrategyas_RetrievalStrategy,)fromlangchain_elasticsearch._sync.vectorstoresimport(SparseVectorStrategyas_SparseVectorStrategy,)# deprecated strategy classesfromlangchain_elasticsearch._utilitiesimport(# noqa: F401ApproxRetrievalStrategy,BaseRetrievalStrategy,BM25RetrievalStrategy,DistanceStrategy,ExactRetrievalStrategy,SparseRetrievalStrategy,)# langchain defines some sync methods as abstract in its base class# so we have to add dummy methods for them, even though we only use the async versions
[docs]@classmethoddeffrom_texts(cls,texts:list[str],embedding:Embeddings,metadatas:Optional[list[dict]]=None,*,ids:Optional[list[str]]=None,**kwargs:Any,)->"AsyncElasticsearchStore":raiseNotImplementedError("This class is asynchronous, use afrom_texts()")
[docs]defsimilarity_search(self,query:str,k:int=4,**kwargs:Any)->list[Document]:raiseNotImplementedError("This class is asynchronous, use asimilarity_search()")
# these are only defined here so that they are picked up by Langchain's docs generator