id stringlengths 14 16 | text stringlengths 31 3.14k | source stringlengths 58 124 |
|---|---|---|
a17e6783cd11-25 | to get your token. And create a v2 version of the app.
classmethod from_bearer_token(oauth2_bearer_token: str, twitter_users: Sequence[str], number_tweets: Optional[int] = 100) β langchain.document_loaders.twitter.TwitterTweetLoader[source]#
Create a TwitterTweetLoader from OAuth2 bearer token.
classmethod from_secrets... | /content/https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
a17e6783cd11-26 | Loader that uses unstructured to load file IO objects.
class langchain.document_loaders.UnstructuredFileLoader(file_path: str, mode: str = 'single', **unstructured_kwargs: Any)[source]#
Loader that uses unstructured to load files.
class langchain.document_loaders.UnstructuredHTMLLoader(file_path: str, mode: str = 'sing... | /content/https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
a17e6783cd11-27 | Loader that uses unstructured to load powerpoint files.
class langchain.document_loaders.UnstructuredRTFLoader(file_path: str, mode: str = 'single', **unstructured_kwargs: Any)[source]#
Loader that uses unstructured to load rtf files.
class langchain.document_loaders.UnstructuredURLLoader(urls: List[str], continue_on_f... | /content/https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
a17e6783cd11-28 | load() β List[langchain.schema.Document][source]#
Load text from the url(s) in web_path.
requests_per_second: int = 2#
Max number of concurrent requests to make.
scrape(parser: Optional[str] = None) β Any[source]#
Scrape data from webpage and return it in BeautifulSoup format.
scrape_all(urls: List[str], parser: Option... | /content/https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
383d437f8931-0 | .rst
.pdf
Utilities
Utilities#
General utilities.
pydantic model langchain.utilities.ApifyWrapper[source]#
Wrapper around Apify.
To use, you should have the apify-client python package installed,
and the environment variable APIFY_API_TOKEN set with your API key, or pass
apify_api_token as a named parameter to the cons... | /content/https://python.langchain.com/en/latest/reference/modules/utilities.html |
383d437f8931-1 | in megabytes.
timeout_secs (int, optional) β Optional timeout for the run, in seconds.
Returns
A loader that will fetch the records from theActor runβs default dataset.
Return type
ApifyDatasetLoader
call_actor(actor_id: str, run_input: Dict, dataset_mapping_function: Callable[[Dict], langchain.schema.Document], *, bui... | /content/https://python.langchain.com/en/latest/reference/modules/utilities.html |
383d437f8931-2 | Return type
ApifyDatasetLoader
pydantic model langchain.utilities.ArxivAPIWrapper[source]#
Wrapper around ArxivAPI.
To use, you should have the arxiv python package installed.
https://lukasschwab.me/arxiv.py/index.html
This wrapper will use the Arxiv API to conduct searches and
fetch document summaries. By default, it ... | /content/https://python.langchain.com/en/latest/reference/modules/utilities.html |
383d437f8931-3 | field bing_search_url: str [Required]#
field bing_subscription_key: str [Required]#
field k: int = 10#
results(query: str, num_results: int) β List[Dict][source]#
Run query through BingSearch and return metadata.
Parameters
query β The query to search for.
num_results β The number of results to return.
Returns
snippet ... | /content/https://python.langchain.com/en/latest/reference/modules/utilities.html |
383d437f8931-4 | format_place_details(place_details: Dict[str, Any]) β Optional[str][source]#
run(query: str) β str[source]#
Run Places search and get k number of places that exists that match.
pydantic model langchain.utilities.GoogleSearchAPIWrapper[source]#
Wrapper for Google Search API.
Adapted from: Instructions adapted from https... | /content/https://python.langchain.com/en/latest/reference/modules/utilities.html |
383d437f8931-5 | β Setup Set Search the entire web to ON. Remove the URL you added from
the list of Sites to search.
Under Search engine ID youβll find the search-engine-ID.
4. Enable the Custom Search API
- Navigate to the APIs & ServicesβDashboard panel in Cloud Console.
- Click Enable APIs and Services.
- Search for Custom Search AP... | /content/https://python.langchain.com/en/latest/reference/modules/utilities.html |
383d437f8931-6 | to the constructor.
Example
from langchain import GoogleSerperAPIWrapper
google_serper = GoogleSerperAPIWrapper()
field gl: str = 'us'#
field hl: str = 'en'#
field k: int = 10#
field serper_api_key: Optional[str] = None#
run(query: str) β str[source]#
Run query through GoogleSearch and parse result.
pydantic model lang... | /content/https://python.langchain.com/en/latest/reference/modules/utilities.html |
383d437f8931-7 | field dataset_id: str [Required]#
field group_id: Optional[str] = None#
field impersonated_user_name: Optional[str] = None#
field sample_rows_in_table_info: int = 1#
Constraints
exclusiveMinimum = 0
maximum = 10
field schemas: Dict[str, str] [Optional]#
field table_names: List[str] [Required]#
field token: Optional[str... | /content/https://python.langchain.com/en/latest/reference/modules/utilities.html |
383d437f8931-8 | Simulates a standalone Python REPL.
field globals: Optional[Dict] [Optional] (alias '_globals')#
field locals: Optional[Dict] [Optional] (alias '_locals')#
run(command: str) β str[source]#
Run command with own globals/locals and returns anything printed.
pydantic model langchain.utilities.SearxSearchWrapper[source]#
Wr... | /content/https://python.langchain.com/en/latest/reference/modules/utilities.html |
383d437f8931-9 | field engines: Optional[List[str]] = []#
field headers: Optional[dict] = None#
field k: int = 10#
field params: dict [Optional]#
field query_suffix: Optional[str] = ''#
field searx_host: str = ''#
field unsecure: bool = False#
async aresults(query: str, num_results: int, engines: Optional[List[str]] = None, query_suffi... | /content/https://python.langchain.com/en/latest/reference/modules/utilities.html |
383d437f8931-10 | categories β List of categories to use for the query.
**kwargs β extra parameters to pass to the searx API.
Returns
{snippet: The description of the result.
title: The title of the result.
link: The link to the result.
engines: The engines used for the result.
category: Searx category of the result.
}
Return type
Dic... | /content/https://python.langchain.com/en/latest/reference/modules/utilities.html |
383d437f8931-11 | # to select the engine using `query_suffix`
searx.run("what is the weather in France ?", query_suffix="!qwant")
pydantic model langchain.utilities.SerpAPIWrapper[source]#
Wrapper around SerpAPI.
To use, you should have the google-search-results python package installed,
and the environment variable SERPAPI_API_KEY set ... | /content/https://python.langchain.com/en/latest/reference/modules/utilities.html |
383d437f8931-12 | The main purpose of this wrapper is to always return a text output.
field aiosession: Optional[aiohttp.client.ClientSession] = None#
field headers: Optional[Dict[str, str]] = None#
async adelete(url: str, **kwargs: Any) β str[source]#
DELETE the URL and return the text asynchronously.
async aget(url: str, **kwargs: Any... | /content/https://python.langchain.com/en/latest/reference/modules/utilities.html |
383d437f8931-13 | POST to the URL and return the text.
put(url: str, data: Dict[str, Any], **kwargs: Any) β str[source]#
PUT the URL and return the text.
property requests: langchain.requests.Requests#
pydantic model langchain.utilities.WikipediaAPIWrapper[source]#
Wrapper around WikipediaAPI.
To use, you should have the wikipedia pytho... | /content/https://python.langchain.com/en/latest/reference/modules/utilities.html |
d031f0d735c9-0 | .rst
.pdf
Example Selector
Example Selector#
Logic for selecting examples to include in prompts.
pydantic model langchain.prompts.example_selector.LengthBasedExampleSelector[source]#
Select examples based on length.
Validators
calculate_example_text_lengths Β» example_text_lengths
field example_prompt: langchain.prompts... | /content/https://python.langchain.com/en/latest/reference/modules/example_selector.html |
d031f0d735c9-1 | Number of examples to fetch to rerank.
classmethod from_examples(examples: List[dict], embeddings: langchain.embeddings.base.Embeddings, vectorstore_cls: Type[langchain.vectorstores.base.VectorStore], k: int = 4, input_keys: Optional[List[str]] = None, fetch_k: int = 20, **vectorstore_cls_kwargs: Any) β langchain.promp... | /content/https://python.langchain.com/en/latest/reference/modules/example_selector.html |
d031f0d735c9-2 | Select which examples to use based on semantic similarity.
pydantic model langchain.prompts.example_selector.SemanticSimilarityExampleSelector[source]#
Example selector that selects examples based on SemanticSimilarity.
field example_keys: Optional[List[str]] = None#
Optional keys to filter examples to.
field input_key... | /content/https://python.langchain.com/en/latest/reference/modules/example_selector.html |
d031f0d735c9-3 | Parameters
examples β List of examples to use in the prompt.
embeddings β An initialized embedding API interface, e.g. OpenAIEmbeddings().
vectorstore_cls β A vector store DB interface class, e.g. FAISS.
k β Number of examples to select
input_keys β If provided, the search is based on the input variables
instead of all... | /content/https://python.langchain.com/en/latest/reference/modules/example_selector.html |
b9476fe061db-0 | .rst
.pdf
Vector Stores
Vector Stores#
Wrappers on top of vector stores.
class langchain.vectorstores.AnalyticDB(connection_string: str, embedding_function: langchain.embeddings.base.Embeddings, collection_name: str = 'langchain', collection_metadata: Optional[dict] = None, pre_delete_collection: bool = False, logger: ... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-1 | Parameters
texts β Iterable of strings to add to the vectorstore.
metadatas β Optional list of metadatas associated with the texts.
kwargs β vectorstore specific parameters
Returns
List of ids from adding the texts into the vectorstore.
connect() β sqlalchemy.engine.base.Connection[source]#
classmethod connection_strin... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-2 | or set the PGVECTOR_CONNECTION_STRING environment variable.
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, collection_name: str = 'langchain', ids: Optional[List[str]] = None, pre_delete_collection: bool = False, **kwargs: Any) β langcha... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-3 | Returns
List of Documents most similar to the query.
similarity_search_by_vector(embedding: List[float], k: int = 4, filter: Optional[dict] = None, **kwargs: Any) β List[langchain.schema.Document][source]#
Return docs most similar to embedding vector.
Parameters
embedding β Embedding to look up documents similar to.
k ... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-4 | class langchain.vectorstores.Annoy(embedding_function: Callable, index: Any, metric: str, docstore: langchain.docstore.base.Docstore, index_to_docstore_id: Dict[int, str])[source]#
Wrapper around Annoy vector database.
To use, you should have the annoy python package installed.
Example
from langchain import Annoy
db = ... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-5 | text_embeddings β List of tuples of (text, embedding)
embedding β Embedding function to use.
metadatas β List of metadata dictionaries to associate with documents.
metric β Metric to use for indexing. Defaults to βangularβ.
trees β Number of trees to use for indexing. Defaults to 100.
n_jobs β Number of jobs to use for... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-6 | texts β List of documents to index.
embedding β Embedding function to use.
metadatas β List of metadata dictionaries to associate with documents.
metric β Metric to use for indexing. Defaults to βangularβ.
trees β Number of trees to use for indexing. Defaults to 100.
n_jobs β Number of jobs to use for indexing. Default... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-7 | Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
query β Text to look up documents similar to.
k β Number of Documents to return. Defaults to 4.
fetch_k β Number of Documents to fetch to pass to MMR... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-8 | Turns annoy results into a list of documents and scores.
Parameters
idxs β List of indices of the documents in the index.
dists β List of distances of the documents in the index.
Returns
List of Documents and scores.
save_local(folder_path: str, prefault: bool = False) β None[source]#
Save Annoy index, docstore, and in... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-9 | to n_trees * n if not provided
Returns
List of Documents most similar to the embedding.
similarity_search_by_vector(embedding: List[float], k: int = 4, search_k: int = - 1, **kwargs: Any) β List[langchain.schema.Document][source]#
Return docs most similar to embedding vector.
Parameters
embedding β Embedding to look up... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-10 | k β Number of Documents to return. Defaults to 4.
search_k β inspect up to search_k nodes which defaults
to n_trees * n if not provided
Returns
List of Documents most similar to the query and score for each
similarity_search_with_score_by_vector(embedding: List[float], k: int = 4, search_k: int = - 1) β List[Tuple[lang... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-11 | add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, refresh: bool = True, **kwargs: Any) β List[str][source]#
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts (Iterable[str]) β Texts to add to the vectorstore.
metadatas (Optional[Lis... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-12 | for full detail.
classmethod from_documents(documents: List[langchain.schema.Document], embedding: Optional[langchain.embeddings.base.Embeddings] = None, ids: Optional[List[str]] = None, name: Optional[str] = None, api_key: Optional[str] = None, persist_directory: Optional[str] = None, description: str = 'A description... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-13 | See https://docs.nomic.ai/atlas_api.html
Returns
Nomicβs neural database and finest rhizomatic instrument
Return type
AtlasDB
classmethod from_texts(texts: List[str], embedding: Optional[langchain.embeddings.base.Embeddings] = None, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, name: Optional... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-14 | reset_project_if_exists (bool) β Whether to reset this project if it
already exists. Default False.
Generally userful during development and testing.
index_kwargs (Optional[dict]) β Dict of kwargs for index creation.
See https://docs.nomic.ai/atlas_api.html
Returns
Nomicβs neural database and finest rhizomatic instrume... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-15 | embeddings = OpenAIEmbeddings()
vectorstore = Chroma("langchain_store", embeddings.embed_query)
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) β List[str][source]#
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts ... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-16 | Otherwise, the data will be ephemeral in-memory.
Parameters
collection_name (str) β Name of the collection to create.
persist_directory (Optional[str]) β Directory to persist the collection.
ids (Optional[List[str]]) β List of document IDs. Defaults to None.
documents (List[Document]) β List of documents to add to the ... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-17 | persist_directory (Optional[str]) β Directory to persist the collection.
embedding (Optional[Embeddings]) β Embedding function. Defaults to None.
metadatas (Optional[List[dict]]) β List of metadatas. Defaults to None.
ids (Optional[List[str]]) β List of document IDs. Defaults to None.
client_settings (Optional[chromadb... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-18 | Returns
List of Documents selected by maximal marginal relevance.
max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, filter: Optional[Dict[str, str]] = None, **kwargs: Any) β List[langchain.schema.Document][source]#
Return docs selected using the max... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-19 | Run similarity search with Chroma.
Parameters
query (str) β Query text to search for.
k (int) β Number of results to return. Defaults to 4.
filter (Optional[Dict[str, str]]) β Filter by metadata. Defaults to None.
Returns
List of documents most similar to the query text.
Return type
List[Document]
similarity_search_by_... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-20 | Return type
List[Tuple[Document, float]]
update_document(document_id: str, document: langchain.schema.Document) β None[source]#
Update a document in the collection.
Parameters
document_id (str) β ID of the document to update.
document (Document) β Document to update.
class langchain.vectorstores.DeepLake(dataset_path: ... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-21 | embeddings = OpenAIEmbeddings()
vectorstore = DeepLake("langchain_store", embeddings.embed_query)
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) β List[str][source]#
Run more texts through the embeddings and add to the vectorstore.
Parameters
text... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-22 | delete_dataset() β None[source]#
Delete the collection.
classmethod force_delete_by_path(path: str) β None[source]#
Force delete dataset by path
classmethod from_texts(texts: List[str], embedding: Optional[langchain.embeddings.base.Embeddings] = None, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = N... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-23 | In-memory path of the form mem://path/to/dataset which doesnβtsave the dataset, but keeps it in memory instead.
Should be used only for testing as it does not persist.
documents (List[Document]) β List of documents to add.
embedding (Optional[Embeddings]) β Embedding function. Defaults to None.
metadatas (Optional[List... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-24 | Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) β List[langchain.schema.Document][source]#
Return docs selected using the maximal marginal relevance.... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-25 | persist() β None[source]#
Persist the collection.
search(query: Any[str, None] = None, embedding: Any[float, None] = None, k: int = 4, distance_metric: str = 'L2', use_maximal_marginal_relevance: Optional[bool] = False, fetch_k: Optional[int] = 20, filter: Optional[Any[Dict[str, str], Callable, str]] = None, return_sco... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-26 | fetch_k β Number of Documents to fetch to pass to MMR algorithm.
Defaults to 20.
return_score β Whether to return the score. Defaults to False.
Returns
List of Documents selected by the specified distance metric,
if return_score True, return a tuple of (Document, score)
similarity_search(query: str, k: int = 4, **kwarg... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-27 | Returns
List of Documents most similar to the query vector.
similarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) β List[langchain.schema.Document][source]#
Return docs most similar to embedding vector.
Parameters
embedding β Embedding to look up documents similar to.
k β Number of Documents to... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-28 | Wrapper around Elasticsearch as a vector database.
To connect to an Elasticsearch instance that does not require
login credentials, pass the Elasticsearch URL and index name along with the
embedding object to the constructor.
Example
from langchain import ElasticVectorSearch
from langchain.embeddings import OpenAIEmbed... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-29 | Example
from langchain import ElasticVectorSearch
from langchain.embeddings import OpenAIEmbeddings
embedding = OpenAIEmbeddings()
elastic_host = "cluster_id.region_id.gcp.cloud.es.io"
elasticsearch_url = f"https://username:password@{elastic_host}:9243"
elastic_vector_search = ElasticVectorSearch(
elasticsearch_url... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-30 | Returns
List of ids from adding the texts into the vectorstore.
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) β langchain.vectorstores.elastic_vector_search.ElasticVectorSearch[source]#
Construct ElasticVectorSearch wrapp... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-31 | Returns
List of Documents most similar to the query.
similarity_search_with_score(query: str, k: int = 4, filter: Optional[dict] = None, **kwargs: Any) β List[Tuple[langchain.schema.Document, float]][source]#
Return docs most similar to query.
:param query: Text to look up documents similar to.
:param k: Number of Docu... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-32 | text_embeddings β Iterable pairs of string and embedding to
add to the vectorstore.
metadatas β Optional list of metadatas associated with the texts.
Returns
List of ids from adding the texts into the vectorstore.
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, **kwargs: Any) β List[str][source]... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-33 | faiss = FAISS.from_embeddings(text_embedding_pairs, embeddings)
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any) β langchain.vectorstores.faiss.FAISS[source]#
Construct FAISS wrapper from raw documents.
This is a user friend... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-34 | index_name β for saving with a specific index file name
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) β List[langchain.schema.Document][source]#
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similar... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-35 | of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
merge_from(target: langchain.vectorstores.faiss.FAISS) β None[source]#
Merge another FAISS object with the current one.
Add the target F... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-36 | Returns
List of Documents most similar to the embedding.
similarity_search_with_score(query: str, k: int = 4) β List[Tuple[langchain.schema.Document, float]][source]#
Return docs most similar to query.
Parameters
query β Text to look up documents similar to.
k β Number of Documents to return. Defaults to 4.
Returns
Lis... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-37 | Wrapper around the Milvus vector database.
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, timeout: Optional[int] = None, batch_size: int = 1000, **kwargs: Any) β List[str][source]#
Insert text data into Milvus.
Inserting data when the collection has not be made yet will result
in creating a new... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-38 | Returns
The resulting keys for each inserted element.
Return type
List[str]
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, collection_name: str = 'LangChainCollection', connection_args: dict[str, Any] = {'host': 'localhost', 'password': '', 'port': '19530', 'secu... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-39 | to None.
search_params (Optional[dict], optional) β Which search params to use.
Defaults to None.
drop_old (Optional[bool], optional) β Whether to drop the collection with
that name if it exists. Defaults to False.
Returns
Milvus Vector Store
Return type
Milvus
max_marginal_relevance_search(query: str, k: int = 4, fetc... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-40 | Returns
Document results for search.
Return type
List[Document]
max_marginal_relevance_search_by_vector(embedding: list[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, param: Optional[dict] = None, expr: Optional[str] = None, timeout: Optional[int] = None, **kwargs: Any) β List[Document][source]#
Perfo... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-41 | Returns
Document results for search.
Return type
List[Document]
similarity_search(query: str, k: int = 4, param: Optional[dict] = None, expr: Optional[str] = None, timeout: Optional[int] = None, **kwargs: Any) β List[langchain.schema.Document][source]#
Perform a similarity search against the query string.
Parameters
qu... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-42 | Defaults to None.
expr (str, optional) β Filtering expression. Defaults to None.
timeout (int, optional) β How long to wait before timeout error.
Defaults to None.
kwargs β Collection.search() keyword arguments.
Returns
Document results for search.
Return type
List[Document]
similarity_search_with_score(query: str, k: ... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-43 | Return type
List[float], List[Tuple[Document, any, any]]
similarity_search_with_score_by_vector(embedding: List[float], k: int = 4, param: Optional[dict] = None, expr: Optional[str] = None, timeout: Optional[int] = None, **kwargs: Any) β List[Tuple[langchain.schema.Document, float]][source]#
Perform a search on a query... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-44 | Wrapper around MyScale vector database
You need a clickhouse-connect python package, and a valid account
to connect to MyScale.
MyScale can not only search with simple vector indexes,
it also supports complex query with multiple conditions,
constraints and even sub-queries.
For more information, please visit[myscale of... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-45 | escape_str(value: str) β str[source]#
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[Dict[Any, Any]]] = None, config: Optional[langchain.vectorstores.myscale.MyScaleSettings] = None, text_ids: Optional[Iterable[str]] = None, batch_size: int = 32, **kwa... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-46 | Returns
MyScale Index
property metadata_column: str#
similarity_search(query: str, k: int = 4, where_str: Optional[str] = None, **kwargs: Any) β List[langchain.schema.Document][source]#
Perform a similarity search with MyScale
Parameters
query (str) β query string
k (int, optional) β Top K neighbors to retrieve. Defaul... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-47 | alone. The default name for it is metadata.
Returns
List of (Document, similarity)
Return type
List[Document]
similarity_search_with_relevance_scores(query: str, k: int = 4, where_str: Optional[str] = None, **kwargs: Any) β List[Tuple[langchain.schema.Document, float]][source]#
Perform a similarity search with MyScale
... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-48 | table (str) : Table name to operate on.
Defaults to βvector_tableβ.
metric (str)Metric to compute distance,supported are (βl2β, βcosineβ, βipβ). Defaults to βcosineβ.
column_map (Dict)Column type map to project column name onto langchainsemantics. Must have keys: text, id, vector,
must be same size to number of columns... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-49 | "description": "MyScale Client Configuration\n\nAttribute:\n myscale_host (str) : An URL to connect to MyScale backend.\n Defaults to 'localhost'.\n myscale_port (int) : URL port to connect with HTTP. Defaults to 8443.\n username (str) : Usernamed to login. Defaults to None.\n passwo... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-50 | "type": "object",
"properties": {
"host": {
"title": "Host",
"default": "localhost",
"env_names": "{'myscale_host'}",
"type": "string"
},
"port": {
"title": "Port",
"default": 8443,
"env_names": "{'myscale_port'}",
"type": "int... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-51 | "type": "object",
"additionalProperties": {
"type": "string"
}
},
"database": {
"title": "Database",
"default": "default",
"env_names": "{'myscale_database'}",
"type": "string"
},
"table": {
"title": "Table",
"de... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-52 | field index_param: Optional[Dict[str, str]] = None#
field index_type: str = 'IVFFLAT'#
field metric: str = 'cosine'#
field password: Optional[str] = None#
field port: int = 8443#
field table: str = 'langchain'#
field username: Optional[str] = None#
class langchain.vectorstores.OpenSearchVectorSearch(opensearch_url: str... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-53 | text_field: Document field the text of the document is stored in. Defaults
to βtextβ.
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, bulk_size: int = 500, **kwargs: Any) β langchain.vectorstores.opensearch_vector_search.OpenSearchVectorS... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-54 | ef_search: Size of the dynamic list used during k-NN searches. Higher values
lead to more accurate but slower searches; default: 512
ef_construction: Size of the dynamic list used during k-NN graph creation.
Higher values lead to more accurate graph but slower indexing speed;
default: 512
m: Number of bidirectional lin... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-55 | boolean_filter: A Boolean filter consists of a Boolean query that
contains a k-NN query and a filter.
subquery_clause: Query clause on the knn vector field; default: βmustβ
lucene_filter: the Lucene algorithm decides whether to perform an exact
k-NN search with pre-filtering or an approximate search with modified
post-... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-56 | Example
from langchain.vectorstores import Pinecone
from langchain.embeddings.openai import OpenAIEmbeddings
import pinecone
# The environment should be the one specified next to the API key
# in your Pinecone console
pinecone.init(api_key="***", environment="...")
index = pinecone.Index("langchain-demo")
embeddings = ... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-57 | Load pinecone vectorstore from index name.
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, batch_size: int = 32, text_key: str = 'text', index_name: Optional[str] = None, namespace: Optional[str] = None, *... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-58 | k β Number of Documents to return. Defaults to 4.
filter β Dictionary of argument(s) to filter on metadata
namespace β Namespace to search in. Default will search in ββ namespace.
Returns
List of Documents most similar to the query and score for each
similarity_search_with_score(query: str, k: int = 4, filter: Optional... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-59 | METADATA_KEY = 'metadata'#
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, **kwargs: Any) β List[str][source]#
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts β Iterable of strings to add to the vectorstore.
metadatas β Optional list of metadatas associated wit... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-60 | Construct Qdrant wrapper from a list of texts.
Parameters
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.
location β If :memory: - use in-m... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-61 | β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β.
Default: βCosin... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-62 | Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
query β Text to look up documents similar to.
k β Number of Documents to return. Defaults to 4.
fetch_k β Number of Documents to fetch to pass to MMR... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-63 | filter β Filter by metadata. Defaults to None.
Returns
List of Documents most similar to the query and score for each.
class langchain.vectorstores.SupabaseVectorStore(client: supabase.client.Client, embedding: Embeddings, table_name: str, query_name: Union[str, None] = None)[source]#
VectorStore for a Supabase postgre... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-64 | Returns
List of ids from adding the texts into the vectorstore.
add_vectors(vectors: List[List[float]], documents: List[langchain.schema.Document]) β List[str][source]#
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, client: Optional[supabase.client.Client] = None... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-65 | Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
max_marginal_relevance_search requires that query_name returns matched
embeddings alongside the match documents. The following function function
demonstrates how to do this:
```sql
CREATE FUNCTION match_documents_embeddings(query_embeddi... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-66 | lambda_mult β Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
query_name: str#
similarity_search(query: str, k: int = 4, **kwargs: Any... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-67 | Return docs and relevance scores in the range [0, 1].
0 is dissimilar, 1 is most similar.
table_name: str#
class langchain.vectorstores.VectorStore[source]#
Interface for vector stores.
async aadd_documents(documents: List[langchain.schema.Document], **kwargs: Any) β List[str][source]#
Run more documents through the em... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-68 | Parameters
texts β Iterable of strings to add to the vectorstore.
metadatas β Optional list of metadatas associated with the texts.
kwargs β vectorstore specific parameters
Returns
List of ids from adding the texts into the vectorstore.
async classmethod afrom_documents(documents: List[langchain.schema.Document], embed... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-69 | Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs: Any) β langchain.schema.BaseRetriever[source]#
async asimilarity_search(query: str, k: int = 4, **kwargs: Any) β List[langchain.schema.Document][source]#
Return docs most similar to query.
async asimilarity_search_by_vector(embedding: Lis... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-70 | Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
query β Text to look up documents similar to.
k β Number of Documents to return. Defaults to 4.
fetch_k β Number of Documents to fetch to pass to MMR... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-71 | Return docs most similar to query.
similarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) β List[langchain.schema.Document][source]#
Return docs most similar to embedding vector.
Parameters
embedding β Embedding to look up documents similar to.
k β Number of Documents to return. Defaults to 4.
R... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-72 | weaviate = Weaviate(client, index_name, text_key)
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, **kwargs: Any) β List[str][source]#
Upload texts with metadata (properties) to Weaviate.
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-73 | among selected documents.
Parameters
query β Text to look up documents similar to.
k β Number of Documents to return. Defaults to 4.
fetch_k β Number of Documents to fetch to pass to MMR algorithm.
lambda_mult β Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding
to max... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-74 | k β Number of Documents to return. Defaults to 4.
Returns
List of Documents most similar to the query.
similarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) β List[langchain.schema.Document][source]#
Look up similar documents by embedding vector in Weaviate.
class langchain.vectorstores.Zilliz(... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
b9476fe061db-75 | embedding (Embeddings) β Embedding function.
metadatas (Optional[List[dict]]) β Metadata for each text if it exists.
Defaults to None.
collection_name (str, optional) β Collection name to use. Defaults to
βLangChainCollectionβ.
connection_args (dict[str, Any], optional) β Connection args to use. Defaults
to DEFAULT_MIL... | /content/https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
aef5735bd363-0 | .rst
.pdf
Document Transformers
Document Transformers#
Transform documents
pydantic model langchain.document_transformers.EmbeddingsRedundantFilter[source]#
Filter that drops redundant documents by comparing their embeddings.
field embeddings: langchain.embeddings.base.Embeddings [Required]#
Embeddings to use for embed... | /content/https://python.langchain.com/en/latest/reference/modules/document_transformers.html |
1c188571ced0-0 | .rst
.pdf
Python REPL
Python REPL#
For backwards compatibility.
pydantic model langchain.python.PythonREPL[source]#
Simulates a standalone Python REPL.
field globals: Optional[Dict] [Optional] (alias '_globals')#
field locals: Optional[Dict] [Optional] (alias '_locals')#
run(command: str) β str[source]#
Run command wit... | /content/https://python.langchain.com/en/latest/reference/modules/python.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.