id
stringlengths
14
16
source
stringlengths
49
117
text
stringlengths
16
2.73k
63e878eb664f-8
https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/ifixit.html
hour to reset my phone and while I was tryin to connect my phone to my computer the computer also restarted smh does anyone else knows how I can get my phone to work… my problem is I have a black dot on the bottom left of my screen an it wont allow me to touch a certain part of my screen unless I rotate my phone and I ...
63e878eb664f-9
https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/ifixit.html
with the phone I had troubles with. It was my dads and turns out he carried it in his pocket. The phone itself had a little bend in it as a result. A little pressure in the opposite direction helped the issue. But it also had a tiny crack in the screen which wasnt obvious, once we added a screen protector this fixed th...
63e878eb664f-10
https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/ifixit.html
loader = IFixitLoader("https://www.ifixit.com/Device/Standard_iPad") data = loader.load() data [Document(page_content="Standard iPad\nThe standard edition of the tablet computer made by Apple.\n== Background Information ==\n\nOriginally introduced in January 2010, the iPad is Apple's standard edition of their tablet co...
63e878eb664f-11
https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/ifixit.html
[Document(page_content='Banana\nTasty fruit. Good source of potassium. Yellow.\n== Background Information ==\n\nCommonly misspelled, this wildly popular, phone shaped fruit serves as nutrition and an obstacle to slow down vehicles racing close behind you. Also used commonly as a synonym for “crazy” or “insane”.\n\nBota...
63e878eb664f-12
https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/ifixit.html
Document(page_content="# Banana Teardown\nIn this teardown, we open a banana to see what's inside. Yellow and delicious, but most importantly, yellow.\n\n\n###Tools Required:\n\n - Fingers\n\n - Teeth\n\n - Thumbs\n\n\n###Parts Required:\n\n - None\n\n\n## Step 1\nTake one banana from the bunch.\nDon't squeeze too har...
731b7d566d24-0
https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/azure_blob_storage_container.html
.ipynb .pdf Azure Blob Storage Container Contents Specifying a prefix Azure Blob Storage Container# Azure Blob Storage is Microsoft’s object storage solution for the cloud. Blob Storage is optimized for storing massive amounts of unstructured data. Unstructured data is data that doesn’t adhere to a particular data mo...
731b7d566d24-1
https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/azure_blob_storage_container.html
Specifying a prefix By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Jun 04, 2023.
9c166dd8917f-0
https://python.langchain.com/en/latest/reference/indexes.html
.rst .pdf Indexes Indexes# Indexes refer to ways to structure documents so that LLMs can best interact with them. LangChain has a number of modules that help you load, structure, store, and retrieve documents. Docstore Text Splitter Document Loaders Vector Stores Retrievers Document Compressors Document Transformers pr...
d5c0a5e3474e-0
https://python.langchain.com/en/latest/reference/prompts.html
.rst .pdf Prompts Prompts# The reference guides here all relate to objects for working with Prompts. PromptTemplates Example Selector Output Parsers previous How to serialize prompts next PromptTemplates By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Jun 04, 2023.
509c88a458e1-0
https://python.langchain.com/en/latest/reference/agents.html
.rst .pdf Agents Agents# Reference guide for Agents and associated abstractions. Agents Tools Agent Toolkits previous Memory next Agents By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Jun 04, 2023.
373e9c5a95a3-0
https://python.langchain.com/en/latest/reference/installation.html
.md .pdf Installation Contents Official Releases Installing from source Installation# Official Releases# LangChain is available on PyPi, so to it is easily installable with: pip install langchain That will install the bare minimum requirements of LangChain. A lot of the value of LangChain comes when integrating it wi...
26c30c8a2d88-0
https://python.langchain.com/en/latest/reference/models.html
.rst .pdf Models Models# LangChain provides interfaces and integrations for a number of different types of models. LLMs Chat Models Embeddings previous API References next Chat Models By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Jun 04, 2023.
9472f0bf3ff6-0
https://python.langchain.com/en/latest/reference/modules/chat_models.html
.rst .pdf Chat Models Chat Models# pydantic model langchain.chat_models.AzureChatOpenAI[source]# Wrapper around Azure OpenAI Chat Completion API. To use this class you must have a deployed model on Azure OpenAI. Use deployment_name in the constructor to refer to the “Model deployment name” in the Azure portal. In addit...
9472f0bf3ff6-1
https://python.langchain.com/en/latest/reference/modules/chat_models.html
it as a named parameter to the constructor. Example import anthropic from langchain.llms import Anthropic model = ChatAnthropic(model="<model_name>", anthropic_api_key="my-api-key") get_num_tokens(text: str) → int[source]# Calculate number of tokens. pydantic model langchain.chat_models.ChatGooglePalm[source]# Wrapper ...
9472f0bf3ff6-2
https://python.langchain.com/en/latest/reference/modules/chat_models.html
environment variable OPENAI_API_KEY set with your API key. Any parameters that are valid to be passed to the openai.create call can be passed in, even if not explicitly saved on this class. Example from langchain.chat_models import ChatOpenAI openai = ChatOpenAI(model_name="gpt-3.5-turbo") field max_retries: int = 6# M...
9472f0bf3ff6-3
https://python.langchain.com/en/latest/reference/modules/chat_models.html
Calculate num tokens for gpt-3.5-turbo and gpt-4 with tiktoken package. Official documentation: openai/openai-cookbook main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb get_token_ids(text: str) → List[int][source]# Get the tokens present in the text with tiktoken package. pydantic model langchain.chat_models.C...
9d45f2f3cb60-0
https://python.langchain.com/en/latest/reference/modules/python.html
.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...
a0d1b816d525-0
https://python.langchain.com/en/latest/reference/modules/example_selector.html
.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...
a0d1b816d525-1
https://python.langchain.com/en/latest/reference/modules/example_selector.html
Reshuffles examples dynamically based on query similarity. Parameters examples – List of examples to use in the prompt. embeddings – An iniialized 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,...
a0d1b816d525-2
https://python.langchain.com/en/latest/reference/modules/example_selector.html
Reshuffles examples dynamically based on query similarity. 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...
d8114540836d-0
https://python.langchain.com/en/latest/reference/modules/text_splitter.html
.rst .pdf Text Splitter Text Splitter# Functionality for splitting text. class langchain.text_splitter.CharacterTextSplitter(separator: str = '\n\n', **kwargs: Any)[source]# Implementation of splitting text that looks at characters. split_text(text: str) → List[str][source]# Split incoming text and return chunks. class...
d8114540836d-1
https://python.langchain.com/en/latest/reference/modules/text_splitter.html
class langchain.text_splitter.RecursiveCharacterTextSplitter(separators: Optional[List[str]] = None, keep_separator: bool = True, **kwargs: Any)[source]# Implementation of splitting text that looks at characters. Recursively tries to split by different characters to find one that works. classmethod from_language(langua...
d8114540836d-2
https://python.langchain.com/en/latest/reference/modules/text_splitter.html
Text splitter that uses HuggingFace tokenizer to count length. classmethod from_tiktoken_encoder(encoding_name: str = 'gpt2', model_name: Optional[str] = None, allowed_special: Union[Literal['all'], AbstractSet[str]] = {}, disallowed_special: Union[Literal['all'], Collection[str]] = 'all', **kwargs: Any) → langchain.te...
ac3008b8714c-0
https://python.langchain.com/en/latest/reference/modules/searx_search.html
.rst .pdf SearxNG Search Contents Quick Start Searching Engine Parameters Search Tips SearxNG Search# Utility for using SearxNG meta search API. SearxNG is a privacy-friendly free metasearch engine that aggregates results from multiple search engines and databases and supports the OpenSearch specification. More detai...
ac3008b8714c-1
https://python.langchain.com/en/latest/reference/modules/searx_search.html
s = SearxSearchWrapper(engines=['google', 'bing'], language='es') Search Tips# Searx offers a special search syntax that can also be used instead of passing engine parameters. For example the following query: s = SearxSearchWrapper("langchain library", engines=['github']) # can also be written as: s...
ac3008b8714c-2
https://python.langchain.com/en/latest/reference/modules/searx_search.html
For a list of public SearxNG instances see https://searx.space/ class langchain.utilities.searx_search.SearxResults(data: str)[source]# Dict like wrapper around search api results. property answers: Any# Helper accessor on the json result. pydantic model langchain.utilities.searx_search.SearxSearchWrapper[source]# Wrap...
ac3008b8714c-3
https://python.langchain.com/en/latest/reference/modules/searx_search.html
async aresults(query: str, num_results: int, engines: Optional[List[str]] = None, query_suffix: Optional[str] = '', **kwargs: Any) → List[Dict][source]# Asynchronously query with json results. Uses aiohttp. See results for more info. async arun(query: str, engines: Optional[List[str]] = None, query_suffix: Optional[str...
ac3008b8714c-4
https://python.langchain.com/en/latest/reference/modules/searx_search.html
engines – List of engines to use for the query. categories – List of categories to use for the query. **kwargs – extra parameters to pass to the searx API. Returns The result of the query. Return type str Raises ValueError – If an error occured with the query. Example This will make a query to the qwant engine: from la...
1ec6062faedb-0
https://python.langchain.com/en/latest/reference/modules/utilities.html
.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...
1ec6062faedb-1
https://python.langchain.com/en/latest/reference/modules/utilities.html
call_actor(actor_id: str, run_input: Dict, dataset_mapping_function: Callable[[Dict], langchain.schema.Document], *, build: Optional[str] = None, memory_mbytes: Optional[int] = None, timeout_secs: Optional[int] = None) → langchain.document_loaders.apify_dataset.ApifyDatasetLoader[source]# Run an Actor on the Apify plat...
1ec6062faedb-2
https://python.langchain.com/en/latest/reference/modules/utilities.html
ARXIV_MAX_QUERY_LENGTH – the cut limit on the query used for the arxiv tool. load_max_docs – a limit to the number of loaded documents load_all_available_meta – if True: the metadata of the loaded Documents gets all available meta info(see https://lukasschwab.me/arxiv.py/index.html#Result), if False: the metadata gets...
1ec6062faedb-3
https://python.langchain.com/en/latest/reference/modules/utilities.html
https://levelup.gitconnected.com/api-tutorial-how-to-use-bing-web-search-api-in-python-4165d5592a7e 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. Paramet...
1ec6062faedb-4
https://python.langchain.com/en/latest/reference/modules/utilities.html
run(query: str) → str[source]# pydantic model langchain.utilities.GooglePlacesAPIWrapper[source]# Wrapper around Google Places API. To use, you should have the googlemaps python package installed,an API key for the google maps platform, and the enviroment variable ‘’GPLACES_API_KEY’’ set with your API key , or pass ‘gp...
1ec6062faedb-5
https://python.langchain.com/en/latest/reference/modules/utilities.html
- Select Create credentials, then select API key from the drop-down menu. - The API key created dialog box displays your newly created key. - You now have an API_KEY 3. Setup Custom Search Engine so you can search the entire web - Create a custom search engine in this link. - In Sites to search, add any valid URL (i.e....
1ec6062faedb-6
https://python.langchain.com/en/latest/reference/modules/utilities.html
Wrapper around the Serper.dev Google Search API. You can create a free API key at https://serper.dev. To use, you should have the environment variable SERPER_API_KEY set with your API key, or pass serper_api_key as a named parameter to the constructor. Example from langchain import GoogleSerperAPIWrapper google_serper ...
1ec6062faedb-7
https://python.langchain.com/en/latest/reference/modules/utilities.html
Create a lambda function using the AWS Console or CLI Run aws configure and enter your AWS credentials field awslambda_tool_description: Optional[str] = None# field awslambda_tool_name: Optional[str] = None# field function_name: Optional[str] = None# run(query: str) → str[source]# Invoke Lambda function and parse resul...
1ec6062faedb-8
https://python.langchain.com/en/latest/reference/modules/utilities.html
Create PowerBI engine from dataset ID and credential or token. Use either the credential or a supplied token to authenticate. If both are supplied the credential is used to generate a token. The impersonated_user_name is the UPN of a user to be impersonated. If the model is not RLS enabled, this will be ignored. Valida...
1ec6062faedb-9
https://python.langchain.com/en/latest/reference/modules/utilities.html
Information about all tables in the database. pydantic model langchain.utilities.PubMedAPIWrapper[source]# Wrapper around PubMed API. This wrapper will use the PubMed API to conduct searches and fetch document summaries. By default, it will return the document summaries of the top-k results of an input search. Paramete...
1ec6062faedb-10
https://python.langchain.com/en/latest/reference/modules/utilities.html
run(command: str) → str[source]# Run command with own globals/locals and returns anything printed. pydantic model langchain.utilities.SearxSearchWrapper[source]# Wrapper for Searx API. To use you need to provide the searx host by passing the named parameter searx_host or exporting the environment variable SEARX_HOST. I...
1ec6062faedb-11
https://python.langchain.com/en/latest/reference/modules/utilities.html
Uses aiohttp. See results for more info. async arun(query: str, engines: Optional[List[str]] = None, query_suffix: Optional[str] = '', **kwargs: Any) → str[source]# Asynchronously version of run. results(query: str, num_results: int, engines: Optional[List[str]] = None, categories: Optional[List[str]] = None, query_suf...
1ec6062faedb-12
https://python.langchain.com/en/latest/reference/modules/utilities.html
str Raises ValueError – If an error occured with the query. Example This will make a query to the qwant engine: from langchain.utilities import SearxSearchWrapper searx = SearxSearchWrapper(searx_host="http://my.searx.host") searx.run("what is the weather in France ?", engine="qwant") # the same result can be achieved ...
1ec6062faedb-13
https://python.langchain.com/en/latest/reference/modules/utilities.html
run(query: str, **kwargs: Any) → str[source]# Run query through SerpAPI and parse result. class langchain.utilities.SparkSQL(spark_session: Optional[SparkSession] = None, catalog: Optional[str] = None, schema: Optional[str] = None, ignore_tables: Optional[List[str]] = None, include_tables: Optional[List[str]] = None, s...
1ec6062faedb-14
https://python.langchain.com/en/latest/reference/modules/utilities.html
pydantic model langchain.utilities.TextRequestsWrapper[source]# Lightweight wrapper around requests library. 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, **kwar...
1ec6062faedb-15
https://python.langchain.com/en/latest/reference/modules/utilities.html
pydantic model langchain.utilities.TwilioAPIWrapper[source]# Sms Client using Twilio. To use, you should have the twilio python package installed, and the environment variables TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, and TWILIO_FROM_NUMBER, or pass account_sid, auth_token, and from_number as named parameters to the cons...
1ec6062faedb-16
https://python.langchain.com/en/latest/reference/modules/utilities.html
characters in length. to – The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format for SMS/MMS or [Channel user address](https://www.twilio.com/docs/sms/channels#channel-addresses) for other 3rd-party channels. pydantic model langchain.utilities.WikipediaAPIWrapper[source]# Wrappe...
1ec6062faedb-17
https://python.langchain.com/en/latest/reference/modules/utilities.html
Last updated on Jun 04, 2023.
8f4ec7b51027-0
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
.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: ...
8f4ec7b51027-1
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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, collection_name: str = 'langchain', ids: Optional[Li...
8f4ec7b51027-2
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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.Document][source]# Return docs most similar to embedding ve...
8f4ec7b51027-3
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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 with the texts. kwargs – vecto...
8f4ec7b51027-4
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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: Any) → langchain.vectorstores.annoy.Annoy[source]# Construct Annoy wrapper from raw documents. Parameters texts – List...
8f4ec7b51027-5
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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...
8f4ec7b51027-6
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
save_local(folder_path: str, prefault: bool = False) → None[source]# Save Annoy index, docstore, and index_to_docstore_id to disk. Parameters folder_path – folder path to save index, docstore, and index_to_docstore_id to. prefault – Whether to pre-load the index into memory. similarity_search(query: str, k: int = 4, se...
8f4ec7b51027-7
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
Returns List of Documents most similar to the embedding. similarity_search_with_score(query: str, 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 – Number of Documents to return. Defau...
8f4ec7b51027-8
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
class langchain.vectorstores.AtlasDB(name: str, embedding_function: Optional[langchain.embeddings.base.Embeddings] = None, api_key: Optional[str] = None, description: str = 'A description for your project', is_public: bool = True, reset_project_if_exists: bool = False)[source]# Wrapper around Atlas: Nomic’s neural data...
8f4ec7b51027-9
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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 for your project...
8f4ec7b51027-10
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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[str] = None, api_key: Optional[str] = None, description: str = 'A description for your project', is_public: bool = True, rese...
8f4ec7b51027-11
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
k (int) – Number of results to return. Defaults to 4. Returns List of documents most similar to the query text. Return type List[Document] class langchain.vectorstores.Chroma(collection_name: str = 'langchain', embedding_function: Optional[Embeddings] = None, persist_directory: Optional[str] = None, client_settings: Op...
8f4ec7b51027-12
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
classmethod from_documents(documents: List[Document], embedding: Optional[Embeddings] = None, ids: Optional[List[str]] = None, collection_name: str = 'langchain', persist_directory: Optional[str] = None, client_settings: Optional[chromadb.config.Settings] = None, client: Optional[chromadb.Client] = None, **kwargs: Any)...
8f4ec7b51027-13
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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...
8f4ec7b51027-14
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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 maximal marginal relevance. Maximal marginal relevance optimizes for ...
8f4ec7b51027-15
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
similarity_search_by_vector(embedding: List[float], k: int = 4, filter: Optional[Dict[str, str]] = None, **kwargs: Any) → List[langchain.schema.Document][source]# Return docs most similar to embedding vector. :param embedding: Embedding to look up documents similar to. :type embedding: str :param k: Number of Documents...
8f4ec7b51027-16
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
class langchain.vectorstores.DeepLake(dataset_path: str = './deeplake/', token: Optional[str] = None, embedding_function: Optional[langchain.embeddings.base.Embeddings] = None, read_only: Optional[bool] = False, ingestion_batch_size: int = 1024, num_workers: int = 0, verbose: bool = True, **kwargs: Any)[source]# Wrappe...
8f4ec7b51027-17
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
delete(ids: Any[List[str], None] = None, filter: Any[Dict[str, str], None] = None, delete_all: Any[bool, None] = None) → bool[source]# Delete the entities in the dataset Parameters ids (Optional[List[str]], optional) – The document_ids to delete. Defaults to None. filter (Optional[Dict[str, str]], optional) – The filte...
8f4ec7b51027-18
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
Local file system path of the form ./path/to/dataset or~/path/to/dataset or path/to/dataset. 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. embe...
8f4ec7b51027-19
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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...
8f4ec7b51027-20
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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. Returns List of Documents most simil...
8f4ec7b51027-21
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
classmethod from_params(embedding: langchain.embeddings.base.Embeddings, work_dir: str, n_dim: int, dist_metric: Literal['cosine', 'ip', 'l2'] = 'cosine', max_elements: int = 1024, index: bool = True, ef_construction: int = 200, ef: int = 10, M: int = 16, allow_replace_deleted: bool = True, num_threads: int = 1, **kwar...
8f4ec7b51027-22
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, work_dir: Optional[str] = None, n_dim: Optional[int] = None, **kwargs: Any) → langchain.vectorstores.docarray.hnsw.DocArrayHnswSearch[source]# Create an DocArrayHnswSearch store and insert d...
8f4ec7b51027-23
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
Defaults to “cosine_sim”. **kwargs – Other keyword arguments to be passed to the get_doc_cls method. classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[Dict[Any, Any]]] = None, **kwargs: Any) → langchain.vectorstores.docarray.in_memory.DocArrayInMemorySear...
8f4ec7b51027-24
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
Cloud, create the Elasticsearch URL with the required authentication details and pass it to the ElasticVectorSearch constructor as the named parameter elasticsearch_url. You can obtain your Elastic Cloud URL and login credentials by logging in to the Elastic Cloud console at https://cloud.elastic.co, selecting your dep...
8f4ec7b51027-25
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, refresh_indices: bool = True, **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 ...
8f4ec7b51027-26
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
similarity_search(query: str, k: int = 4, filter: Optional[dict] = None, **kwargs: Any) → List[langchain.schema.Document][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 List of Documents most similar to the q...
8f4ec7b51027-27
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
metadatas – Optional list of metadatas associated with the texts. ids – Optional list of unique IDs. Returns List of ids from adding the texts into the vectorstore. add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) → List[str][source]# Run more texts...
8f4ec7b51027-28
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
This is a user friendly interface that: Embeds documents. Creates an in memory docstore Initializes the FAISS database This is intended to be a quick way to get started. Example from langchain import FAISS from langchain.embeddings import OpenAIEmbeddings embeddings = OpenAIEmbeddings() faiss = FAISS.from_texts(texts, ...
8f4ec7b51027-29
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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. Maximal marginal relevance optimizes for similarity to query AND diversity among s...
8f4ec7b51027-30
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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]# Return docs most similar to embedding vector. Parameters embedding – Embedding to look up documents similar to. k – Number of Documents to return. Defaul...
8f4ec7b51027-31
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
result = vectorstore.similarity_search('text1') add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) → List[str][source]# Turn texts into embedding and add it to the database Parameters texts – Iterable of strings to add to the vectorstore. metadatas – ...
8f4ec7b51027-32
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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 Collection. The data of the first entity d...
8f4ec7b51027-33
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
Create a Milvus collection, indexes it with HNSW, and insert data. Parameters texts (List[str]) – Text data. 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 “LangC...
8f4ec7b51027-34
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
to maximum diversity and 1 to minimum diversity. Defaults to 0.5 param (dict, optional) – The search params for the specified index. 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.sea...
8f4ec7b51027-35
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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 query (str) – The text to search. k (int, optional) – How many res...
8f4ec7b51027-36
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
similarity_search_with_score(query: str, 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 string and return results with score. For more information about the search pa...
8f4ec7b51027-37
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
k (int, optional) – The amount of results ot return. Defaults to 4. param (dict) – The search params for the specified index. 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() k...
8f4ec7b51027-38
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
classmethod from_connection_string(connection_string: str, namespace: str, embedding: langchain.embeddings.base.Embeddings, **kwargs: Any) → langchain.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch[source]# classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, coll...
8f4ec7b51027-39
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
similarity_search_with_score(query: str, *, k: int = 4, pre_filter: Optional[dict] = None, post_filter_pipeline: Optional[List[Dict]] = None) → List[Tuple[langchain.schema.Document, float]][source]# Return MongoDB documents most similar to query, along with scores. Use the knnBeta Operator available in MongoDB Atlas Se...
8f4ec7b51027-40
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, batch_size: int = 32, ids: Optional[Iterable[str]] = 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. ids – Optional list o...
8f4ec7b51027-41
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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. Defaults to 4. where_str (Optional[str], optional) – where ...
8f4ec7b51027-42
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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 dealing with metadatas, remember to use {self.metadata_column}.attribute instead of at...
8f4ec7b51027-43
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
"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) : Username to login. Defaults to None.\n passwor...
8f4ec7b51027-44
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
"type": "integer" }, "username": { "title": "Username", "env_names": "{'myscale_username'}", "type": "string" }, "password": { "title": "Password", "env_names": "{'myscale_password'}", "type": "string" }, "index_type": { ...
8f4ec7b51027-45
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
"title": "Metric", "default": "cosine", "env_names": "{'myscale_metric'}", "type": "string" } }, "additionalProperties": false } Config env_file: str = .env env_file_encoding: str = utf-8 env_prefix: str = myscale_ Fields column_map (Dict[str, str]) database (str) host (str) index...
8f4ec7b51027-46
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, bulk_size: int = 500, **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 with the...
8f4ec7b51027-47
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
Optional Keyword Args for Approximate Search:engine: “nmslib”, “faiss”, “lucene”; default: “nmslib” space_type: “l2”, “l1”, “cosinesimil”, “linf”, “innerproduct”; default: “l2” ef_search: Size of the dynamic list used during k-NN searches. Higher values lead to more accurate but slower searches; default: 512 ef_constru...
8f4ec7b51027-48
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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-filtering. Optional Args for Script Scoring Search:search_type: “s...
8f4ec7b51027-49
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
To use, you should have the pinecone-client python package installed. 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="***", env...
8f4ec7b51027-50
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
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, **kwargs: Any) → langchain.vectorstores.pine...
8f4ec7b51027-51
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
similarity_search_with_score(query: str, k: int = 4, filter: Optional[dict] = None, namespace: Optional[str] = None) → List[Tuple[langchain.schema.Document, float]][source]# Return pinecone documents most similar to query, along with scores. Parameters query – Text to look up documents similar to. k – Number of Documen...
8f4ec7b51027-52
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
ids – Optional list of ids to associate with the texts. Ids have to be uuid-like strings. batch_size – How many vectors upload per-request. Default: 64 Returns List of ids from adding the texts into the vectorstore. classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Opt...
8f4ec7b51027-53
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
url – either host or str of “Optional[scheme], host, Optional[port], Optional[prefix]”. Default: 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 ...