from_texts(
cls,
texts: List[str],
embedding: Optional[Embeddings| Name | Type | Description |
|---|---|---|
texts* | List[str] | Texts to add to vector store. |
embedding* | Optional[Embeddings] | Text embedding model to use. |
client | Optional[weaviate.WeaviateClient] | Default: None |
metadatas | Optional[List[dict]] | Default: None |
tenant | Optional[str] | Default: None |
index_name | Optional[str] | Default: None |
text_key | str | Default: 'text' |
relevance_score_fn | Optional[Callable[[float], float]] | Default: _default_score_normalizer |
**kwargs | Any | Default: {} |
Construct Weaviate wrapper from raw documents.
This is a user-friendly interface that:
This is intended to be a quick way to get started.
Example:
from langchain_community.embeddings import OpenAIEmbeddings
from langchain_community.vectorstores import Weaviate
embeddings = OpenAIEmbeddings()
weaviate = Weaviate.from_texts(
texts,
embeddings,
client=client
)weaviate.Client to use.
Metadata associated with each text.
The tenant name.
Index name.
Key to use for uploading/retrieving text to/from vectorstore.
Function for converting whatever distance function the
vector store uses to a relevance score, which is a normalized similarity
score (0 means dissimilar, 1 means similar).
Additional named parameters to pass to Weaviate.__init__().