id stringlengths 14 16 | text stringlengths 36 2.73k | source stringlengths 49 117 |
|---|---|---|
7487ca26a34d-12 | Embed documents using a MiniMax embedding endpoint.
Parameters
texts – The list of texts to embed.
Returns
List of embeddings, one for each text.
embed_query(text: str) → List[float][source]#
Embed a query using a MiniMax embedding endpoint.
Parameters
text – The text to embed.
Returns
Embeddings for the text.
pydantic... | https://python.langchain.com/en/latest/reference/modules/embeddings.html |
7487ca26a34d-13 | )
mosaic_llm = MosaicMLInstructorEmbeddings(
endpoint_url=endpoint_url,
mosaicml_api_token="my-api-key"
)
field embed_instruction: str = 'Represent the document for retrieval: '#
Instruction used to embed documents.
field endpoint_url: str = 'https://models.hosted-on.mosaicml.hosting/instructor-large/v1/predict... | https://python.langchain.com/en/latest/reference/modules/embeddings.html |
7487ca26a34d-14 | the properties of your endpoint.
In addition, the deployment name must be passed as the model parameter.
Example
import os
os.environ["OPENAI_API_TYPE"] = "azure"
os.environ["OPENAI_API_BASE"] = "https://<your-endpoint.openai.azure.com/"
os.environ["OPENAI_API_KEY"] = "your AzureOpenAI key"
os.environ["OPENAI_API_VERSI... | https://python.langchain.com/en/latest/reference/modules/embeddings.html |
7487ca26a34d-15 | Call out to OpenAI’s embedding endpoint for embedding query text.
Parameters
text – The text to embed.
Returns
Embedding for the text.
pydantic model langchain.embeddings.SagemakerEndpointEmbeddings[source]#
Wrapper around custom Sagemaker Inference Endpoints.
To use, you must supply the endpoint name from your deploye... | https://python.langchain.com/en/latest/reference/modules/embeddings.html |
7487ca26a34d-16 | field endpoint_name: str = ''#
The name of the endpoint from the deployed Sagemaker model.
Must be unique within an AWS Region.
field model_kwargs: Optional[Dict] = None#
Key word arguments to pass to the model.
field region_name: str = ''#
The aws region where the Sagemaker model is deployed, eg. us-west-2.
embed_docu... | https://python.langchain.com/en/latest/reference/modules/embeddings.html |
7487ca26a34d-17 | def get_pipeline():
model_id = "facebook/bart-large"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
return pipeline("feature-extraction", model=model, tokenizer=tokenizer)
embeddings = SelfHostedEmbeddings(
model_load_fn=get_pipeline,
h... | https://python.langchain.com/en/latest/reference/modules/embeddings.html |
7487ca26a34d-18 | Parameters
text – The text to embed.
Returns
Embeddings for the text.
pydantic model langchain.embeddings.SelfHostedHuggingFaceEmbeddings[source]#
Runs sentence_transformers embedding models on self-hosted remote hardware.
Supported hardware includes auto-launched instances on AWS, GCP, Azure,
and Lambda, as well as se... | https://python.langchain.com/en/latest/reference/modules/embeddings.html |
7487ca26a34d-19 | Runs InstructorEmbedding embedding models on self-hosted remote hardware.
Supported hardware includes auto-launched instances on AWS, GCP, Azure,
and Lambda, as well as servers specified
by IP address and SSH credentials (such as on-prem, or another
cloud like Paperspace, Coreweave, etc.).
To use, you should have the r... | https://python.langchain.com/en/latest/reference/modules/embeddings.html |
7487ca26a34d-20 | Returns
Embeddings for the text.
langchain.embeddings.SentenceTransformerEmbeddings#
alias of langchain.embeddings.huggingface.HuggingFaceEmbeddings
pydantic model langchain.embeddings.TensorflowHubEmbeddings[source]#
Wrapper around tensorflow_hub embedding models.
To use, you should have the tensorflow_text python pac... | https://python.langchain.com/en/latest/reference/modules/embeddings.html |
6a450e95639a-0 | .rst
.pdf
Document Loaders
Document Loaders#
All different types of document loaders.
class langchain.document_loaders.AZLyricsLoader(web_path: Union[str, List[str]], header_template: Optional[dict] = None)[source]#
Loader that loads AZLyrics webpages.
load() → List[langchain.schema.Document][source]#
Load webpage.
cla... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-1 | Each document represents one Document.
The loader converts the original PDF format into the text.
load() → List[langchain.schema.Document][source]#
Load data into document objects.
class langchain.document_loaders.AzureBlobStorageContainerLoader(conn_str: str, container: str, prefix: str = '')[source]#
Loading logic fo... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-2 | lazy_load() → Iterator[langchain.schema.Document][source]#
Load bibtex file using bibtexparser and get the article texts plus the
article metadata.
See https://bibtexparser.readthedocs.io/en/master/
Returns
a list of documents with the document.page_content in text format
load() → List[langchain.schema.Document][source... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-3 | Loader that loads all documents from a Blackboard course.
This loader is not compatible with all Blackboard courses. It is only
compatible with courses that use the new Blackboard interface.
To use this loader, you must have the BbRouter cookie. You can get this
cookie by logging into the course and then copying the va... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-4 | Loads elements from a blockchain smart contract into Langchain documents.
The supported blockchains are: Ethereum mainnet, Ethereum Goerli testnet,
Polygon mainnet, and Polygon Mumbai testnet.
If no BlockchainType is specified, the default is Ethereum mainnet.
The Loader uses the Alchemy API to interact with the blockc... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-5 | name of a column in the CSV file.
The source of each document will then be set to the value of the column
with the name specified in source_column.
Output Example:column1: value1
column2: value2
column3: value3
load() → List[langchain.schema.Document][source]#
Load data into document objects.
class langchain.document_l... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-6 | This currently supports username/api_key, Oauth2 login or personal access token
authentication.
Specify a list page_ids and/or space_key to load in the corresponding pages into
Document objects, if both are specified the union of both sets will be returned.
You can also specify a boolean include_attachments to include ... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-7 | Raises
ValueError – Errors while validating input
ImportError – Required dependencies not installed.
is_public_page(page: dict) → bool[source]#
Check if a page is publicly accessible.
load(space_key: Optional[str] = None, page_ids: Optional[List[str]] = None, label: Optional[str] = None, cql: Optional[str] = None, incl... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-8 | ImportError – _description_
Returns
_description_
Return type
List[Document]
paginate_request(retrieval_method: Callable, **kwargs: Any) → List[source]#
Paginate the various methods to retrieve groups of pages.
Unfortunately, due to page size, sometimes the Confluence API
doesn’t match the limit value. If limit is >10... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-9 | Process a list of pages into a list of documents.
process_pdf(link: str, ocr_languages: Optional[str] = None) → str[source]#
process_svg(link: str, ocr_languages: Optional[str] = None) → str[source]#
process_xls(link: str) → str[source]#
static validate_init_args(url: Optional[str] = None, api_key: Optional[str] = None... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-10 | Loading logic for loading documents from a directory.
load() → List[langchain.schema.Document][source]#
Load documents.
load_file(item: pathlib.Path, path: pathlib.Path, docs: List[langchain.schema.Document], pbar: Optional[Any]) → None[source]#
class langchain.document_loaders.DiscordChatLoader(chat_log: pd.DataFrame,... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-11 | Load given path as single page.
class langchain.document_loaders.DuckDBLoader(query: str, database: str = ':memory:', read_only: bool = False, config: Optional[Dict[str, str]] = None, page_content_columns: Optional[List[str]] = None, metadata_columns: Optional[List[str]] = None)[source]#
Loads a query result from DuckD... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-12 | load() → List[langchain.schema.Document][source]#
Load documents from EverNote export file.
class langchain.document_loaders.FacebookChatLoader(path: str)[source]#
Loader that loads Facebook messages json directory dump.
load() → List[langchain.schema.Document][source]#
Load documents.
class langchain.document_loaders.... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-13 | load() → List[langchain.schema.Document][source]#
Load documents.
pydantic model langchain.document_loaders.GitHubIssuesLoader[source]#
Validators
validate_environment » all fields
validate_since » since
field assignee: Optional[str] = None#
Filter on assigned user. Pass ‘none’ for no user and ‘*’ for any user.
field c... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-14 | field state: Optional[Literal['open', 'closed', 'all']] = None#
Filter on issue state. Can be one of: ‘open’, ‘closed’, ‘all’.
lazy_load() → Iterator[langchain.schema.Document][source]#
Get issues of a GitHub repository.
Returns
page_content
metadata
url
title
creator
created_at
last_update_time
closed_time
number of c... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-15 | Load data into document objects.
class langchain.document_loaders.GitbookLoader(web_page: str, load_all_paths: bool = False, base_url: Optional[str] = None, content_selector: str = 'main')[source]#
Load GitBook data.
load from either a single page, or
load all (relative) paths in the navbar.
load() → List[langchain.sch... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-16 | Validate that either folder_id or document_ids is set, but not both.
class langchain.document_loaders.GoogleApiYoutubeLoader(google_api_client: langchain.document_loaders.youtube.GoogleApiClient, channel_name: Optional[str] = None, video_ids: Optional[List[str]] = None, add_video_info: bool = True, captions_language: s... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-17 | Loader that loads Google Docs from Google Drive.
Validators
validate_credentials_path » credentials_path
validate_inputs » all fields
field credentials_path: pathlib.Path = PosixPath('/home/docs/.credentials/credentials.json')#
field document_ids: Optional[List[str]] = None#
field file_ids: Optional[List[str]] = None#
... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-18 | Load items from an HN page.
class langchain.document_loaders.HuggingFaceDatasetLoader(path: str, page_content_column: str = 'text', name: Optional[str] = None, data_dir: Optional[str] = None, data_files: Optional[Union[str, Sequence[str], Mapping[str, Union[str, Sequence[str]]]]] = None, cache_dir: Optional[str] = None... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-19 | load_questions_and_answers(url_override: Optional[str] = None) → List[langchain.schema.Document][source]#
static load_suggestions(query: str = '', doc_type: str = 'all') → List[langchain.schema.Document][source]#
class langchain.document_loaders.IMSDbLoader(web_path: Union[str, List[str]], header_template: Optional[dic... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-20 | [“”, “”, “”] -> schema = .[]
load() → List[langchain.schema.Document][source]#
Load and return documents from the JSON file.
class langchain.document_loaders.JoplinLoader(access_token: Optional[str] = None, port: int = 41184, host: str = 'localhost')[source]#
Loader that fetches notes from Joplin.
In order to use this ... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-21 | encoding (str, optional) – Charset encoding, defaults to “utf8”
load() → List[langchain.schema.Document][source]#
Load from file path.
class langchain.document_loaders.MastodonTootsLoader(mastodon_accounts: Sequence[str], number_toots: Optional[int] = 100, exclude_replies: bool = False, access_token: Optional[str] = No... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-22 | Convenience constructor that builds the MaxCompute API wrapper fromgiven parameters.
Parameters
query – SQL query to execute.
endpoint – MaxCompute endpoint.
project – A project is a basic organizational unit of MaxCompute, which is
similar to a database.
access_id – MaxCompute access ID. Should be passed in directly o... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-23 | :type request_timeout_sec: int
load() → List[langchain.schema.Document][source]#
Load documents from the Notion database.
:returns: List of documents.
:rtype: List[Document]
load_page(page_id: str) → langchain.schema.Document[source]#
Read a page.
class langchain.document_loaders.NotionDirectoryLoader(path: str)[source... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-24 | Return type
List[Document]
Raises
ValueError – If the specified drive ID
does not correspond to a drive in the OneDrive storage. –
class langchain.document_loaders.OnlinePDFLoader(file_path: str)[source]#
Loader that loads online PDFs.
load() → List[langchain.schema.Document][source]#
Load documents.
class langchain.d... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-25 | alias of langchain.document_loaders.pdf.PyPDFLoader
class langchain.document_loaders.PlaywrightURLLoader(urls: List[str], continue_on_failure: bool = True, headless: bool = True, remove_selectors: Optional[List[str]] = None)[source]#
Loader that uses Playwright and to load a page and unstructured to load the html.
This... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-26 | load() → List[langchain.schema.Document][source]#
Load data into document objects.
class langchain.document_loaders.PyPDFLoader(file_path: str)[source]#
Loads a PDF with pypdf and chunks at character level.
Loader also stores page numbers in metadatas.
lazy_load() → Iterator[langchain.schema.Document][source]#
Lazy loa... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-27 | Load Python files, respecting any non-default encoding if specified.
class langchain.document_loaders.ReadTheDocsLoader(path: Union[str, pathlib.Path], encoding: Optional[str] = None, errors: Optional[str] = None, custom_html_tag: Optional[Tuple[str, dict]] = None, **kwargs: Optional[Any])[source]#
Loader that loads Re... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-28 | Loader for .srt (subtitle) files.
load() → List[langchain.schema.Document][source]#
Load using pysrt file.
class langchain.document_loaders.SeleniumURLLoader(urls: List[str], continue_on_failure: bool = True, browser: Literal['chrome', 'firefox'] = 'chrome', binary_location: Optional[str] = None, executable_path: Optio... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-29 | Loader that fetches a sitemap and loads those URLs.
load() → List[langchain.schema.Document][source]#
Load sitemap.
parse_sitemap(soup: Any) → List[dict][source]#
Parse sitemap xml and load into a list of dicts.
class langchain.document_loaders.SlackDirectoryLoader(zip_path: str, workspace_url: Optional[str] = None)[so... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-30 | load() → List[langchain.schema.Document][source]#
Load data into document objects.
class langchain.document_loaders.TelegramChatApiLoader(chat_entity: Optional[EntityLike] = None, api_id: Optional[int] = None, api_hash: Optional[str] = None, username: Optional[str] = None, file_path: str = 'telegram_data.json')[source]... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-31 | Lazily load the file.
load() → List[langchain.schema.Document][source]#
Load file.
class langchain.document_loaders.TomlLoader(source: Union[str, pathlib.Path])[source]#
A TOML document loader that inherits from the BaseLoader class.
This class can be initialized with either a single source file or a source
directory c... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-32 | include_comments – Whether to include the comments on the card in the
document.
include_checklist – Whether to include the checklist on the card in the
document.
card_filter – Filter on card status. Valid values are “closed”, “open”,
“all”.
extra_metadata – List of additional metadata fields to include as document
meta... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-33 | load() → List[langchain.schema.Document][source]#
Load tweets.
class langchain.document_loaders.UnstructuredAPIFileIOLoader(file: Union[IO, Sequence[IO]], mode: str = 'single', url: str = 'https://api.unstructured.io/general/v0/general', api_key: str = '', **unstructured_kwargs: Any)[source]#
Loader that uses the unstr... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-34 | Loader that uses unstructured to load file IO objects.
class langchain.document_loaders.UnstructuredFileLoader(file_path: Union[str, List[str]], mode: str = 'single', **unstructured_kwargs: Any)[source]#
Loader that uses unstructured to load files.
class langchain.document_loaders.UnstructuredHTMLLoader(file_path: Unio... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-35 | Loader that uses unstructured to load rtf files.
class langchain.document_loaders.UnstructuredURLLoader(urls: List[str], continue_on_failure: bool = True, mode: str = 'single', **unstructured_kwargs: Any)[source]#
Loader that uses unstructured to load HTML files.
load() → List[langchain.schema.Document][source]#
Load f... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-36 | aload() → List[langchain.schema.Document][source]#
Load text from the urls in web_path async into Documents.
default_parser: str = 'html.parser'#
Default parser to use for BeautifulSoup.
async fetch_all(urls: List[str]) → Any[source]#
Fetch all urls concurrently with rate limiting.
load() → List[langchain.schema.Docume... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6a450e95639a-37 | Load data into document objects.
class langchain.document_loaders.YoutubeLoader(video_id: str, add_video_info: bool = False, language: Union[str, Sequence[str]] = 'en', translation: str = 'en', continue_on_failure: bool = False)[source]#
Loader that loads Youtube transcripts.
static extract_video_id(youtube_url: str) →... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
6e0b17fecde7-0 | .rst
.pdf
Output Parsers
Output Parsers#
pydantic model langchain.output_parsers.CommaSeparatedListOutputParser[source]#
Parse out comma separated lists.
get_format_instructions() → str[source]#
Instructions on how the LLM output should be formatted.
parse(text: str) → List[str][source]#
Parse the output of an LLM call... | https://python.langchain.com/en/latest/reference/modules/output_parsers.html |
6e0b17fecde7-1 | Parameters
text – output of language model
Returns
structured output
pydantic model langchain.output_parsers.ListOutputParser[source]#
Class to parse the output of an LLM call to a list.
abstract parse(text: str) → List[str][source]#
Parse the output of an LLM call.
pydantic model langchain.output_parsers.OutputFixingP... | https://python.langchain.com/en/latest/reference/modules/output_parsers.html |
6e0b17fecde7-2 | and parses it into some structure.
Parameters
text – output of language model
Returns
structured output
pydantic model langchain.output_parsers.PydanticOutputParser[source]#
field pydantic_object: Type[langchain.output_parsers.pydantic.T] [Required]#
get_format_instructions() → str[source]#
Instructions on how the LLM ... | https://python.langchain.com/en/latest/reference/modules/output_parsers.html |
6e0b17fecde7-3 | pydantic model langchain.output_parsers.RetryOutputParser[source]#
Wraps a parser and tries to fix parsing errors.
Does this by passing the original prompt and the completion to another
LLM, and telling it the completion did not satisfy criteria in the prompt.
field parser: langchain.schema.BaseOutputParser[langchain.o... | https://python.langchain.com/en/latest/reference/modules/output_parsers.html |
6e0b17fecde7-4 | the prompt to do so.
Parameters
completion – output of language model
prompt – prompt value
Returns
structured output
pydantic model langchain.output_parsers.RetryWithErrorOutputParser[source]#
Wraps a parser and tries to fix parsing errors.
Does this by passing the original prompt, the completion, AND the error
that w... | https://python.langchain.com/en/latest/reference/modules/output_parsers.html |
6e0b17fecde7-5 | and parses it into some structure.
Parameters
text – output of language model
Returns
structured output
parse_with_prompt(completion: str, prompt_value: langchain.schema.PromptValue) → langchain.output_parsers.retry.T[source]#
Optional method to parse the output of an LLM call with a prompt.
The prompt is largely provi... | https://python.langchain.com/en/latest/reference/modules/output_parsers.html |
fa678718cb2d-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: ... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-1 | Return connection string from database parameters.
create_collection() → None[source]#
create_tables_if_not_exists() → None[source]#
delete_collection() → None[source]#
drop_tables() → None[source]#
classmethod from_documents(documents: List[langchain.schema.Document], embedding: langchain.embeddings.base.Embeddings, c... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-2 | 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.
similarity_search_by_vector(embedding: List[float], k: int = 4, filter: Optional[dict] = None, **kwargs: Any) → List[langchain.schema.Docum... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-3 | Example
from langchain import Annoy
db = Annoy(embedding_function, index, docstore, index_to_docstore_id)
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 t... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-4 | text_embedding_pairs = list(zip(texts, text_embeddings))
db = Annoy.from_embeddings(text_embedding_pairs, embeddings)
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, metric: str = 'angular', trees: int = 100, n_jobs: int = - 1, **kwargs: ... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-5 | embeddings – Embeddings to use when generating queries.
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... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-6 | Defaults to 0.5.
Returns
List of Documents selected by maximal marginal relevance.
process_index_results(idxs: List[int], dists: List[float]) → List[Tuple[langchain.schema.Document, float]][source]#
Turns annoy results into a list of documents and scores.
Parameters
idxs – List of indices of the documents in the index.... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-7 | 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... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-8 | 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[langchain.schema.Document, float]][source]#
Return docs most similar to query.
Parameters
query – Text to look up documents similar to.
k – ... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-9 | ids (Optional[List[str]]) – An optional list of ids.
refresh (bool) – Whether or not to refresh indices with the updated data.
Default True.
Returns
List of IDs of the added texts.
Return type
List[str]
create_index(**kwargs: Any) → Any[source]#
Creates an index in your project.
See
https://docs.nomic.ai/atlas_api.html... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-10 | 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 instrument
Return type
AtlasDB
classmethod from_texts(texts: List[str], embedding: Optional[langchain.embeddings.base.Embeddings] = None, metadatas: Optional[... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-11 | Returns
Nomic’s neural database and finest rhizomatic instrument
Return type
AtlasDB
similarity_search(query: str, k: int = 4, **kwargs: Any) → List[langchain.schema.Document][source]#
Run similarity search with AtlasDB
Parameters
query (str) – Query text to search for.
k (int) – Number of results to return. Defaults t... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-12 | Parameters
texts (List[str]) – List of texts to add to the table.
embedding (Optional[Embeddings]) – Embedding function. Defaults to None.
metadatas (Optional[List[dict]]) – List of metadatas. Defaults to None.
table_name (str) – Name of the table to create.
logging_and_data_dir (Optional[str]) – Directory of logging a... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-13 | Return docs and relevance scores, normalized on a scale from 0 to 1.
0 is dissimilar, 1 is most similar.
class langchain.vectorstores.Chroma(collection_name: str = 'langchain', embedding_function: Optional[Embeddings] = None, persist_directory: Optional[str] = None, client_settings: Optional[chromadb.config.Settings] =... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-14 | Create a Chroma vectorstore from a list of documents.
If a persist_directory is specified, the collection will be persisted there.
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... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-15 | ids (Optional[List[str]]) – List of document IDs. Defaults to None.
client_settings (Optional[chromadb.config.Settings]) – Chroma client settings
Returns
Chroma vectorstore.
Return type
Chroma
get(include: Optional[List[str]] = None) → Dict[str, Any][source]#
Gets the collection.
Parameters
include (Optional[List[str]]... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-16 | Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
embedding – Embedding 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 t... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-17 | :param k: Number of Documents to return. Defaults to 4.
:type k: int
:param filter: Filter by metadata. Defaults to None.
:type filter: Optional[Dict[str, str]]
Returns
List of Documents most similar to the query vector.
similarity_search_with_score(query: str, k: int = 4, filter: Optional[Dict[str, str]] = None, **kwa... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-18 | add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, batch_size: int = 32, ids: Optional[Iterable[str]] = None, **kwargs: Any) → List[str][source]#
Insert more texts through the embeddings and add to the VectorStore.
Parameters
texts – Iterable of strings to add to the VectorStore.
ids – Optional lis... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-19 | Returns
ClickHouse 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 ClickHouse
Parameters
query (str) – query string
k (int, optional) – Top K neighbors to retrieve. ... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-20 | Perform a similarity search with ClickHouse
Parameters
query (str) – query string
k (int, optional) – Top K neighbors to retrieve. Defaults to 4.
where_str (Optional[str], optional) – where condition string.
Defaults to None.
NOTE – Please do not let end-user to fill this and always be aware
of SQL injection. When deal... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-21 | ‘uuid’: ‘global_unique_id’
‘embedding’: ‘text_embedding’,
‘document’: ‘text_plain’,
‘metadata’: ‘metadata_dictionary_in_json’,
}
Defaults to identity map.
Show JSON schema{
"title": "ClickhouseSettings", | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-22 | Show JSON schema{
"title": "ClickhouseSettings",
"description": "ClickHouse Client Configuration\n\nAttribute:\n clickhouse_host (str) : An URL to connect to MyScale backend.\n Defaults to 'localhost'.\n clickhouse_port (int) : URL port to connect with HTTP. Defaults to 8443.\n us... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-23 | "type": "object",
"properties": {
"host": {
"title": "Host",
"default": "localhost",
"env_names": "{'clickhouse_host'}",
"type": "string"
},
"port": {
"title": "Port",
"default": 8123,
"env_names": "{'clickhouse_port'}",
"type"... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-24 | "type": "string"
}
},
"column_map": {
"title": "Column Map",
"default": {
"id": "id",
"uuid": "uuid",
"document": "document",
"embedding": "embedding",
"metadata": "metadata"
},
"env_names": "{'clickhous... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-25 | port (int)
table (str)
username (Optional[str])
field column_map: Dict[str, str] = {'document': 'document', 'embedding': 'embedding', 'id': 'id', 'metadata': 'metadata', 'uuid': 'uuid'}#
field database: str = 'default'#
field host: str = 'localhost'#
field index_param: Optional[Union[List, Dict]] = [100, "'L2Distance'"... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-26 | To use, you should have the deeplake python package installed.
Example
from langchain.vectorstores import DeepLake
from langchain.embeddings.openai import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
vectorstore = DeepLake("langchain_store", embeddings.embed_query)
add_texts(texts: Iterable[str], metadatas: Optiona... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-27 | 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]] = None, dataset_path: str = './deeplake/', **kwargs: Any) → langchain.vectorstores.deeplake.DeepLake[source]#
Create a ... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-28 | Returns
Deep Lake dataset.
Return type
DeepLake
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 similarity to q... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-29 | persist() → None[source]#
Persist the collection.
similarity_search(query: str, k: int = 4, **kwargs: Any) → List[langchain.schema.Document][source]#
Return docs most similar to query.
Parameters
query – text to embed and run the query on.
k – Number of Documents to return.
Defaults to 4.
query – Text to look up docume... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-30 | Run similarity search with Deep Lake with distance returned.
Parameters
query (str) – Query text to search for.
distance_metric – L2 for Euclidean, L1 for Nuclear, max L-infinity
distance, cos for cosine similarity, ‘dot’ for dot product.
Defaults to L2.
k (int) – Number of results to return. Defaults to 4.
filter (Opt... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-31 | n_dim (int) – dimension of an embedding.
dist_metric (str) – Distance metric for DocArrayHnswSearch can be one of:
“cosine”, “ip”, and “l2”. Defaults to “cosine”.
max_elements (int) – Maximum number of vectors that can be stored.
Defaults to 1024.
index (bool) – Whether an index should be built for this field.
Defaults... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-32 | n_dim (int) – dimension of an embedding.
**kwargs – Other keyword arguments to be passed to the __init__ method.
Returns
DocArrayHnswSearch Vector Store
class langchain.vectorstores.DocArrayInMemorySearch(doc_index: BaseDocIndex, embedding: langchain.embeddings.base.Embeddings)[source]#
Wrapper around in-memory storage... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-33 | if it exists. Defaults to None.
metric (str) – metric for exact nearest-neighbor search.
Can be one of: “cosine_sim”, “euclidean_dist” and “sqeuclidean_dist”.
Defaults to “cosine_sim”.
Returns
DocArrayInMemorySearch Vector Store
class langchain.vectorstores.ElasticVectorSearch(elasticsearch_url: str, index_name: str, e... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-34 | Locate the “elastic” user and click “Edit”
Click “Reset password”
Follow the prompts to reset the password
The format for Elastic Cloud URLs is
https://username:password@cluster_id.region_id.gcp.cloud.es.io:9243.
Example
from langchain import ElasticVectorSearch
from langchain.embeddings import OpenAIEmbeddings
embeddi... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-35 | create_index(client: Any, index_name: str, mapping: Dict) → None[source]#
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, elasticsearch_url: Optional[str] = None, index_name: Optional[str] = None, refresh_indices: bool = True, **kwargs: A... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-36 | :param k: Number of Documents to return. Defaults to 4.
Returns
List of Documents most similar to the query.
class langchain.vectorstores.FAISS(embedding_function: typing.Callable, index: typing.Any, docstore: langchain.docstore.base.Docstore, index_to_docstore_id: typing.Dict[int, str], relevance_score_fn: typing.Opti... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-37 | Returns
List of ids from adding the texts into the vectorstore.
classmethod from_embeddings(text_embeddings: List[Tuple[str, List[float]]], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) → langchain.vectorstores.faiss.FAISS[source... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-38 | Load FAISS index, docstore, and index_to_docstore_id from disk.
Parameters
folder_path – folder path to load index, docstore,
and index_to_docstore_id from.
embeddings – Embeddings to use when generating queries
index_name – for saving with a specific index file name
max_marginal_relevance_search(query: str, k: int = 4... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-39 | 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... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-40 | Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
Returns
List of documents most similar to the query text with
L2 distance in float. Lower score represents more similarity.
similarity_search_with_score_by_vector(embedding: List[float], k: int = 4) → List[Tuple[l... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-41 | Returns
List of ids of the added texts.
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, connection: Any = None, vector_key: Optional[str] = 'vector', id_key: Optional[str] = 'id', text_key: Optional[str] = 'text', **kwargs: Any) → langcha... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-42 | 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 with the texts.
kwargs – vectorstore specific parameters.
Returns
List of ids from adding the texts into the vectorstore.
classmethod from... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-43 | Return docs most similar to query.
Parameters
query – The string that will be used to search for similar documents.
k – The amount of neighbors that will be retrieved.
Returns
A list of k matching documents.
class langchain.vectorstores.Milvus(embedding_function: langchain.embeddings.base.Embeddings, collection_name: s... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-44 | Returns
The resulting keys for each inserted element.
Return type
List[str]
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, collection_name: str = 'LangChainCollection', connection_args: dict[str, Any] = {'host': 'localhost', 'password': ... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-45 | Returns
Milvus Vector Store
Return type
Milvus
max_marginal_relevance_search(query: str, 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[langchain.schema.Document][source]#
Perform a search and return... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
fa678718cb2d-46 | Parameters
embedding (str) – The embedding vector being searched.
k (int, optional) – How many results to give. Defaults to 4.
fetch_k (int, optional) – Total results to select k from.
Defaults to 20.
lambda_mult – Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding
to ... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.