id stringlengths 14 16 | text stringlengths 44 2.73k | source stringlengths 49 114 |
|---|---|---|
4589fafd44e6-35 | 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 |
4589fafd44e6-36 | of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics. \n\nGiven an input question, create a syntactically correct DAX query to run, then look at the results of the q... | https://python.langchain.com/en/latest/reference/modules/agents.html |
4589fafd44e6-37 | tool to create a query for me and then I should ask the query tool to execute it, finally create a complete sentence that answers the question. If you receive an error back that mentions that the query was wrong try to phrase the question differently and get a new query from the question to query tool.\n', suffix: str ... | https://python.langchain.com/en/latest/reference/modules/agents.html |
4589fafd44e6-38 | 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. | https://python.langchain.com/en/latest/reference/modules/agents.html |
4589fafd44e6-39 | langchain.agents.create_sql_agent(llm: langchain.llms.base.BaseLLM, 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 input question... | https://python.langchain.com/en/latest/reference/modules/agents.html |
4589fafd44e6-40 | 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 |
4589fafd44e6-41 | str = 'force', verbose: bool = False, **kwargs: Any) β langchain.agents.agent.AgentExecutor[source]# | https://python.langchain.com/en/latest/reference/modules/agents.html |
4589fafd44e6-42 | Construct a sql agent from an LLM and tools.
langchain.agents.create_vectorstore_agent(llm: langchain.llms.base.BaseLLM, toolkit: langchain.agents.agent_toolkits.vectorstore.toolkit.VectorStoreToolkit, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, prefix: str = 'You are an agent desig... | https://python.langchain.com/en/latest/reference/modules/agents.html |
4589fafd44e6-43 | Get a list of all possible tool names.
langchain.agents.initialize_agent(tools: Sequence[langchain.tools.base.BaseTool], llm: langchain.schema.BaseLanguageModel, agent: Optional[langchain.agents.agent_types.AgentType] = None, callback_manager: Optional[langchain.callbacks.base.BaseCallbackManager] = None, agent_path: O... | https://python.langchain.com/en/latest/reference/modules/agents.html |
4589fafd44e6-44 | llm β Optional language model, may be needed to initialize certain tools.
callback_manager β Optional callback manager. If not provided, default global callback manager will be used.
Returns
List of tools.
langchain.agents.tool(*args: Union[str, Callable], return_direct: bool = False, args_schema: Optional[Type[pydanti... | https://python.langchain.com/en/latest/reference/modules/agents.html |
5aaf4070e84d-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.
web... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-1 | load() β List[langchain.schema.Document][source]#
Load documents.
class langchain.document_loaders.BSHTMLLoader(file_path: str, open_encoding: Optional[str] = None, bs_kwargs: Optional[dict] = None)[source]#
Loader that uses beautiful soup to parse HTML files.
load() β List[langchain.schema.Document][source]#
Load data... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-2 | To use this loader, you must have the BbRouter cookie. You can get this
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://bl... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-3 | The Loader uses the Alchemy API to interact with the blockchain.
ALCHEMY_API_KEY environment variable must be set to use this loader.
Future versions of this loader can:
Support additional Alchemy APIs (e.g. getTransactions, etc.)
load() β List[langchain.schema.Document][source]#
Load data into document objects.
class ... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-4 | load() β List[langchain.schema.Document][source]#
Load from file path.
class langchain.document_loaders.CollegeConfidentialLoader(web_path: Union[str, List[str]], header_template: Optional[dict] = None)[source]#
Loader that loads College Confidential webpages.
load() β List[langchain.schema.Document][source]#
Load webp... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-5 | Example
from langchain.document_loaders import ConfluenceLoader
loader = ConfluenceLoader(
url="https://yoursite.atlassian.com/wiki",
username="me",
api_key="12345"
)
documents = loader.load(space_key="SPACE",limit=50)
Parameters
url (str) β _description_
api_key (str, optional) β _description_, defaults to... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-6 | include_attachments (bool, optional) β defaults to False
include_comments (bool, optional) β defaults to False
limit (int, optional) β Maximum number of pages to retrieve per request, defaults to 50
max_pages (int, optional) β Maximum number of pages to retrieve in total, defaults 1000
Raises
ValueError β _description_... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-7 | process_pdf(link: str) β str[source]#
process_svg(link: str) β str[source]#
process_xls(link: str) β str[source]#
static validate_init_args(url: Optional[str] = None, api_key: Optional[str] = None, username: Optional[str] = None, oauth2: Optional[dict] = None) β Optional[List][source]#
Validates proper combinations of ... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-8 | Load Discord chat logs.
load() β List[langchain.schema.Document][source]#
Load all chat messages.
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: Op... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-9 | load() β List[langchain.schema.Document][source]#
Load documents.
class langchain.document_loaders.GitLoader(repo_path: str, clone_url: Optional[str] = None, branch: Optional[str] = 'main', file_filter: Optional[Callable[[str], bool]] = None)[source]#
Loads files from a Git repository into a list of documents.
Reposito... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-10 | 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.document_loaders import GoogleApiClient
google_api_client = GoogleApiClient(
service_account_path=Path("pat... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-11 | )
loader = GoogleApiYoutubeLoader(
google_api_client=google_api_client,
channel_name = "CodeAesthetic"
)
load.load()
add_video_info: bool = True#
captions_language: str = 'en'#
channel_name: Optional[str] = None#
continue_on_failure: bool = False#
google_api_client: langchain.document_loaders.youtube.GoogleApiC... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-12 | 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 News data from either main page results or the comments page.
load() β List[langchain.schema.Document][source]#
Get importa... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-13 | 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 will allow you to download the text of a repair guide, text of Q&Aβs
and wikis from devices on iFixit using their open API... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-14 | Load from a list of image files
class langchain.document_loaders.NotebookLoader(path: str, include_outputs: bool = False, max_output_length: int = 10, remove_newline: bool = False, traceback: bool = False)[source]#
Loader that loads .ipynb notebook files.
load() β List[langchain.schema.Document][source]#
Load documents... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-15 | Loader that loads online PDFs.
file_path: str#
load() β List[langchain.schema.Document][source]#
Load documents.
class langchain.document_loaders.OutlookMessageLoader(file_path: str)[source]#
Loader that loads Outlook Message files using extract_msg.
TeamMsgExtractor/msg-extractor
load() β List[langchain.schema.Documen... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-16 | Load the specified URLs using Playwright and create Document instances.
Returns
A list of Document instances with loaded content.
Return type
List[Document]
class langchain.document_loaders.PyMuPDFLoader(file_path: str)[source]#
Loader that uses PyMuPDF to load PDF files.
file_path: str#
load(**kwargs: Optional[Any]) β... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-17 | Loading logic for loading documents from s3.
load() β List[langchain.schema.Document][source]#
Load documents.
class langchain.document_loaders.SRTLoader(file_path: str)[source]#
Loader for .srt (subtitle) files.
load() β List[langchain.schema.Document][source]#
Load using pysrt file.
class langchain.document_loaders.S... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-18 | parse_sitemap(soup: Any) β List[dict][source]#
Parse sitemap xml and load into a list of dicts.
web_paths: List[str]#
class langchain.document_loaders.SlackDirectoryLoader(zip_path: str, workspace_url: Optional[str] = None)[source]#
Loader for loading documents from a Slack directory dump.
load() β List[langchain.schem... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-19 | Create a TwitterTweetLoader from OAuth2 bearer token.
classmethod from_secrets(access_token: str, access_token_secret: str, consumer_key: str, consumer_secret: str, twitter_users: Sequence[str], number_tweets: Optional[int] = 100) β langchain.document_loaders.twitter.TwitterTweetLoader[source]#
Create a TwitterTweetLoa... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-20 | Loader that uses unstructured to load image files, such as PNGs and JPGs.
class langchain.document_loaders.UnstructuredMarkdownLoader(file_path: str, mode: str = 'single', **unstructured_kwargs: Any)[source]#
Loader that uses unstructured to load markdown files.
class langchain.document_loaders.UnstructuredPDFLoader(fi... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
5aaf4070e84d-21 | 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.Document][source]#
Load text from the url(s) in web_path.
requests_per_second: int = 2#
Max number of concurrent re... | https://python.langchain.com/en/latest/reference/modules/document_loaders.html |
bfa517a5f0f5-0 | .rst
.pdf
Utilities
Utilities#
General utilities.
pydantic model langchain.utilities.ApifyWrapper[source]#
Wrapper around Apify.
To use, you should have the apify-client python package installed,
and the environment variable APIFY_API_TOKEN set with your API key, or pass
apify_api_token as a named parameter to the cons... | https://python.langchain.com/en/latest/reference/modules/utilities.html |
bfa517a5f0f5-1 | Return type
ApifyDatasetLoader
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]#... | https://python.langchain.com/en/latest/reference/modules/utilities.html |
bfa517a5f0f5-2 | Run Arxiv search and get the document meta information.
See https://lukasschwab.me/arxiv.py/index.html#Search
See https://lukasschwab.me/arxiv.py/index.html#Result
It uses only the most informative fields of document meta information.
class langchain.utilities.BashProcess(strip_newlines: bool = False, return_err_output... | https://python.langchain.com/en/latest/reference/modules/utilities.html |
bfa517a5f0f5-3 | and the enviroment variable ββGPLACES_API_KEYββ
set with your API key , or pass βgplaces_api_keyβ
as a named parameter to the constructor.
By default, this will return the all the results on the input query.You can use the top_k_results argument to limit the number of results.
Example
from langchain import GooglePlaces... | https://python.langchain.com/en/latest/reference/modules/utilities.html |
bfa517a5f0f5-4 | 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. www.stackoverflow.com).
- Thatβs all you have to fill up, the rest doesnβt matter.
In the left-side menu, click Edit search engine β {your search engine name}
β Setu... | https://python.langchain.com/en/latest/reference/modules/utilities.html |
bfa517a5f0f5-5 | 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 = GoogleSerperAPIWrapper()
field gl: str = 'us'#
field hl: str = 'en'#
field k: int = 10#
field serper... | https://python.langchain.com/en/latest/reference/modules/utilities.html |
bfa517a5f0f5-6 | field sample_rows_in_table_info: int = 1#
Constraints
exclusiveMinimum = 0
maximum = 10
field schemas: Dict[str, str] [Optional]#
field table_names: List[str] [Required]#
field token: Optional[str] = None#
async aget_table_info(table_names: Optional[Union[List[str], str]] = None) β str[source]#
Get information about sp... | https://python.langchain.com/en/latest/reference/modules/utilities.html |
bfa517a5f0f5-7 | searx_host or exporting the environment variable SEARX_HOST.
In some situations you might want to disable SSL verification, for example
if you are running searx locally. You can do this by passing the named parameter
unsecure. You can also pass the host url scheme as http to disable SSL.
Example
from langchain.utilitie... | https://python.langchain.com/en/latest/reference/modules/utilities.html |
bfa517a5f0f5-8 | Asynchronously version of run.
results(query: str, num_results: int, engines: Optional[List[str]] = None, categories: Optional[List[str]] = None, query_suffix: Optional[str] = '', **kwargs: Any) β List[Dict][source]#
Run query through Searx API and returns the results with metadata.
Parameters
query β The query to sear... | https://python.langchain.com/en/latest/reference/modules/utilities.html |
bfa517a5f0f5-9 | 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 using the `!` syntax of searx
# to select the engine using `query_suffix`
searx.run("what is the weather in Fran... | https://python.langchain.com/en/latest/reference/modules/utilities.html |
bfa517a5f0f5-10 | The main purpose of this wrapper is to always return a text output.
field aiosession: Optional[aiohttp.client.ClientSession] = None#
field headers: Optional[Dict[str, str]] = None#
async adelete(url: str, **kwargs: Any) β str[source]#
DELETE the URL and return the text asynchronously.
async aget(url: str, **kwargs: Any... | https://python.langchain.com/en/latest/reference/modules/utilities.html |
bfa517a5f0f5-11 | Wrapper around WikipediaAPI.
To use, you should have the wikipedia python package installed.
This wrapper will use the Wikipedia API to conduct searches and
fetch page summaries. By default, it will return the page summaries
of the top-k results of an input search.
field lang: str = 'en'#
field top_k_results: int = 3#
... | https://python.langchain.com/en/latest/reference/modules/utilities.html |
79952f571f40-0 | .rst
.pdf
Example Selector
Example Selector#
Logic for selecting examples to include in prompts.
pydantic model langchain.prompts.example_selector.LengthBasedExampleSelector[source]#
Select examples based on length.
Validators
calculate_example_text_lengths Β» example_text_lengths
field example_prompt: langchain.prompts... | https://python.langchain.com/en/latest/reference/modules/example_selector.html |
79952f571f40-1 | Create k-shot example selector using example list and embeddings.
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.... | https://python.langchain.com/en/latest/reference/modules/example_selector.html |
79952f571f40-2 | Create k-shot example selector using example list and embeddings.
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... | https://python.langchain.com/en/latest/reference/modules/example_selector.html |
1d550228d9cb-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 |
1d550228d9cb-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 |
1d550228d9cb-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 |
1d550228d9cb-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 |
1d550228d9cb-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 |
1d550228d9cb-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 |
1d550228d9cb-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 |
1d550228d9cb-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 |
1d550228d9cb-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 |
1d550228d9cb-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 |
1d550228d9cb-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 |
1d550228d9cb-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 |
1d550228d9cb-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 |
1d550228d9cb-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 |
1d550228d9cb-14 | Returns
List of Documents selected by maximal marginal relevance.
max_marginal_relevance_search_by_vector(embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, filter: Optional[Dict[str, str]] = None, **kwargs: Any) β List[langchain.schema.Document][source]#
Return docs selected using the max... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-15 | 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]#
Return docs most similar to embedding vector.
:param embedding: Embeddin... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-16 | Wrapper around Deep Lake, a data lake for deep learning applications.
We implement naive similarity search and filtering for fast prototyping,
but it can be extended with Tensor Query Language (TQL) for production use cases
over billion rows.
Why Deep Lake?
Not only stores embeddings, but also the original data with ve... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-17 | ids (Optional[List[str]], optional) β The document_ids to delete.
Defaults to None.
filter (Optional[Dict[str, str]], optional) β The filter to delete by.
Defaults to None.
delete_all (Optional[bool], optional) β Whether to drop the dataset.
Defaults to None.
delete_dataset() β None[source]#
Delete the collection.
clas... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-18 | Should be used only for testing as it does not persist.
documents (List[Document]) β List of documents to add.
embedding (Optional[Embeddings]) β Embedding function. Defaults to None.
metadatas (Optional[List[dict]]) β List of metadatas. Defaults to None.
ids (Optional[List[str]]) β List of document IDs. Defaults to No... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-19 | :param k: Number of Documents to return. Defaults to 4.
:param fetch_k: Number of Documents to fetch to pass to MMR algorithm.
:param 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.
Retur... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-20 | maximal_marginal_relevance β Whether to use maximal marginal relevance.
Defaults to False.
fetch_k β Number of Documents to fetch to pass to MMR algorithm.
Defaults to 20.
return_score β Whether to return the score. Defaults to False.
Returns
List of Documents selected by the specified distance metric,
if return_score ... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-21 | k β Number of Documents to return. Defaults to 4.
Returns
List of Documents most similar to the query vector.
similarity_search_with_score(query: str, distance_metric: str = 'L2', k: int = 4, filter: Optional[Dict[str, str]] = None) β List[Tuple[langchain.schema.Document, float]][source]#
Run similarity search with Dee... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-22 | https://username:password@es_host:9243. For example, to connect to Elastic
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 t... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-23 | Raises
ValueError β If the elasticsearch python package is not installed.
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 ... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-24 | Returns
List of Documents most similar to the query.
similarity_search_with_score(query: str, k: int = 4, filter: Optional[dict] = None, **kwargs: Any) β List[Tuple[langchain.schema.Document, float]][source]#
Return docs most similar to query.
:param query: Text to look up documents similar to.
:param k: Number of Docu... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-25 | Parameters
texts β Iterable of strings to add to the vectorstore.
metadatas β Optional list of metadatas associated with the texts.
Returns
List of ids from adding the texts into the vectorstore.
classmethod from_embeddings(text_embeddings: List[Tuple[str, List[float]]], embedding: langchain.embeddings.base.Embeddings,... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-26 | Load FAISS index, docstore, and index_to_docstore_id to 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 |
1d550228d9cb-27 | 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 |
1d550228d9cb-28 | 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 query and score for each
similarity_search_with_score_by_vector(embedding: List[float], k: int = 4) β List[Tuple[langchain.schema.Do... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-29 | that they all fit in memory.
metadatas (Optional[List[dict]]) β Metadata dicts attached to each of
the texts. Defaults to None.
timeout (Optional[int]) β Timeout for each batch insert. Defaults
to None.
batch_size (int, optional) β Batch size to use for insertion.
Defaults to 1000.
Raises
MilvusException β Failure to a... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-30 | to None.
search_params (Optional[dict], optional) β Which search params to use.
Defaults to None.
drop_old (Optional[bool], optional) β Whether to drop the collection with
that name if it exists. Defaults to False.
Returns
Milvus Vector Store
Return type
Milvus
max_marginal_relevance_search(query: str, k: int = 4, fetc... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-31 | Returns
Document results for search.
Return type
List[Document]
max_marginal_relevance_search_by_vector(embedding: list[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, param: Optional[dict] = None, expr: Optional[str] = None, timeout: Optional[int] = None, **kwargs: Any) β List[Document][source]#
Perfo... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-32 | k (int, optional) β How many results to return. Defaults to 4.
param (dict, optional) β The search params for the index type.
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... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-33 | documentation found here:
https://milvus.io/api-reference/pymilvus/v2.2.6/Collection/search().md
Parameters
query (str) β The text being searched.
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) β Filter... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-34 | Returns
Result doc and score.
Return type
List[Tuple[Document, float]]
class langchain.vectorstores.MyScale(embedding: langchain.embeddings.base.Embeddings, config: Optional[langchain.vectorstores.myscale.MyScaleSettings] = None, **kwargs: Any)[source]#
Wrapper around MyScale vector database
You need a clickhouse-conne... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-35 | Create Myscale wrapper with existing texts
Parameters
embedding_function (Embeddings) β Function to extract text embedding
texts (Iterable[str]) β List or tuple of strings to be added
config (MyScaleSettings, Optional) β Myscale configuration
text_ids (Optional[Iterable], optional) β IDs for the texts.
Defaults to None... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-36 | Perform a similarity search with MyScale by vectors
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. W... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-37 | password (str) : Password to login. Defaults to None.
index_type (str): index type string.
index_param (dict): index build parameter.
database (str) : Database name to find the table. Defaults to βdefaultβ.
table (str) : Table name to operate on.
Defaults to βvector_tableβ.
metric (str)Metric to compute distance,suppor... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-38 | Defaults to identity map.
Show JSON schema{
"title": "MyScaleSettings",
"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... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-39 | },
"port": {
"title": "Port",
"default": 8443,
"env_names": "{'myscale_port'}",
"type": "integer"
},
"username": {
"title": "Username",
"env_names": "{'myscale_username'}",
"type": "string"
},
"password": {
"title": "P... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-40 | },
"table": {
"title": "Table",
"default": "langchain",
"env_names": "{'myscale_table'}",
"type": "string"
},
"metric": {
"title": "Metric",
"default": "cosine",
"env_names": "{'myscale_metric'}",
"type": "string"
}
},
... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-41 | Wrapper around OpenSearch as a vector database.
Example
from langchain import OpenSearchVectorSearch
opensearch_vector_search = OpenSearchVectorSearch(
"http://localhost:9200",
"embeddings",
embedding_function
)
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, bulk_size: int = 500, **... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-42 | search through Script Scoring and Painless Scripting.
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β.
Optional Keyword Args for Approximate Search:engine: βnmslibβ, βfaissβ, βluceneβ; d... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-43 | metadata_field: Document field that metadata is stored in. Defaults to
βmetadataβ.
Can be set to a special value β*β to include the entire document.
Optional Args for Approximate Search:search_type: βapproximate_searchβ; default: βapproximate_searchβ
size: number of results the query actually returns; default: 4
boolea... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-44 | from langchain.embeddings.openai import OpenAIEmbeddings
import pinecone
# The environment should be the one specified next to the API key
# in your Pinecone console
pinecone.init(api_key="***", environment="...")
index = pinecone.Index("langchain-demo")
embeddings = OpenAIEmbeddings()
vectorstore = Pinecone(index, emb... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-45 | Construct Pinecone wrapper from raw documents.
This is a user friendly interface that:
Embeds documents.
Adds the documents to a provided Pinecone index
This is intended to be a quick way to get started.
Example
from langchain import Pinecone
from langchain.embeddings import OpenAIEmbeddings
import pinecone
# The envir... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-46 | namespace β Namespace to search in. Default will search in ββ namespace.
Returns
List of Documents most similar to the query and score for each
class langchain.vectorstores.Qdrant(client: Any, collection_name: str, embedding_function: Callable, content_payload_key: str = 'page_content', metadata_payload_key: str = 'met... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-47 | Returns
List of ids from adding the texts into the vectorstore.
classmethod from_texts(texts: List[str], embedding: langchain.embeddings.base.Embeddings, metadatas: Optional[List[dict]] = None, location: Optional[str] = None, url: Optional[str] = None, port: Optional[int] = 6333, grpc_port: int = 6334, prefer_grpc: boo... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-48 | Default: False
https β If true - use HTTPS(SSL) protocol. Default: None
api_key β API key for authentication in Qdrant Cloud. Default: None
prefix β If not None - add prefix to the REST URL path.
Example: service/v1 will result in
http://localhost:6333/service/v1/{qdrant-endpoint} for REST API.
Default: None
timeout β ... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-49 | qdrant = Qdrant.from_texts(texts, embeddings, "localhost")
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 simi... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-50 | k β Number of Documents to return. Defaults to 4.
filter β Filter by metadata. Defaults to None.
Returns
List of Documents most similar to the query and score for each.
class langchain.vectorstores.SupabaseVectorStore(client: supabase.client.Client, embedding: Embeddings, table_name: str, query_name: Union[str, None] =... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-51 | classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, client: Optional[supabase.client.Client] = None, table_name: Optional[str] = 'documents', query_name: Union[str, None] = 'match_documents', **kwargs: Any) β SupabaseVectorStore[source]#
Return VectorStore initialized... | https://python.langchain.com/en/latest/reference/modules/vectorstores.html |
1d550228d9cb-52 | embedding,
1 -(docstore.embedding <=> query_embedding) AS similarity
FROMdocstore
ORDER BYdocstore.embedding <=> query_embedding
LIMIT match_count;
END;
$$;```
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.... | 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.