from_texts() — langchain Function Reference
Architecture documentation for the from_texts() function in vectorstores.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 5332632e_17d4_e4b9_c812_20dfbc3378dd["from_texts()"] bf62db79_4217_463c_798f_6f8528ed0d6e["Qdrant"] 5332632e_17d4_e4b9_c812_20dfbc3378dd -->|defined in| bf62db79_4217_463c_798f_6f8528ed0d6e 6780cd3a_be3f_1089_88f0_156df0ed5e2b["construct_instance()"] 5332632e_17d4_e4b9_c812_20dfbc3378dd -->|calls| 6780cd3a_be3f_1089_88f0_156df0ed5e2b 4da39fb6_0b3c_26e3_93cd_edfd42d30436["add_texts()"] 5332632e_17d4_e4b9_c812_20dfbc3378dd -->|calls| 4da39fb6_0b3c_26e3_93cd_edfd42d30436 style 5332632e_17d4_e4b9_c812_20dfbc3378dd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/qdrant/langchain_qdrant/vectorstores.py lines 1193–1370
def from_texts(
cls: type[Qdrant],
texts: list[str],
embedding: Embeddings,
metadatas: list[dict] | None = None,
ids: Sequence[str] | None = None,
location: str | None = None,
url: str | None = None,
port: int | None = 6333,
grpc_port: int = 6334,
prefer_grpc: bool = False, # noqa: FBT001, FBT002
https: bool | None = None, # noqa: FBT001
api_key: str | None = None,
prefix: str | None = None,
timeout: int | None = None,
host: str | None = None,
path: str | None = None,
collection_name: str | None = None,
distance_func: str = "Cosine",
content_payload_key: str = CONTENT_KEY,
metadata_payload_key: str = METADATA_KEY,
vector_name: str | None = VECTOR_NAME,
batch_size: int = 64,
shard_number: int | None = None,
replication_factor: int | None = None,
write_consistency_factor: int | None = None,
on_disk_payload: bool | None = None, # noqa: FBT001
hnsw_config: models.HnswConfigDiff | None = None,
optimizers_config: models.OptimizersConfigDiff | None = None,
wal_config: models.WalConfigDiff | None = None,
quantization_config: models.QuantizationConfig | None = None,
init_from: models.InitFrom | None = None,
on_disk: bool | None = None, # noqa: FBT001
force_recreate: bool = False, # noqa: FBT001, FBT002
**kwargs: Any,
) -> Qdrant:
"""Construct Qdrant wrapper from a list of texts.
Args:
texts: A list of texts to be indexed in Qdrant.
embedding: A subclass of `Embeddings`, responsible for text vectorization.
metadatas:
An optional list of metadata. If provided it has to be of the same
length as a list of texts.
ids:
Optional list of ids to associate with the texts. Ids have to be
uuid-like strings.
location:
If ':memory:' - use in-memory Qdrant instance.
If `str` - use it as a `url` parameter.
If `None` - fallback to relying on `host` and `port` parameters.
url: either host or str of "scheme | None, host, port | None,
prefix | None".
port: Port of the REST API interface. Default: 6333
grpc_port: Port of the gRPC interface. Default: 6334
prefer_grpc:
If true - use gPRC interface whenever possible in custom methods.
Default: False
https: If true - use HTTPS(SSL) protocol. Default: None
api_key:
API key for authentication in Qdrant Cloud. Default: None
Can also be set via environment variable `QDRANT_API_KEY`.
prefix:
If not None - add prefix to the REST URL path.
Example: service/v1 will result in
http://localhost:6333/service/v1/{qdrant-endpoint} for REST API.
Default: None
timeout:
Timeout for REST and gRPC API requests.
Default: 5.0 seconds for REST and unlimited for gRPC
host:
Host name of Qdrant service. If url and host are None, set to
'localhost'. Default: None
path:
Path in which the vectors will be stored while using local mode.
Default: None
collection_name:
Name of the Qdrant collection to be used. If not provided,
it will be created randomly. Default: None
distance_func:
Distance function. One of: "Cosine" / "Euclid" / "Dot".
Domain
Subdomains
Source
Frequently Asked Questions
What does from_texts() do?
from_texts() is a function in the langchain codebase, defined in libs/partners/qdrant/langchain_qdrant/vectorstores.py.
Where is from_texts() defined?
from_texts() is defined in libs/partners/qdrant/langchain_qdrant/vectorstores.py at line 1193.
What does from_texts() call?
from_texts() calls 2 function(s): add_texts, construct_instance.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free