id
stringlengths
14
16
text
stringlengths
36
2.73k
source
stringlengths
49
117
0ee3fea68bda-31
None, max_iterations: Optional[int] = 15, max_execution_time: Optional[float] = None, early_stopping_method: str = 'force', verbose: bool = False, return_intermediate_steps: bool = False, agent_executor_kwargs: Optional[Dict[str, Any]] = None, **kwargs: Dict[str, Any]) → langchain.agents.agent.AgentExecutor[source]#
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-32
Construct a json agent from an LLM and tools. langchain.agents.create_pandas_dataframe_agent(llm: langchain.base_language.BaseLanguageModel, df: Any, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: Optional[str] = None, suffix: Optional[str] = None, input_variables: Optional[Lis...
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-33
langchain.agents.create_pbi_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: Optional[langchain.agents.agent_toolkits.powerbi.toolkit.PowerBIToolkit], powerbi: Optional[langchain.utilities.powerbi.PowerBIDataset] = None, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, pref...
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-34
format for a human, also make sure to represent numbers in readable ways, like 1M instead of 1000000. Unless the user specifies a specific number of examples they wish to obtain, always limit your query to at most {top_k} results.\n', suffix: str = 'Begin!\n\nQuestion: {input}\nThought: I can first ask which tables I h...
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-35
Optional[List[str]] = None, top_k: int = 10, verbose: bool = False, agent_executor_kwargs: Optional[Dict[str, Any]] = None, **kwargs: Dict[str, Any]) → langchain.agents.agent.AgentExecutor[source]#
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-36
Construct a pbi agent from an LLM and tools.
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-37
langchain.agents.create_pbi_chat_agent(llm: langchain.chat_models.base.BaseChatModel, toolkit: Optional[langchain.agents.agent_toolkits.powerbi.toolkit.PowerBIToolkit], powerbi: Optional[langchain.utilities.powerbi.PowerBIDataset] = None, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, ...
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-38
rows are asked find a way to write that in a easily readible format for a human, also make sure to represent numbers in readable ways, like 1M instead of 1000000. Unless the user specifies a specific number of examples they wish to obtain, always limit your query to at most {top_k} results.\n', suffix: str = "TOOLS\n--...
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-39
Construct a pbi agent from an Chat LLM and tools. If you supply only a toolkit and no powerbi dataset, the same LLM is used for both. langchain.agents.create_spark_dataframe_agent(llm: langchain.llms.base.BaseLLM, df: Any, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = '\...
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-40
langchain.agents.create_spark_sql_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: langchain.agents.agent_toolkits.spark_sql.toolkit.SparkSQLToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = 'You are an agent designed to interact with Spark SQL.\nGiven...
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-41
rewrite the query and try again.\n\nDO NOT make any DML statements (INSERT, UPDATE, DELETE, DROP etc.) to the database.\n\nIf the question does not seem related to the database, just return "I don\'t know" as the answer.\n', suffix: str = 'Begin!\n\nQuestion: {input}\nThought: I should look at the tables in the databas...
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-42
str = 'force', verbose: bool = False, agent_executor_kwargs: Optional[Dict[str, Any]] = None, **kwargs: Dict[str, Any]) → langchain.agents.agent.AgentExecutor[source]#
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-43
Construct a sql agent from an LLM and tools.
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-44
langchain.agents.create_sql_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: langchain.agents.agent_toolkits.sql.toolkit.SQLDatabaseToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = 'You are an agent designed to interact with a SQL database.\nGiven an ...
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-45
rewrite the query and try again.\n\nDO NOT make any DML statements (INSERT, UPDATE, DELETE, DROP etc.) to the database.\n\nIf the question does not seem related to the database, just return "I don\'t know" as the answer.\n', suffix: str = 'Begin!\n\nQuestion: {input}\nThought: I should look at the tables in the databas...
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-46
str = 'force', verbose: bool = False, agent_executor_kwargs: Optional[Dict[str, Any]] = None, **kwargs: Dict[str, Any]) → langchain.agents.agent.AgentExecutor[source]#
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-47
Construct a sql agent from an LLM and tools. langchain.agents.create_vectorstore_agent(llm: langchain.base_language.BaseLanguageModel, toolkit: langchain.agents.agent_toolkits.vectorstore.toolkit.VectorStoreToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = 'You are ...
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-48
Construct a vectorstore router agent from an LLM and tools. langchain.agents.get_all_tool_names() → List[str][source]# Get a list of all possible tool names. langchain.agents.initialize_agent(tools: Sequence[langchain.tools.base.BaseTool], llm: langchain.base_language.BaseLanguageModel, agent: Optional[langchain.agents...
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-49
langchain.agents.load_tools(tool_names: List[str], llm: Optional[langchain.base_language.BaseLanguageModel] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kwargs: Any) → List[langchain.tools.base.BaseTool][source]# Load tool...
https://python.langchain.com/en/latest/reference/modules/agents.html
0ee3fea68bda-50
Tools By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on May 28, 2023.
https://python.langchain.com/en/latest/reference/modules/agents.html
118babf3dd7f-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
118babf3dd7f-1
Loading logic for loading documents from Azure Blob Storage. load() → List[langchain.schema.Document][source]# Load documents. class langchain.document_loaders.AzureBlobStorageFileLoader(conn_str: str, container: str, blob_name: str)[source]# Loading logic for loading documents from Azure Blob Storage. load() → List[la...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-2
load() → List[langchain.schema.Document][source]# Load bibtex file documents from the given bibtex file path. See https://bibtexparser.readthedocs.io/en/master/ Parameters file_path – the path to the bibtex file Returns a list of documents with the document.page_content in text format class langchain.document_loaders.B...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-3
cookie by logging into the course and then copying the value of the BbRouter cookie from the browser’s developer tools. Example from langchain.document_loaders import BlackboardLoader loader = BlackboardLoader( blackboard_course_url="https://blackboard.example.com/webapps/blackboard/execute/announcement?method=sear...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-4
The Loader uses the Alchemy API to interact with the blockchain. ALCHEMY_API_KEY environment variable must be set to use this loader. The API returns 100 NFTs per request and can be paginated using the startToken parameter. If get_all_tokens is set to True, the loader will get all tokens on the contract. Note that for...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-5
column3: value3 load() → List[langchain.schema.Document][source]# Load data into document objects. class langchain.document_loaders.ChatGPTLoader(log_file: str, num_logs: int = - 1)[source]# Loader that loads conversations from exported ChatGPT data. load() → List[langchain.schema.Document][source]# Load data into docu...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-6
is set to False by default, if set to True all attachments will be downloaded and ConfluenceReader will extract the text from the attachments and add it to the Document object. Currently supported attachment types are: PDF, PNG, JPEG/JPG, SVG, Word and Excel. Hint: space_key and page_id can both be found in the URL of ...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-7
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, include_restricted_content: bool = False, include_archived_content: bool = False, include_attachments: bool = False, include_comments: bool = False,...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-8
doesn’t match the limit value. If limit is >100 confluence seems to cap the response to 100. Also, due to the Atlassian Python package, we don’t get the “next” values from the “_links” key because they only return the value from the results key. So here, the pagination starts from 0 and goes until the max_pages, getti...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-9
Validates proper combinations of init arguments class langchain.document_loaders.DataFrameLoader(data_frame: Any, page_content_column: str = 'text')[source]# Load Pandas DataFrames. load() → List[langchain.schema.Document][source]# Load from the dataframe. class langchain.document_loaders.DiffbotLoader(api_token: str, ...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-10
load() → List[langchain.schema.Document][source]# Load all chat messages. pydantic model langchain.document_loaders.DocugamiLoader[source]# Loader that loads processed docs from Docugami. To use, you should have the lxml python package installed. field access_token: Optional[str] = None# field api: str = 'https://api.d...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-11
are written into the page_content and none into the metadata. load() → List[langchain.schema.Document][source]# Load data into document objects. class langchain.document_loaders.EverNoteLoader(file_path: str, load_single_document: bool = True)[source]# EverNote Loader. Loads an EverNote notebook export file e.g. my_not...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-12
load() → List[langchain.schema.Document][source]# Load documents. class langchain.document_loaders.GCSFileLoader(project_name: str, bucket: str, blob: str)[source]# Loading logic for loading documents from GCS. load() → List[langchain.schema.Document][source]# Load documents. class langchain.document_loaders.GitLoader(...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-13
A Generic Google Api Client. To use, you should have the google_auth_oauthlib,youtube_transcript_api,google python package installed. As the google api expects credentials you need to set up a google account and register your Service. “https://developers.google.com/docs/api/quickstart/python” Example from langchain.doc...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-14
from langchain.document_loaders import GoogleApiYoutubeLoader google_api_client = GoogleApiClient( service_account_path=Path("path_to_your_sec_file.json") ) loader = GoogleApiYoutubeLoader( google_api_client=google_api_client, channel_name = "CodeAesthetic" ) load.load() add_video_info: bool = True# caption...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-15
class langchain.document_loaders.GutenbergLoader(file_path: str)[source]# Loader that uses urllib to load .txt web files. load() → List[langchain.schema.Document][source]# Load file. class langchain.document_loaders.HNLoader(web_path: Union[str, List[str]], header_template: Optional[dict] = None)[source]# Load Hacker N...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-16
class langchain.document_loaders.IFixitLoader(web_path: str)[source]# Load iFixit repair guides, device wikis and answers. iFixit is the largest, open repair community on the web. The site contains nearly 100k repair manuals, 200k Questions & Answers on 42k devices, and all the data is licensed under CC-BY. This loader...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-17
Load from a list of image files class langchain.document_loaders.JSONLoader(file_path: Union[str, pathlib.Path], jq_schema: str, content_key: Optional[str] = None, metadata_func: Optional[Callable[[Dict, Dict], Dict]] = None, text_content: bool = True)[source]# Loads a JSON file and references a jq schema provided to l...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-18
Load MediaWiki dump from XML file .. rubric:: Example from langchain.document_loaders import MWDumpLoader loader = MWDumpLoader( file_path="myWiki.xml", encoding="utf8" ) docs = loader.load() from langchain.text_splitter import RecursiveCharacterTextSplitter text_splitter = RecursiveCharacterTextSplitter( c...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-19
property url: str# wait_for_processing(pdf_id: str) → None[source]# class langchain.document_loaders.ModernTreasuryLoader(resource: str, organization_id: Optional[str] = None, api_key: Optional[str] = None)[source]# load() → List[langchain.schema.Document][source]# Load data into document objects. class langchain.docum...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-20
Loader that loads Obsidian files from disk. FRONT_MATTER_REGEX = re.compile('^---\\n(.*?)\\n---\\n', re.MULTILINE|re.DOTALL)# load() → List[langchain.schema.Document][source]# Load documents. pydantic model langchain.document_loaders.OneDriveLoader[source]# field auth_with_token: bool = False# field drive_id: str [Requ...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-21
Eagerly load the content. class langchain.document_loaders.PDFMinerPDFasHTMLLoader(file_path: str)[source]# Loader that uses PDFMiner to load PDF files as HTML content. load() → List[langchain.schema.Document][source]# Load file. class langchain.document_loaders.PDFPlumberLoader(file_path: str, text_kwargs: Optional[Ma...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-22
load() → List[langchain.schema.Document][source]# Load documents. class langchain.document_loaders.PyMuPDFLoader(file_path: str)[source]# Loader that uses PyMuPDF to load PDF files. load(**kwargs: Optional[Any]) → List[langchain.schema.Document][source]# Load file. class langchain.document_loaders.PyPDFDirectoryLoader(...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-23
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
118babf3dd7f-24
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
118babf3dd7f-25
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
118babf3dd7f-26
Load documents. langchain.document_loaders.TelegramChatLoader# alias of langchain.document_loaders.telegram.TelegramChatFileLoader class langchain.document_loaders.TextLoader(file_path: str, encoding: Optional[str] = None, autodetect_encoding: bool = False)[source]# Load text files. Parameters file_path – Path to the f...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-27
Twitter tweets loader. Read tweets of user twitter handle. First you need to go to https://developer.twitter.com/en/docs/twitter-api /getting-started/getting-access-to-the-twitter-api to get your token. And create a v2 version of the app. classmethod from_bearer_token(oauth2_bearer_token: str, twitter_users: Sequence[s...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-28
Loader that uses unstructured to load epub files. class langchain.document_loaders.UnstructuredEmailLoader(file_path: Union[str, List[str]], mode: str = 'single', **unstructured_kwargs: Any)[source]# Loader that uses unstructured to load email files. class langchain.document_loaders.UnstructuredFileIOLoader(file: Union...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-29
Loader that uses unstructured to load PDF files. class langchain.document_loaders.UnstructuredPowerPointLoader(file_path: Union[str, List[str]], mode: str = 'single', **unstructured_kwargs: Any)[source]# Loader that uses unstructured to load powerpoint files. class langchain.document_loaders.UnstructuredRTFLoader(file_...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-30
Load weather data for the given locations. class langchain.document_loaders.WebBaseLoader(web_path: Union[str, List[str]], header_template: Optional[dict] = None)[source]# Loader that uses urllib and beautiful soup to load webpages. aload() → List[langchain.schema.Document][source]# Load text from the urls in web_path ...
https://python.langchain.com/en/latest/reference/modules/document_loaders.html
118babf3dd7f-31
load() → List[langchain.schema.Document][source]# Load data into document objects. class langchain.document_loaders.YoutubeLoader(video_id: str, add_video_info: bool = False, language: 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
8f62ee4b5d44-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
8f62ee4b5d44-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
8f62ee4b5d44-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
8f62ee4b5d44-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
8f62ee4b5d44-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
8f62ee4b5d44-5
and index_to_docstore_id from. 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 ...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-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
8f62ee4b5d44-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
8f62ee4b5d44-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
8f62ee4b5d44-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
8f62ee4b5d44-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
8f62ee4b5d44-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
8f62ee4b5d44-12
Return type List[str] delete_collection() → None[source]# Delete the collection. 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....
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-13
Otherwise, the data will be ephemeral in-memory. Parameters texts (List[str]) – List of texts to add to the collection. collection_name (str) – Name of the collection to create. persist_directory (Optional[str]) – Directory to persist the collection. embedding (Optional[Embeddings]) – Embedding function. Defaults to No...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-14
filter (Optional[Dict[str, str]]) – Filter by metadata. Defaults to None. 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) → L...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-15
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_vector(embedding: List[float], k: int = 4, filter: Optional[Dict[str, str]] = None, **kwargs: Any) → List[langchain.schema.Document][source]...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-16
document (Document) – Document to update. 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: b...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-17
Returns List of IDs of the added texts. Return type List[str] 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...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-18
in either the environment 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...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-19
Return docs selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to query AND diversity among selected documents. :param embedding: Embedding to look up documents similar to. :param k: Number of Documents to return. Defaults to 4. :param fetch_k: Number of Documents to fetc...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-20
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...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-21
You can install it with pip install “langchain[docarray]”. 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...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-22
num_threads (int) – Sets the number of cpu threads to use. Defaults to 1. **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]] = None, work_dir: Optional[str] = None, n_dim: Op...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-23
Parameters embedding (Embeddings) – Embedding function. metric (str) – metric for exact nearest-neighbor search. Can be one of: “cosine_sim”, “euclidean_dist” and “sqeuclidean_dist”. Defaults to “cosine_sim”. **kwargs – Other keyword arguments to be passed to the get_doc_cls method. classmethod from_texts(texts: List[s...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-24
elasticsearch_url="http://localhost:9200", index_name="test_index", embedding=embedding ) To connect to an Elasticsearch instance that requires login credentials, including Elastic Cloud, use the Elasticsearch URL format https://username:password@es_host:9243. For example, to connect to Elastic Cloud, create th...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-25
embedding (Embeddings) – An object that provides the ability to embed text. It should be an instance of a class that subclasses the Embeddings abstract base class, such as OpenAIEmbeddings() Raises ValueError – If the elasticsearch python package is not installed. add_texts(texts: Iterable[str], metadatas: Optional[Lis...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-26
embeddings, elasticsearch_url="http://localhost:9200" ) 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. De...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-27
Run more texts through the embeddings and add to the vectorstore. Parameters text_embeddings – Iterable pairs of string and embedding to add to the vectorstore. 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 vectors...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-28
faiss = FAISS.from_embeddings(text_embedding_pairs, embeddings) classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) → langchain.vectorstores.faiss.FAISS[source]# Construct FAISS wrapper from raw...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-29
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 maximum diversity and 1 to minimum diversity. Defaults to 0.5. Returns List of Documents selected by maximal marginal relevance. max_mar...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-30
and index_to_docstore_id to. index_name – for saving with a specific index file name similarity_search(query: str, k: int = 4, **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...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-31
Returns List of Documents most similar to the query and score for each class langchain.vectorstores.LanceDB(connection: Any, embedding: langchain.embeddings.base.Embeddings, vector_key: Optional[str] = 'vector', id_key: Optional[str] = 'id', text_key: Optional[str] = 'text')[source]# Wrapper around LanceDB vector datab...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-32
Return documents most similar to the query Parameters query – String to query the vectorstore with. k – Number of documents to return. Returns List of documents most similar to the query. class langchain.vectorstores.Milvus(embedding_function: langchain.embeddings.base.Embeddings, collection_name: str = 'LangChainColle...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-33
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
8f62ee4b5d44-34
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
8f62ee4b5d44-35
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
8f62ee4b5d44-36
Returns Document results for search. Return type List[Document] similarity_search_by_vector(embedding: List[float], 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...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-37
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. Return type List[float], List[Tuple[Document, any, any]] similarity_search_with_score_by_vector(embedding: L...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-38
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 official site](https://docs.myscale.com/en/overview/) add_texts(texts: Iterable[str], metadatas: Optional[L...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-39
Defaults to 32. metadata (List[dict], optional) – metadata to texts. Defaults to None. into (Other keyword arguments will pass) – [clickhouse-connect](https://clickhouse.com/docs/en/integrations/python#clickhouse-connect-driver-api) Returns MyScale Index property metadata_column: str# similarity_search(query: str, k: i...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-40
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 Parameters query (str) – query string k (int...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-41
must be same size to number of columns. For example: .. code-block:: python { ‘id’: ‘text_id’, ‘vector’: ‘text_embedding’, ‘text’: ‘text_plain’, ‘metadata’: ‘metadata_dictionary_in_json’, } Defaults to identity map. Show JSON schema{ "title": "MyScaleSettings", "description": "MyScale Client Configuration\n\nAttr...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-42
"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...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-43
"type": "string" } }, "database": { "title": "Database", "default": "default", "env_names": "{'myscale_database'}", "type": "string" }, "table": { "title": "Table", "default": "langchain", "env_names": "{'myscale_table'}", ...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-44
field table: str = 'langchain'# field username: Optional[str] = None# class langchain.vectorstores.OpenSearchVectorSearch(opensearch_url: str, index_name: str, embedding_function: langchain.embeddings.base.Embeddings, **kwargs: Any)[source]# Wrapper around OpenSearch as a vector database. Example from langchain import ...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-45
texts, embeddings, opensearch_url="http://localhost:9200" ) OpenSearch by default supports Approximate Search powered by nmslib, faiss and lucene engines recommended for large datasets. Also supports brute force search through Script Scoring and Painless Scripting. Optional Args:vector_field: Document field emb...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-46
Returns List of Documents most similar to the query. Optional Args:vector_field: Document field embeddings are stored in. Defaults to “vector_field”. text_field: Document field the text of the document is stored in. Defaults to “text”. metadata_field: Document field that metadata is stored in. Defaults to “metadata”. C...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html
8f62ee4b5d44-47
Return docs and it’s scores most similar to query. By default supports Approximate Search. Also supports Script Scoring and Painless Scripting. Parameters query – Text to look up documents similar to. k – Number of Documents to return. Defaults to 4. Returns List of Documents along with its scores most similar to the q...
https://python.langchain.com/en/latest/reference/modules/vectorstores.html