mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-02 19:34:04 +00:00
Qdrant Client: Expose instance for creating client (#9706)
Expose classmethods to convenient initialize the vectostore. The purpose of this PR is to make it easy for users to initialize an empty vectorstore that's properly pre-configured without having to index documents into it via `from_documents`. This will make it easier for users to rely on the following indexing code: https://github.com/langchain-ai/langchain/pull/9614 to help manage data in the qdrant vectorstore.
This commit is contained in:
parent
610f46d83a
commit
5edf819524
@ -1298,7 +1298,7 @@ class Qdrant(VectorStore):
|
|||||||
embeddings = OpenAIEmbeddings()
|
embeddings = OpenAIEmbeddings()
|
||||||
qdrant = Qdrant.from_texts(texts, embeddings, "localhost")
|
qdrant = Qdrant.from_texts(texts, embeddings, "localhost")
|
||||||
"""
|
"""
|
||||||
qdrant = cls._construct_instance(
|
qdrant = cls.construct_instance(
|
||||||
texts,
|
texts,
|
||||||
embedding,
|
embedding,
|
||||||
location,
|
location,
|
||||||
@ -1474,7 +1474,7 @@ class Qdrant(VectorStore):
|
|||||||
embeddings = OpenAIEmbeddings()
|
embeddings = OpenAIEmbeddings()
|
||||||
qdrant = await Qdrant.afrom_texts(texts, embeddings, "localhost")
|
qdrant = await Qdrant.afrom_texts(texts, embeddings, "localhost")
|
||||||
"""
|
"""
|
||||||
qdrant = await cls._aconstruct_instance(
|
qdrant = await cls.aconstruct_instance(
|
||||||
texts,
|
texts,
|
||||||
embedding,
|
embedding,
|
||||||
location,
|
location,
|
||||||
@ -1510,7 +1510,7 @@ class Qdrant(VectorStore):
|
|||||||
return qdrant
|
return qdrant
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _construct_instance(
|
def construct_instance(
|
||||||
cls: Type[Qdrant],
|
cls: Type[Qdrant],
|
||||||
texts: List[str],
|
texts: List[str],
|
||||||
embedding: Embeddings,
|
embedding: Embeddings,
|
||||||
@ -1676,7 +1676,7 @@ class Qdrant(VectorStore):
|
|||||||
return qdrant
|
return qdrant
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def _aconstruct_instance(
|
async def aconstruct_instance(
|
||||||
cls: Type[Qdrant],
|
cls: Type[Qdrant],
|
||||||
texts: List[str],
|
texts: List[str],
|
||||||
embedding: Embeddings,
|
embedding: Embeddings,
|
||||||
|
Loading…
Reference in New Issue
Block a user