metadata
dict | id
stringlengths 14
16
| text
stringlengths 31
2.73k
|
---|---|---|
{
"url": "https://langchain.readthedocs.io/en/latest/index.html"
} | 7fb9f2a39073-0 | .rst
.pdf
Welcome to LangChain
Contents
Getting Started
Modules
Use Cases
Reference Docs
LangChain Ecosystem
Additional Resources
Welcome to LangChain#
LangChain is a framework for developing applications powered by language models. We believe that the most powerful and differentiated applications will not only call out to a language model via an API, but will also:
Be data-aware: connect a language model to other sources of data
Be agentic: allow a language model to interact with its environment
The LangChain framework is designed with the above principles in mind.
This is the Python specific portion of the documentation. For a purely conceptual guide to LangChain, see here. For the JavaScript documentation, see here.
Getting Started#
Checkout the below guide for a walkthrough of how to get started using LangChain to create an Language Model application.
Getting Started Documentation
Modules#
There are several main modules that LangChain provides support for.
For each module we provide some examples to get started, how-to guides, reference docs, and conceptual guides.
These modules are, in increasing order of complexity:
Models: The various model types and model integrations LangChain supports.
Prompts: This includes prompt management, prompt optimization, and prompt serialization.
Memory: Memory is the concept of persisting state between calls of a chain/agent. LangChain provides a standard interface for memory, a collection of memory implementations, and examples of chains/agents that use memory.
Indexes: Language models are often more powerful when combined with your own text data - this module covers best practices for doing exactly that.
Chains: Chains go beyond just a single LLM call, and are sequences of calls (whether to an LLM or a different utility). LangChain provides a standard interface for chains, lots of integrations with other tools, and end-to-end chains for common applications. |
{
"url": "https://langchain.readthedocs.io/en/latest/index.html"
} | 7fb9f2a39073-1 | Agents: Agents involve an LLM making decisions about which Actions to take, taking that Action, seeing an Observation, and repeating that until done. LangChain provides a standard interface for agents, a selection of agents to choose from, and examples of end to end agents.
Use Cases#
The above modules can be used in a variety of ways. LangChain also provides guidance and assistance in this. Below are some of the common use cases LangChain supports.
Personal Assistants: The main LangChain use case. Personal assistants need to take actions, remember interactions, and have knowledge about your data.
Question Answering: The second big LangChain use case. Answering questions over specific documents, only utilizing the information in those documents to construct an answer.
Chatbots: Since language models are good at producing text, that makes them ideal for creating chatbots.
Querying Tabular Data: If you want to understand how to use LLMs to query data that is stored in a tabular format (csvs, SQL, dataframes, etc) you should read this page.
Interacting with APIs: Enabling LLMs to interact with APIs is extremely powerful in order to give them more up-to-date information and allow them to take actions.
Extraction: Extract structured information from text.
Summarization: Summarizing longer documents into shorter, more condensed chunks of information. A type of Data Augmented Generation.
Evaluation: Generative models are notoriously hard to evaluate with traditional metrics. One new way of evaluating them is using language models themselves to do the evaluation. LangChain provides some prompts/chains for assisting in this.
Reference Docs#
All of LangChainβs reference documentation, in one place. Full documentation on all methods, classes, installation methods, and integration setups for LangChain.
Reference Documentation
LangChain Ecosystem#
Guides for how other companies/products can be used with LangChain
LangChain Ecosystem |
{
"url": "https://langchain.readthedocs.io/en/latest/index.html"
} | 7fb9f2a39073-2 | Guides for how other companies/products can be used with LangChain
LangChain Ecosystem
Additional Resources#
Additional collection of resources we think may be useful as you develop your application!
LangChainHub: The LangChainHub is a place to share and explore other prompts, chains, and agents.
Glossary: A glossary of all related terms, papers, methods, etc. Whether implemented in LangChain or not!
Gallery: A collection of our favorite projects that use LangChain. Useful for finding inspiration or seeing how things were done in other applications.
Deployments: A collection of instructions, code snippets, and template repositories for deploying LangChain apps.
Tracing: A guide on using tracing in LangChain to visualize the execution of chains and agents.
Model Laboratory: Experimenting with different prompts, models, and chains is a big part of developing the best possible application. The ModelLaboratory makes it easy to do so.
Discord: Join us on our Discord to discuss all things LangChain!
Production Support: As you move your LangChains into production, weβd love to offer more comprehensive support. Please fill out this form and weβll set up a dedicated support Slack channel.
next
Quickstart Guide
Contents
Getting Started
Modules
Use Cases
Reference Docs
LangChain Ecosystem
Additional Resources
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-0 | Index
_
| A
| B
| C
| D
| E
| F
| G
| H
| I
| J
| K
| L
| M
| N
| O
| P
| Q
| R
| S
| T
| U
| V
| W
| Z
_
__call__() (langchain.llms.AI21 method)
(langchain.llms.AlephAlpha method)
(langchain.llms.Anthropic method)
(langchain.llms.AzureOpenAI method)
(langchain.llms.Banana method)
(langchain.llms.CerebriumAI method)
(langchain.llms.Cohere method)
(langchain.llms.DeepInfra method)
(langchain.llms.ForefrontAI method)
(langchain.llms.GooseAI method)
(langchain.llms.GPT4All method)
(langchain.llms.HuggingFaceEndpoint method)
(langchain.llms.HuggingFaceHub method)
(langchain.llms.HuggingFacePipeline method)
(langchain.llms.LlamaCpp method)
(langchain.llms.Modal method)
(langchain.llms.NLPCloud method)
(langchain.llms.OpenAI method)
(langchain.llms.OpenAIChat method)
(langchain.llms.Petals method)
(langchain.llms.PromptLayerOpenAI method)
(langchain.llms.PromptLayerOpenAIChat method)
(langchain.llms.Replicate method)
(langchain.llms.RWKV method)
(langchain.llms.SagemakerEndpoint method)
(langchain.llms.SelfHostedHuggingFaceLLM method)
(langchain.llms.SelfHostedPipeline method)
(langchain.llms.StochasticAI method)
(langchain.llms.Writer method)
A |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-1 | (langchain.llms.StochasticAI method)
(langchain.llms.Writer method)
A
aadd_documents() (langchain.vectorstores.VectorStore method)
aadd_texts() (langchain.vectorstores.VectorStore method)
aapply() (langchain.chains.LLMChain method)
aapply_and_parse() (langchain.chains.LLMChain method)
add() (langchain.docstore.InMemoryDocstore method)
add_documents() (langchain.vectorstores.VectorStore method)
add_embeddings() (langchain.vectorstores.FAISS method)
add_example() (langchain.prompts.example_selector.LengthBasedExampleSelector method)
(langchain.prompts.example_selector.SemanticSimilarityExampleSelector method)
add_texts() (langchain.vectorstores.AtlasDB method)
(langchain.vectorstores.Chroma method)
(langchain.vectorstores.DeepLake method)
(langchain.vectorstores.ElasticVectorSearch method)
(langchain.vectorstores.FAISS method)
(langchain.vectorstores.Milvus method)
(langchain.vectorstores.OpenSearchVectorSearch method)
(langchain.vectorstores.Pinecone method)
(langchain.vectorstores.Qdrant method)
(langchain.vectorstores.VectorStore method)
(langchain.vectorstores.Weaviate method)
afrom_documents() (langchain.vectorstores.VectorStore class method)
afrom_texts() (langchain.vectorstores.VectorStore class method)
agenerate() (langchain.chains.LLMChain method)
(langchain.llms.AI21 method)
(langchain.llms.AlephAlpha method)
(langchain.llms.Anthropic method)
(langchain.llms.AzureOpenAI method)
(langchain.llms.Banana method)
(langchain.llms.CerebriumAI method)
(langchain.llms.Cohere method)
(langchain.llms.DeepInfra method) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-2 | (langchain.llms.Cohere method)
(langchain.llms.DeepInfra method)
(langchain.llms.ForefrontAI method)
(langchain.llms.GooseAI method)
(langchain.llms.GPT4All method)
(langchain.llms.HuggingFaceEndpoint method)
(langchain.llms.HuggingFaceHub method)
(langchain.llms.HuggingFacePipeline method)
(langchain.llms.LlamaCpp method)
(langchain.llms.Modal method)
(langchain.llms.NLPCloud method)
(langchain.llms.OpenAI method)
(langchain.llms.OpenAIChat method)
(langchain.llms.Petals method)
(langchain.llms.PromptLayerOpenAI method)
(langchain.llms.PromptLayerOpenAIChat method)
(langchain.llms.Replicate method)
(langchain.llms.RWKV method)
(langchain.llms.SagemakerEndpoint method)
(langchain.llms.SelfHostedHuggingFaceLLM method)
(langchain.llms.SelfHostedPipeline method)
(langchain.llms.StochasticAI method)
(langchain.llms.Writer method)
agenerate_prompt() (langchain.llms.AI21 method)
(langchain.llms.AlephAlpha method)
(langchain.llms.Anthropic method)
(langchain.llms.AzureOpenAI method)
(langchain.llms.Banana method)
(langchain.llms.CerebriumAI method)
(langchain.llms.Cohere method)
(langchain.llms.DeepInfra method)
(langchain.llms.ForefrontAI method)
(langchain.llms.GooseAI method)
(langchain.llms.GPT4All method)
(langchain.llms.HuggingFaceEndpoint method)
(langchain.llms.HuggingFaceHub method)
(langchain.llms.HuggingFacePipeline method) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-3 | (langchain.llms.HuggingFacePipeline method)
(langchain.llms.LlamaCpp method)
(langchain.llms.Modal method)
(langchain.llms.NLPCloud method)
(langchain.llms.OpenAI method)
(langchain.llms.OpenAIChat method)
(langchain.llms.Petals method)
(langchain.llms.PromptLayerOpenAI method)
(langchain.llms.PromptLayerOpenAIChat method)
(langchain.llms.Replicate method)
(langchain.llms.RWKV method)
(langchain.llms.SagemakerEndpoint method)
(langchain.llms.SelfHostedHuggingFaceLLM method)
(langchain.llms.SelfHostedPipeline method)
(langchain.llms.StochasticAI method)
(langchain.llms.Writer method)
agent (langchain.agents.AgentExecutor attribute)
(langchain.agents.MRKLChain attribute)
(langchain.agents.ReActChain attribute)
(langchain.agents.SelfAskWithSearchChain attribute)
AgentType (class in langchain.agents)
ai_prefix (langchain.agents.ConversationalAgent attribute)
aiosession (langchain.serpapi.SerpAPIWrapper attribute)
(langchain.utilities.searx_search.SearxSearchWrapper attribute)
aleph_alpha_api_key (langchain.llms.AlephAlpha attribute)
allowed_tools (langchain.agents.Agent attribute)
(langchain.agents.ReActTextWorldAgent attribute)
(langchain.agents.ZeroShotAgent attribute)
amax_marginal_relevance_search() (langchain.vectorstores.VectorStore method)
amax_marginal_relevance_search_by_vector() (langchain.vectorstores.VectorStore method)
answers (langchain.utilities.searx_search.SearxResults property)
api_answer_chain (langchain.chains.APIChain attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-4 | api_answer_chain (langchain.chains.APIChain attribute)
api_docs (langchain.chains.APIChain attribute)
api_operation (langchain.chains.OpenAPIEndpointChain attribute)
api_request_chain (langchain.chains.APIChain attribute)
(langchain.chains.OpenAPIEndpointChain attribute)
api_response_chain (langchain.chains.OpenAPIEndpointChain attribute)
api_url (langchain.llms.StochasticAI attribute)
aplan() (langchain.agents.Agent method)
(langchain.agents.BaseMultiActionAgent method)
(langchain.agents.BaseSingleActionAgent method)
(langchain.agents.LLMSingleActionAgent method)
apply() (langchain.chains.LLMChain method)
apply_and_parse() (langchain.chains.LLMChain method)
apredict() (langchain.chains.LLMChain method)
apredict_and_parse() (langchain.chains.LLMChain method)
aprep_prompts() (langchain.chains.LLMChain method)
are_all_true_prompt (langchain.chains.LLMSummarizationCheckerChain attribute)
aresults() (langchain.utilities.searx_search.SearxSearchWrapper method)
arun() (langchain.serpapi.SerpAPIWrapper method)
(langchain.utilities.searx_search.SearxSearchWrapper method)
as_retriever() (langchain.vectorstores.VectorStore method)
asimilarity_search() (langchain.vectorstores.VectorStore method)
asimilarity_search_by_vector() (langchain.vectorstores.VectorStore method)
AtlasDB (class in langchain.vectorstores)
B
bad_words (langchain.llms.NLPCloud attribute)
base_embeddings (langchain.chains.HypotheticalDocumentEmbedder attribute)
base_url (langchain.llms.AI21 attribute)
(langchain.llms.ForefrontAI attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-5 | (langchain.llms.ForefrontAI attribute)
(langchain.llms.Writer attribute)
batch_size (langchain.llms.AzureOpenAI attribute)
beam_search_diversity_rate (langchain.llms.Writer attribute)
beam_width (langchain.llms.Writer attribute)
best_of (langchain.llms.AlephAlpha attribute)
(langchain.llms.AzureOpenAI attribute)
C
callback_manager (langchain.agents.MRKLChain attribute)
(langchain.agents.ReActChain attribute)
(langchain.agents.SelfAskWithSearchChain attribute)
categories (langchain.utilities.searx_search.SearxSearchWrapper attribute)
chain (langchain.chains.ConstitutionalChain attribute)
chains (langchain.chains.SequentialChain attribute)
(langchain.chains.SimpleSequentialChain attribute)
CharacterTextSplitter (class in langchain.text_splitter)
CHAT_CONVERSATIONAL_REACT_DESCRIPTION (langchain.agents.AgentType attribute)
CHAT_ZERO_SHOT_REACT_DESCRIPTION (langchain.agents.AgentType attribute)
check_assertions_prompt (langchain.chains.LLMCheckerChain attribute)
(langchain.chains.LLMSummarizationCheckerChain attribute)
Chroma (class in langchain.vectorstores)
CHUNK_LEN (langchain.llms.RWKV attribute)
chunk_size (langchain.embeddings.OpenAIEmbeddings attribute)
client (langchain.llms.Petals attribute)
combine_docs_chain (langchain.chains.AnalyzeDocumentChain attribute)
combine_documents_chain (langchain.chains.MapReduceChain attribute)
combine_embeddings() (langchain.chains.HypotheticalDocumentEmbedder method)
completion_bias_exclusion_first_token_only (langchain.llms.AlephAlpha attribute)
compress_to_size (langchain.embeddings.AlephAlphaAsymmetricSemanticEmbedding attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-6 | compress_to_size (langchain.embeddings.AlephAlphaAsymmetricSemanticEmbedding attribute)
constitutional_principles (langchain.chains.ConstitutionalChain attribute)
construct() (langchain.llms.AI21 class method)
(langchain.llms.AlephAlpha class method)
(langchain.llms.Anthropic class method)
(langchain.llms.AzureOpenAI class method)
(langchain.llms.Banana class method)
(langchain.llms.CerebriumAI class method)
(langchain.llms.Cohere class method)
(langchain.llms.DeepInfra class method)
(langchain.llms.ForefrontAI class method)
(langchain.llms.GooseAI class method)
(langchain.llms.GPT4All class method)
(langchain.llms.HuggingFaceEndpoint class method)
(langchain.llms.HuggingFaceHub class method)
(langchain.llms.HuggingFacePipeline class method)
(langchain.llms.LlamaCpp class method)
(langchain.llms.Modal class method)
(langchain.llms.NLPCloud class method)
(langchain.llms.OpenAI class method)
(langchain.llms.OpenAIChat class method)
(langchain.llms.Petals class method)
(langchain.llms.PromptLayerOpenAI class method)
(langchain.llms.PromptLayerOpenAIChat class method)
(langchain.llms.Replicate class method)
(langchain.llms.RWKV class method)
(langchain.llms.SagemakerEndpoint class method)
(langchain.llms.SelfHostedHuggingFaceLLM class method)
(langchain.llms.SelfHostedPipeline class method)
(langchain.llms.StochasticAI class method)
(langchain.llms.Writer class method)
content_handler (langchain.embeddings.SagemakerEndpointEmbeddings attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-7 | content_handler (langchain.embeddings.SagemakerEndpointEmbeddings attribute)
(langchain.llms.SagemakerEndpoint attribute)
CONTENT_KEY (langchain.vectorstores.Qdrant attribute)
contextual_control_threshold (langchain.embeddings.AlephAlphaAsymmetricSemanticEmbedding attribute)
(langchain.llms.AlephAlpha attribute)
control_log_additive (langchain.embeddings.AlephAlphaAsymmetricSemanticEmbedding attribute)
(langchain.llms.AlephAlpha attribute)
CONVERSATIONAL_REACT_DESCRIPTION (langchain.agents.AgentType attribute)
copy() (langchain.llms.AI21 method)
(langchain.llms.AlephAlpha method)
(langchain.llms.Anthropic method)
(langchain.llms.AzureOpenAI method)
(langchain.llms.Banana method)
(langchain.llms.CerebriumAI method)
(langchain.llms.Cohere method)
(langchain.llms.DeepInfra method)
(langchain.llms.ForefrontAI method)
(langchain.llms.GooseAI method)
(langchain.llms.GPT4All method)
(langchain.llms.HuggingFaceEndpoint method)
(langchain.llms.HuggingFaceHub method)
(langchain.llms.HuggingFacePipeline method)
(langchain.llms.LlamaCpp method)
(langchain.llms.Modal method)
(langchain.llms.NLPCloud method)
(langchain.llms.OpenAI method)
(langchain.llms.OpenAIChat method)
(langchain.llms.Petals method)
(langchain.llms.PromptLayerOpenAI method)
(langchain.llms.PromptLayerOpenAIChat method)
(langchain.llms.Replicate method)
(langchain.llms.RWKV method)
(langchain.llms.SagemakerEndpoint method)
(langchain.llms.SelfHostedHuggingFaceLLM method) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-8 | (langchain.llms.SelfHostedHuggingFaceLLM method)
(langchain.llms.SelfHostedPipeline method)
(langchain.llms.StochasticAI method)
(langchain.llms.Writer method)
coroutine (langchain.agents.Tool attribute)
countPenalty (langchain.llms.AI21 attribute)
create_assertions_prompt (langchain.chains.LLMSummarizationCheckerChain attribute)
create_csv_agent() (in module langchain.agents)
create_documents() (langchain.text_splitter.TextSplitter method)
create_draft_answer_prompt (langchain.chains.LLMCheckerChain attribute)
create_index() (langchain.vectorstores.AtlasDB method)
create_json_agent() (in module langchain.agents)
create_llm_result() (langchain.llms.AzureOpenAI method)
(langchain.llms.OpenAI method)
(langchain.llms.PromptLayerOpenAI method)
create_openapi_agent() (in module langchain.agents)
create_outputs() (langchain.chains.LLMChain method)
create_pandas_dataframe_agent() (in module langchain.agents)
create_prompt() (langchain.agents.Agent class method)
(langchain.agents.ConversationalAgent class method)
(langchain.agents.ConversationalChatAgent class method)
(langchain.agents.ReActTextWorldAgent class method)
(langchain.agents.ZeroShotAgent class method)
create_sql_agent() (in module langchain.agents)
create_vectorstore_agent() (in module langchain.agents)
create_vectorstore_router_agent() (in module langchain.agents)
credentials_profile_name (langchain.embeddings.SagemakerEndpointEmbeddings attribute)
(langchain.llms.SagemakerEndpoint attribute)
critique_chain (langchain.chains.ConstitutionalChain attribute)
D |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-9 | critique_chain (langchain.chains.ConstitutionalChain attribute)
D
database (langchain.chains.SQLDatabaseChain attribute)
decider_chain (langchain.chains.SQLDatabaseSequentialChain attribute)
DeepLake (class in langchain.vectorstores)
delete() (langchain.vectorstores.DeepLake method)
delete_collection() (langchain.vectorstores.Chroma method)
delete_dataset() (langchain.vectorstores.DeepLake method)
deployment_name (langchain.llms.AzureOpenAI attribute)
description (langchain.agents.Tool attribute)
deserialize_json_input() (langchain.chains.OpenAPIEndpointChain method)
device (langchain.llms.SelfHostedHuggingFaceLLM attribute)
dict() (langchain.agents.BaseMultiActionAgent method)
(langchain.agents.BaseSingleActionAgent method)
(langchain.llms.AI21 method)
(langchain.llms.AlephAlpha method)
(langchain.llms.Anthropic method)
(langchain.llms.AzureOpenAI method)
(langchain.llms.Banana method)
(langchain.llms.CerebriumAI method)
(langchain.llms.Cohere method)
(langchain.llms.DeepInfra method)
(langchain.llms.ForefrontAI method)
(langchain.llms.GooseAI method)
(langchain.llms.GPT4All method)
(langchain.llms.HuggingFaceEndpoint method)
(langchain.llms.HuggingFaceHub method)
(langchain.llms.HuggingFacePipeline method)
(langchain.llms.LlamaCpp method)
(langchain.llms.Modal method)
(langchain.llms.NLPCloud method)
(langchain.llms.OpenAI method)
(langchain.llms.OpenAIChat method)
(langchain.llms.Petals method)
(langchain.llms.PromptLayerOpenAI method) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-10 | (langchain.llms.PromptLayerOpenAI method)
(langchain.llms.PromptLayerOpenAIChat method)
(langchain.llms.Replicate method)
(langchain.llms.RWKV method)
(langchain.llms.SagemakerEndpoint method)
(langchain.llms.SelfHostedHuggingFaceLLM method)
(langchain.llms.SelfHostedPipeline method)
(langchain.llms.StochasticAI method)
(langchain.llms.Writer method)
(langchain.prompts.BasePromptTemplate method)
(langchain.prompts.FewShotPromptTemplate method)
(langchain.prompts.FewShotPromptWithTemplates method)
do_sample (langchain.llms.NLPCloud attribute)
(langchain.llms.Petals attribute)
E
early_stopping (langchain.llms.NLPCloud attribute)
early_stopping_method (langchain.agents.AgentExecutor attribute)
(langchain.agents.MRKLChain attribute)
(langchain.agents.ReActChain attribute)
(langchain.agents.SelfAskWithSearchChain attribute)
echo (langchain.llms.AlephAlpha attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
ElasticVectorSearch (class in langchain.vectorstores)
embed_documents() (langchain.chains.HypotheticalDocumentEmbedder method)
(langchain.embeddings.AlephAlphaAsymmetricSemanticEmbedding method)
(langchain.embeddings.AlephAlphaSymmetricSemanticEmbedding method)
(langchain.embeddings.CohereEmbeddings method)
(langchain.embeddings.FakeEmbeddings method)
(langchain.embeddings.HuggingFaceEmbeddings method)
(langchain.embeddings.HuggingFaceHubEmbeddings method)
(langchain.embeddings.HuggingFaceInstructEmbeddings method)
(langchain.embeddings.LlamaCppEmbeddings method) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-11 | (langchain.embeddings.LlamaCppEmbeddings method)
(langchain.embeddings.OpenAIEmbeddings method)
(langchain.embeddings.SagemakerEndpointEmbeddings method)
(langchain.embeddings.SelfHostedEmbeddings method)
(langchain.embeddings.SelfHostedHuggingFaceInstructEmbeddings method)
(langchain.embeddings.TensorflowHubEmbeddings method)
embed_instruction (langchain.embeddings.HuggingFaceInstructEmbeddings attribute)
(langchain.embeddings.SelfHostedHuggingFaceInstructEmbeddings attribute)
embed_query() (langchain.chains.HypotheticalDocumentEmbedder method)
(langchain.embeddings.AlephAlphaAsymmetricSemanticEmbedding method)
(langchain.embeddings.AlephAlphaSymmetricSemanticEmbedding method)
(langchain.embeddings.CohereEmbeddings method)
(langchain.embeddings.FakeEmbeddings method)
(langchain.embeddings.HuggingFaceEmbeddings method)
(langchain.embeddings.HuggingFaceHubEmbeddings method)
(langchain.embeddings.HuggingFaceInstructEmbeddings method)
(langchain.embeddings.LlamaCppEmbeddings method)
(langchain.embeddings.OpenAIEmbeddings method)
(langchain.embeddings.SagemakerEndpointEmbeddings method)
(langchain.embeddings.SelfHostedEmbeddings method)
(langchain.embeddings.SelfHostedHuggingFaceInstructEmbeddings method)
(langchain.embeddings.TensorflowHubEmbeddings method)
embedding (langchain.llms.GPT4All attribute)
endpoint_kwargs (langchain.embeddings.SagemakerEndpointEmbeddings attribute)
(langchain.llms.SagemakerEndpoint attribute)
endpoint_name (langchain.embeddings.SagemakerEndpointEmbeddings attribute)
(langchain.llms.SagemakerEndpoint attribute)
endpoint_url (langchain.llms.CerebriumAI attribute)
(langchain.llms.ForefrontAI attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-12 | (langchain.llms.ForefrontAI attribute)
(langchain.llms.HuggingFaceEndpoint attribute)
(langchain.llms.Modal attribute)
engines (langchain.utilities.searx_search.SearxSearchWrapper attribute)
entity_extraction_chain (langchain.chains.GraphQAChain attribute)
error (langchain.chains.OpenAIModerationChain attribute)
example_keys (langchain.prompts.example_selector.SemanticSimilarityExampleSelector attribute)
example_prompt (langchain.prompts.example_selector.LengthBasedExampleSelector attribute)
(langchain.prompts.FewShotPromptTemplate attribute)
(langchain.prompts.FewShotPromptWithTemplates attribute)
example_selector (langchain.prompts.FewShotPromptTemplate attribute)
(langchain.prompts.FewShotPromptWithTemplates attribute)
example_separator (langchain.prompts.FewShotPromptTemplate attribute)
(langchain.prompts.FewShotPromptWithTemplates attribute)
examples (langchain.prompts.example_selector.LengthBasedExampleSelector attribute)
(langchain.prompts.FewShotPromptTemplate attribute)
(langchain.prompts.FewShotPromptWithTemplates attribute)
F
f16_kv (langchain.embeddings.LlamaCppEmbeddings attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
FAISS (class in langchain.vectorstores)
fetch_k (langchain.prompts.example_selector.MaxMarginalRelevanceExampleSelector attribute)
finish_tool_name (langchain.agents.Agent property)
(langchain.agents.ConversationalAgent property)
format() (langchain.prompts.BaseChatPromptTemplate method)
(langchain.prompts.BasePromptTemplate method)
(langchain.prompts.ChatPromptTemplate method)
(langchain.prompts.FewShotPromptTemplate method)
(langchain.prompts.FewShotPromptWithTemplates method)
(langchain.prompts.PromptTemplate method) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-13 | (langchain.prompts.PromptTemplate method)
format_messages() (langchain.prompts.BaseChatPromptTemplate method)
(langchain.prompts.ChatPromptTemplate method)
(langchain.prompts.MessagesPlaceholder method)
format_prompt() (langchain.prompts.BaseChatPromptTemplate method)
(langchain.prompts.BasePromptTemplate method)
(langchain.prompts.StringPromptTemplate method)
frequency_penalty (langchain.llms.AlephAlpha attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.Cohere attribute)
(langchain.llms.GooseAI attribute)
frequencyPenalty (langchain.llms.AI21 attribute)
from_agent_and_tools() (langchain.agents.AgentExecutor class method)
from_api_operation() (langchain.chains.OpenAPIEndpointChain class method)
from_chains() (langchain.agents.MRKLChain class method)
from_colored_object_prompt() (langchain.chains.PALChain class method)
from_documents() (langchain.vectorstores.AtlasDB class method)
(langchain.vectorstores.Chroma class method)
(langchain.vectorstores.Qdrant class method)
(langchain.vectorstores.VectorStore class method)
from_embeddings() (langchain.vectorstores.FAISS class method)
from_examples() (langchain.prompts.example_selector.MaxMarginalRelevanceExampleSelector class method)
(langchain.prompts.example_selector.SemanticSimilarityExampleSelector class method)
(langchain.prompts.PromptTemplate class method)
from_existing_index() (langchain.vectorstores.Pinecone class method)
from_file() (langchain.prompts.PromptTemplate class method)
from_huggingface_tokenizer() (langchain.text_splitter.TextSplitter class method)
from_llm() (langchain.chains.ChatVectorDBChain class method)
(langchain.chains.ConstitutionalChain class method) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-14 | (langchain.chains.ConstitutionalChain class method)
(langchain.chains.ConversationalRetrievalChain class method)
(langchain.chains.GraphQAChain class method)
(langchain.chains.HypotheticalDocumentEmbedder class method)
(langchain.chains.QAGenerationChain class method)
(langchain.chains.SQLDatabaseSequentialChain class method)
from_llm_and_api_docs() (langchain.chains.APIChain class method)
from_llm_and_tools() (langchain.agents.Agent class method)
(langchain.agents.ConversationalAgent class method)
(langchain.agents.ConversationalChatAgent class method)
(langchain.agents.ZeroShotAgent class method)
from_math_prompt() (langchain.chains.PALChain class method)
from_model_id() (langchain.llms.HuggingFacePipeline class method)
from_params() (langchain.chains.MapReduceChain class method)
from_pipeline() (langchain.llms.SelfHostedHuggingFaceLLM class method)
(langchain.llms.SelfHostedPipeline class method)
from_string() (langchain.chains.LLMChain class method)
from_template() (langchain.prompts.PromptTemplate class method)
from_texts() (langchain.vectorstores.AtlasDB class method)
(langchain.vectorstores.Chroma class method)
(langchain.vectorstores.DeepLake class method)
(langchain.vectorstores.ElasticVectorSearch class method)
(langchain.vectorstores.FAISS class method)
(langchain.vectorstores.Milvus class method)
(langchain.vectorstores.OpenSearchVectorSearch class method)
(langchain.vectorstores.Pinecone class method)
(langchain.vectorstores.Qdrant class method)
(langchain.vectorstores.VectorStore class method)
(langchain.vectorstores.Weaviate class method) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-15 | (langchain.vectorstores.VectorStore class method)
(langchain.vectorstores.Weaviate class method)
from_tiktoken_encoder() (langchain.text_splitter.TextSplitter class method)
from_url_and_method() (langchain.chains.OpenAPIEndpointChain class method)
func (langchain.agents.Tool attribute)
G
generate() (langchain.chains.LLMChain method)
(langchain.llms.AI21 method)
(langchain.llms.AlephAlpha method)
(langchain.llms.Anthropic method)
(langchain.llms.AzureOpenAI method)
(langchain.llms.Banana method)
(langchain.llms.CerebriumAI method)
(langchain.llms.Cohere method)
(langchain.llms.DeepInfra method)
(langchain.llms.ForefrontAI method)
(langchain.llms.GooseAI method)
(langchain.llms.GPT4All method)
(langchain.llms.HuggingFaceEndpoint method)
(langchain.llms.HuggingFaceHub method)
(langchain.llms.HuggingFacePipeline method)
(langchain.llms.LlamaCpp method)
(langchain.llms.Modal method)
(langchain.llms.NLPCloud method)
(langchain.llms.OpenAI method)
(langchain.llms.OpenAIChat method)
(langchain.llms.Petals method)
(langchain.llms.PromptLayerOpenAI method)
(langchain.llms.PromptLayerOpenAIChat method)
(langchain.llms.Replicate method)
(langchain.llms.RWKV method)
(langchain.llms.SagemakerEndpoint method)
(langchain.llms.SelfHostedHuggingFaceLLM method)
(langchain.llms.SelfHostedPipeline method)
(langchain.llms.StochasticAI method)
(langchain.llms.Writer method) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-16 | (langchain.llms.StochasticAI method)
(langchain.llms.Writer method)
generate_prompt() (langchain.llms.AI21 method)
(langchain.llms.AlephAlpha method)
(langchain.llms.Anthropic method)
(langchain.llms.AzureOpenAI method)
(langchain.llms.Banana method)
(langchain.llms.CerebriumAI method)
(langchain.llms.Cohere method)
(langchain.llms.DeepInfra method)
(langchain.llms.ForefrontAI method)
(langchain.llms.GooseAI method)
(langchain.llms.GPT4All method)
(langchain.llms.HuggingFaceEndpoint method)
(langchain.llms.HuggingFaceHub method)
(langchain.llms.HuggingFacePipeline method)
(langchain.llms.LlamaCpp method)
(langchain.llms.Modal method)
(langchain.llms.NLPCloud method)
(langchain.llms.OpenAI method)
(langchain.llms.OpenAIChat method)
(langchain.llms.Petals method)
(langchain.llms.PromptLayerOpenAI method)
(langchain.llms.PromptLayerOpenAIChat method)
(langchain.llms.Replicate method)
(langchain.llms.RWKV method)
(langchain.llms.SagemakerEndpoint method)
(langchain.llms.SelfHostedHuggingFaceLLM method)
(langchain.llms.SelfHostedPipeline method)
(langchain.llms.StochasticAI method)
(langchain.llms.Writer method)
get_all_tool_names() (in module langchain.agents)
get_allowed_tools() (langchain.agents.Agent method)
(langchain.agents.BaseMultiActionAgent method)
(langchain.agents.BaseSingleActionAgent method)
get_answer_expr (langchain.chains.PALChain attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-17 | get_answer_expr (langchain.chains.PALChain attribute)
get_full_inputs() (langchain.agents.Agent method)
get_num_tokens() (langchain.llms.AI21 method)
(langchain.llms.AlephAlpha method)
(langchain.llms.Anthropic method)
(langchain.llms.AzureOpenAI method)
(langchain.llms.Banana method)
(langchain.llms.CerebriumAI method)
(langchain.llms.Cohere method)
(langchain.llms.DeepInfra method)
(langchain.llms.ForefrontAI method)
(langchain.llms.GooseAI method)
(langchain.llms.GPT4All method)
(langchain.llms.HuggingFaceEndpoint method)
(langchain.llms.HuggingFaceHub method)
(langchain.llms.HuggingFacePipeline method)
(langchain.llms.LlamaCpp method)
(langchain.llms.Modal method)
(langchain.llms.NLPCloud method)
(langchain.llms.OpenAI method)
(langchain.llms.OpenAIChat method)
(langchain.llms.Petals method)
(langchain.llms.PromptLayerOpenAI method)
(langchain.llms.PromptLayerOpenAIChat method)
(langchain.llms.Replicate method)
(langchain.llms.RWKV method)
(langchain.llms.SagemakerEndpoint method)
(langchain.llms.SelfHostedHuggingFaceLLM method)
(langchain.llms.SelfHostedPipeline method)
(langchain.llms.StochasticAI method)
(langchain.llms.Writer method)
get_num_tokens_from_messages() (langchain.llms.AI21 method)
(langchain.llms.AlephAlpha method)
(langchain.llms.Anthropic method)
(langchain.llms.AzureOpenAI method)
(langchain.llms.Banana method) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-18 | (langchain.llms.AzureOpenAI method)
(langchain.llms.Banana method)
(langchain.llms.CerebriumAI method)
(langchain.llms.Cohere method)
(langchain.llms.DeepInfra method)
(langchain.llms.ForefrontAI method)
(langchain.llms.GooseAI method)
(langchain.llms.GPT4All method)
(langchain.llms.HuggingFaceEndpoint method)
(langchain.llms.HuggingFaceHub method)
(langchain.llms.HuggingFacePipeline method)
(langchain.llms.LlamaCpp method)
(langchain.llms.Modal method)
(langchain.llms.NLPCloud method)
(langchain.llms.OpenAI method)
(langchain.llms.OpenAIChat method)
(langchain.llms.Petals method)
(langchain.llms.PromptLayerOpenAI method)
(langchain.llms.PromptLayerOpenAIChat method)
(langchain.llms.Replicate method)
(langchain.llms.RWKV method)
(langchain.llms.SagemakerEndpoint method)
(langchain.llms.SelfHostedHuggingFaceLLM method)
(langchain.llms.SelfHostedPipeline method)
(langchain.llms.StochasticAI method)
(langchain.llms.Writer method)
get_params() (langchain.serpapi.SerpAPIWrapper method)
get_principles() (langchain.chains.ConstitutionalChain class method)
get_sub_prompts() (langchain.llms.AzureOpenAI method)
(langchain.llms.OpenAI method)
(langchain.llms.PromptLayerOpenAI method)
get_text_length (langchain.prompts.example_selector.LengthBasedExampleSelector attribute)
globals (langchain.python.PythonREPL attribute)
graph (langchain.chains.GraphQAChain attribute)
H |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-19 | graph (langchain.chains.GraphQAChain attribute)
H
hardware (langchain.embeddings.SelfHostedHuggingFaceEmbeddings attribute)
(langchain.llms.SelfHostedHuggingFaceLLM attribute)
(langchain.llms.SelfHostedPipeline attribute)
headers (langchain.utilities.searx_search.SearxSearchWrapper attribute)
hosting (langchain.embeddings.AlephAlphaAsymmetricSemanticEmbedding attribute)
I
inference_fn (langchain.embeddings.SelfHostedEmbeddings attribute)
(langchain.embeddings.SelfHostedHuggingFaceEmbeddings attribute)
(langchain.llms.SelfHostedHuggingFaceLLM attribute)
(langchain.llms.SelfHostedPipeline attribute)
inference_kwargs (langchain.embeddings.SelfHostedEmbeddings attribute)
initialize_agent() (in module langchain.agents)
InMemoryDocstore (class in langchain.docstore)
input_key (langchain.chains.QAGenerationChain attribute)
input_keys (langchain.chains.ConstitutionalChain property)
(langchain.chains.ConversationChain property)
(langchain.chains.HypotheticalDocumentEmbedder property)
(langchain.chains.QAGenerationChain property)
(langchain.prompts.example_selector.SemanticSimilarityExampleSelector attribute)
input_variables (langchain.chains.SequentialChain attribute)
(langchain.chains.TransformChain attribute)
(langchain.prompts.BasePromptTemplate attribute)
(langchain.prompts.FewShotPromptTemplate attribute)
(langchain.prompts.FewShotPromptWithTemplates attribute)
(langchain.prompts.MessagesPlaceholder property)
(langchain.prompts.PromptTemplate attribute)
J
json() (langchain.llms.AI21 method)
(langchain.llms.AlephAlpha method)
(langchain.llms.Anthropic method)
(langchain.llms.AzureOpenAI method) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-20 | (langchain.llms.Anthropic method)
(langchain.llms.AzureOpenAI method)
(langchain.llms.Banana method)
(langchain.llms.CerebriumAI method)
(langchain.llms.Cohere method)
(langchain.llms.DeepInfra method)
(langchain.llms.ForefrontAI method)
(langchain.llms.GooseAI method)
(langchain.llms.GPT4All method)
(langchain.llms.HuggingFaceEndpoint method)
(langchain.llms.HuggingFaceHub method)
(langchain.llms.HuggingFacePipeline method)
(langchain.llms.LlamaCpp method)
(langchain.llms.Modal method)
(langchain.llms.NLPCloud method)
(langchain.llms.OpenAI method)
(langchain.llms.OpenAIChat method)
(langchain.llms.Petals method)
(langchain.llms.PromptLayerOpenAI method)
(langchain.llms.PromptLayerOpenAIChat method)
(langchain.llms.Replicate method)
(langchain.llms.RWKV method)
(langchain.llms.SagemakerEndpoint method)
(langchain.llms.SelfHostedHuggingFaceLLM method)
(langchain.llms.SelfHostedPipeline method)
(langchain.llms.StochasticAI method)
(langchain.llms.Writer method)
K
k (langchain.chains.QAGenerationChain attribute)
(langchain.chains.VectorDBQA attribute)
(langchain.chains.VectorDBQAWithSourcesChain attribute)
(langchain.llms.Cohere attribute)
(langchain.prompts.example_selector.SemanticSimilarityExampleSelector attribute)
(langchain.utilities.searx_search.SearxSearchWrapper attribute)
L
langchain.agents
module
langchain.chains
module
langchain.docstore
module |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-21 | langchain.chains
module
langchain.docstore
module
langchain.embeddings
module
langchain.llms
module
langchain.prompts
module
langchain.prompts.example_selector
module
langchain.python
module
langchain.serpapi
module
langchain.text_splitter
module
langchain.utilities.searx_search
module
langchain.vectorstores
module
last_n_tokens_size (langchain.llms.LlamaCpp attribute)
LatexTextSplitter (class in langchain.text_splitter)
length (langchain.llms.ForefrontAI attribute)
(langchain.llms.Writer attribute)
length_no_input (langchain.llms.NLPCloud attribute)
length_penalty (langchain.llms.NLPCloud attribute)
length_pentaly (langchain.llms.Writer attribute)
list_assertions_prompt (langchain.chains.LLMCheckerChain attribute)
llm (langchain.chains.LLMBashChain attribute)
(langchain.chains.LLMChain attribute)
(langchain.chains.LLMCheckerChain attribute)
(langchain.chains.LLMMathChain attribute)
(langchain.chains.LLMSummarizationCheckerChain attribute)
(langchain.chains.PALChain attribute)
(langchain.chains.SQLDatabaseChain attribute)
llm_chain (langchain.agents.Agent attribute)
(langchain.agents.LLMSingleActionAgent attribute)
(langchain.agents.ReActTextWorldAgent attribute)
(langchain.agents.ZeroShotAgent attribute)
(langchain.chains.HypotheticalDocumentEmbedder attribute)
(langchain.chains.LLMRequestsChain attribute)
(langchain.chains.QAGenerationChain attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-22 | (langchain.chains.QAGenerationChain attribute)
llm_prefix (langchain.agents.Agent property)
(langchain.agents.ConversationalAgent property)
(langchain.agents.ConversationalChatAgent property)
(langchain.agents.ZeroShotAgent property)
load_agent() (in module langchain.agents)
load_chain() (in module langchain.chains)
load_fn_kwargs (langchain.embeddings.SelfHostedHuggingFaceEmbeddings attribute)
(langchain.llms.SelfHostedHuggingFaceLLM attribute)
(langchain.llms.SelfHostedPipeline attribute)
load_local() (langchain.vectorstores.FAISS class method)
load_prompt() (in module langchain.prompts)
load_tools() (in module langchain.agents)
locals (langchain.python.PythonREPL attribute)
log_probs (langchain.llms.AlephAlpha attribute)
logit_bias (langchain.llms.AlephAlpha attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.GooseAI attribute)
logitBias (langchain.llms.AI21 attribute)
logits_all (langchain.embeddings.LlamaCppEmbeddings attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
logprobs (langchain.llms.LlamaCpp attribute)
(langchain.llms.Writer attribute)
lookup_tool() (langchain.agents.AgentExecutor method)
M
MarkdownTextSplitter (class in langchain.text_splitter)
max_checks (langchain.chains.LLMSummarizationCheckerChain attribute)
max_execution_time (langchain.agents.AgentExecutor attribute)
(langchain.agents.MRKLChain attribute)
(langchain.agents.ReActChain attribute)
(langchain.agents.SelfAskWithSearchChain attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-23 | (langchain.agents.SelfAskWithSearchChain attribute)
max_iterations (langchain.agents.AgentExecutor attribute)
(langchain.agents.MRKLChain attribute)
(langchain.agents.ReActChain attribute)
(langchain.agents.SelfAskWithSearchChain attribute)
max_length (langchain.llms.NLPCloud attribute)
(langchain.llms.Petals attribute)
(langchain.prompts.example_selector.LengthBasedExampleSelector attribute)
max_marginal_relevance_search() (langchain.vectorstores.Chroma method)
(langchain.vectorstores.DeepLake method)
(langchain.vectorstores.FAISS method)
(langchain.vectorstores.Milvus method)
(langchain.vectorstores.Qdrant method)
(langchain.vectorstores.VectorStore method)
max_marginal_relevance_search_by_vector() (langchain.vectorstores.Chroma method)
(langchain.vectorstores.DeepLake method)
(langchain.vectorstores.FAISS method)
(langchain.vectorstores.VectorStore method)
max_new_tokens (langchain.llms.Petals attribute)
max_retries (langchain.embeddings.OpenAIEmbeddings attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.OpenAIChat attribute)
(langchain.llms.PromptLayerOpenAIChat attribute)
max_tokens (langchain.llms.AzureOpenAI attribute)
(langchain.llms.Cohere attribute)
(langchain.llms.GooseAI attribute)
(langchain.llms.LlamaCpp attribute)
max_tokens_for_prompt() (langchain.llms.AzureOpenAI method)
(langchain.llms.OpenAI method)
(langchain.llms.PromptLayerOpenAI method)
max_tokens_limit (langchain.chains.ConversationalRetrievalChain attribute)
(langchain.chains.RetrievalQAWithSourcesChain attribute)
(langchain.chains.VectorDBQAWithSourcesChain attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-24 | (langchain.chains.VectorDBQAWithSourcesChain attribute)
max_tokens_per_generation (langchain.llms.RWKV attribute)
max_tokens_to_sample (langchain.llms.Anthropic attribute)
maximum_tokens (langchain.llms.AlephAlpha attribute)
maxTokens (langchain.llms.AI21 attribute)
memory (langchain.agents.MRKLChain attribute)
(langchain.agents.ReActChain attribute)
(langchain.agents.SelfAskWithSearchChain attribute)
(langchain.chains.ConversationChain attribute)
merge_from() (langchain.vectorstores.FAISS method)
METADATA_KEY (langchain.vectorstores.Qdrant attribute)
Milvus (class in langchain.vectorstores)
min_length (langchain.llms.NLPCloud attribute)
min_tokens (langchain.llms.GooseAI attribute)
minimum_tokens (langchain.llms.AlephAlpha attribute)
minTokens (langchain.llms.AI21 attribute)
model (langchain.embeddings.AlephAlphaAsymmetricSemanticEmbedding attribute)
(langchain.embeddings.CohereEmbeddings attribute)
(langchain.llms.AI21 attribute)
(langchain.llms.AlephAlpha attribute)
(langchain.llms.Anthropic attribute)
(langchain.llms.Cohere attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.RWKV attribute)
model_id (langchain.embeddings.SelfHostedHuggingFaceEmbeddings attribute)
(langchain.embeddings.SelfHostedHuggingFaceInstructEmbeddings attribute)
(langchain.llms.HuggingFacePipeline attribute)
(langchain.llms.SelfHostedHuggingFaceLLM attribute)
(langchain.llms.Writer attribute)
model_key (langchain.llms.Banana attribute)
model_kwargs (langchain.embeddings.HuggingFaceHubEmbeddings attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-25 | model_kwargs (langchain.embeddings.HuggingFaceHubEmbeddings attribute)
(langchain.embeddings.SagemakerEndpointEmbeddings attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.Banana attribute)
(langchain.llms.CerebriumAI attribute)
(langchain.llms.GooseAI attribute)
(langchain.llms.HuggingFaceEndpoint attribute)
(langchain.llms.HuggingFaceHub attribute)
(langchain.llms.HuggingFacePipeline attribute)
(langchain.llms.Modal attribute)
(langchain.llms.OpenAIChat attribute)
(langchain.llms.Petals attribute)
(langchain.llms.PromptLayerOpenAIChat attribute)
(langchain.llms.SagemakerEndpoint attribute)
(langchain.llms.SelfHostedHuggingFaceLLM attribute)
(langchain.llms.StochasticAI attribute)
model_load_fn (langchain.embeddings.SelfHostedHuggingFaceEmbeddings attribute)
(langchain.llms.SelfHostedHuggingFaceLLM attribute)
(langchain.llms.SelfHostedPipeline attribute)
model_name (langchain.chains.OpenAIModerationChain attribute)
(langchain.embeddings.HuggingFaceEmbeddings attribute)
(langchain.embeddings.HuggingFaceInstructEmbeddings attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.GooseAI attribute)
(langchain.llms.NLPCloud attribute)
(langchain.llms.OpenAIChat attribute)
(langchain.llms.Petals attribute)
(langchain.llms.PromptLayerOpenAIChat attribute)
model_path (langchain.llms.LlamaCpp attribute)
model_reqs (langchain.embeddings.SelfHostedHuggingFaceEmbeddings attribute)
(langchain.embeddings.SelfHostedHuggingFaceInstructEmbeddings attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-26 | (langchain.embeddings.SelfHostedHuggingFaceInstructEmbeddings attribute)
(langchain.llms.SelfHostedHuggingFaceLLM attribute)
(langchain.llms.SelfHostedPipeline attribute)
model_url (langchain.embeddings.TensorflowHubEmbeddings attribute)
modelname_to_contextsize() (langchain.llms.AzureOpenAI method)
(langchain.llms.OpenAI method)
(langchain.llms.PromptLayerOpenAI method)
module
langchain.agents
langchain.chains
langchain.docstore
langchain.embeddings
langchain.llms
langchain.prompts
langchain.prompts.example_selector
langchain.python
langchain.serpapi
langchain.text_splitter
langchain.utilities.searx_search
langchain.vectorstores
N
n (langchain.llms.AlephAlpha attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.GooseAI attribute)
n_batch (langchain.embeddings.LlamaCppEmbeddings attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
n_ctx (langchain.embeddings.LlamaCppEmbeddings attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
n_parts (langchain.embeddings.LlamaCppEmbeddings attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
n_predict (langchain.llms.GPT4All attribute)
n_threads (langchain.embeddings.LlamaCppEmbeddings attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
NLTKTextSplitter (class in langchain.text_splitter)
normalize (langchain.embeddings.AlephAlphaAsymmetricSemanticEmbedding attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-27 | normalize (langchain.embeddings.AlephAlphaAsymmetricSemanticEmbedding attribute)
num_beams (langchain.llms.NLPCloud attribute)
num_return_sequences (langchain.llms.NLPCloud attribute)
numResults (langchain.llms.AI21 attribute)
O
observation_prefix (langchain.agents.Agent property)
(langchain.agents.ConversationalAgent property)
(langchain.agents.ConversationalChatAgent property)
(langchain.agents.ZeroShotAgent property)
openai_api_key (langchain.chains.OpenAIModerationChain attribute)
openai_organization (langchain.chains.OpenAIModerationChain attribute)
OpenSearchVectorSearch (class in langchain.vectorstores)
output_key (langchain.chains.QAGenerationChain attribute)
output_keys (langchain.chains.ConstitutionalChain property)
(langchain.chains.HypotheticalDocumentEmbedder property)
(langchain.chains.QAGenerationChain property)
output_parser (langchain.agents.ConversationalChatAgent attribute)
(langchain.agents.LLMSingleActionAgent attribute)
(langchain.prompts.BasePromptTemplate attribute)
output_variables (langchain.chains.TransformChain attribute)
P
p (langchain.llms.Cohere attribute)
param_mapping (langchain.chains.OpenAPIEndpointChain attribute)
params (langchain.serpapi.SerpAPIWrapper attribute)
(langchain.utilities.searx_search.SearxSearchWrapper attribute)
parse() (langchain.agents.AgentOutputParser method)
partial() (langchain.prompts.BasePromptTemplate method)
(langchain.prompts.ChatPromptTemplate method)
penalty_alpha_frequency (langchain.llms.RWKV attribute)
penalty_alpha_presence (langchain.llms.RWKV attribute)
penalty_bias (langchain.llms.AlephAlpha attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-28 | penalty_bias (langchain.llms.AlephAlpha attribute)
penalty_exceptions (langchain.llms.AlephAlpha attribute)
penalty_exceptions_include_stop_sequences (langchain.llms.AlephAlpha attribute)
persist() (langchain.vectorstores.Chroma method)
(langchain.vectorstores.DeepLake method)
Pinecone (class in langchain.vectorstores)
plan() (langchain.agents.Agent method)
(langchain.agents.BaseMultiActionAgent method)
(langchain.agents.BaseSingleActionAgent method)
(langchain.agents.LLMSingleActionAgent method)
predict() (langchain.chains.LLMChain method)
predict_and_parse() (langchain.chains.LLMChain method)
prefix (langchain.prompts.FewShotPromptTemplate attribute)
(langchain.prompts.FewShotPromptWithTemplates attribute)
prefix_messages (langchain.llms.OpenAIChat attribute)
(langchain.llms.PromptLayerOpenAIChat attribute)
prep_prompts() (langchain.chains.LLMChain method)
prep_streaming_params() (langchain.llms.AzureOpenAI method)
(langchain.llms.OpenAI method)
(langchain.llms.PromptLayerOpenAI method)
presence_penalty (langchain.llms.AlephAlpha attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.Cohere attribute)
(langchain.llms.GooseAI attribute)
presencePenalty (langchain.llms.AI21 attribute)
Prompt (in module langchain.prompts)
prompt (langchain.chains.ConversationChain attribute)
(langchain.chains.LLMBashChain attribute)
(langchain.chains.LLMChain attribute)
(langchain.chains.LLMMathChain attribute)
(langchain.chains.PALChain attribute)
(langchain.chains.SQLDatabaseChain attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-29 | (langchain.chains.PALChain attribute)
(langchain.chains.SQLDatabaseChain attribute)
python_globals (langchain.chains.PALChain attribute)
python_locals (langchain.chains.PALChain attribute)
PythonCodeTextSplitter (class in langchain.text_splitter)
Q
qa_chain (langchain.chains.GraphQAChain attribute)
Qdrant (class in langchain.vectorstores)
query_instruction (langchain.embeddings.HuggingFaceInstructEmbeddings attribute)
(langchain.embeddings.SelfHostedHuggingFaceInstructEmbeddings attribute)
query_suffix (langchain.utilities.searx_search.SearxSearchWrapper attribute)
R
random_seed (langchain.llms.Writer attribute)
raw_completion (langchain.llms.AlephAlpha attribute)
REACT_DOCSTORE (langchain.agents.AgentType attribute)
RecursiveCharacterTextSplitter (class in langchain.text_splitter)
reduce_k_below_max_tokens (langchain.chains.RetrievalQAWithSourcesChain attribute)
(langchain.chains.VectorDBQAWithSourcesChain attribute)
region_name (langchain.embeddings.SagemakerEndpointEmbeddings attribute)
(langchain.llms.SagemakerEndpoint attribute)
remove_end_sequence (langchain.llms.NLPCloud attribute)
remove_input (langchain.llms.NLPCloud attribute)
repeat_last_n (langchain.llms.GPT4All attribute)
repeat_penalty (langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
repetition_penalties_include_completion (langchain.llms.AlephAlpha attribute)
repetition_penalties_include_prompt (langchain.llms.AlephAlpha attribute)
repetition_penalty (langchain.llms.ForefrontAI attribute)
(langchain.llms.NLPCloud attribute)
(langchain.llms.Writer attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-30 | (langchain.llms.NLPCloud attribute)
(langchain.llms.Writer attribute)
repo_id (langchain.embeddings.HuggingFaceHubEmbeddings attribute)
(langchain.llms.HuggingFaceHub attribute)
request_timeout (langchain.llms.AzureOpenAI attribute)
requests (langchain.chains.OpenAPIEndpointChain attribute)
requests_wrapper (langchain.chains.APIChain attribute)
(langchain.chains.LLMRequestsChain attribute)
results() (langchain.serpapi.SerpAPIWrapper method)
(langchain.utilities.searx_search.SearxSearchWrapper method)
retriever (langchain.chains.ConversationalRetrievalChain attribute)
(langchain.chains.RetrievalQA attribute)
(langchain.chains.RetrievalQAWithSourcesChain attribute)
return_all (langchain.chains.SequentialChain attribute)
return_direct (langchain.chains.SQLDatabaseChain attribute)
return_intermediate_steps (langchain.agents.AgentExecutor attribute)
(langchain.agents.MRKLChain attribute)
(langchain.agents.ReActChain attribute)
(langchain.agents.SelfAskWithSearchChain attribute)
(langchain.chains.OpenAPIEndpointChain attribute)
(langchain.chains.PALChain attribute)
(langchain.chains.SQLDatabaseChain attribute)
(langchain.chains.SQLDatabaseSequentialChain attribute)
return_stopped_response() (langchain.agents.Agent method)
(langchain.agents.BaseMultiActionAgent method)
(langchain.agents.BaseSingleActionAgent method)
return_values (langchain.agents.Agent property)
(langchain.agents.BaseMultiActionAgent property)
(langchain.agents.BaseSingleActionAgent property)
revised_answer_prompt (langchain.chains.LLMCheckerChain attribute)
revised_summary_prompt (langchain.chains.LLMSummarizationCheckerChain attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-31 | revised_summary_prompt (langchain.chains.LLMSummarizationCheckerChain attribute)
revision_chain (langchain.chains.ConstitutionalChain attribute)
run() (langchain.python.PythonREPL method)
(langchain.serpapi.SerpAPIWrapper method)
(langchain.utilities.searx_search.SearxSearchWrapper method)
rwkv_verbose (langchain.llms.RWKV attribute)
S
save() (langchain.agents.AgentExecutor method)
(langchain.agents.BaseMultiActionAgent method)
(langchain.agents.BaseSingleActionAgent method)
(langchain.llms.AI21 method)
(langchain.llms.AlephAlpha method)
(langchain.llms.Anthropic method)
(langchain.llms.AzureOpenAI method)
(langchain.llms.Banana method)
(langchain.llms.CerebriumAI method)
(langchain.llms.Cohere method)
(langchain.llms.DeepInfra method)
(langchain.llms.ForefrontAI method)
(langchain.llms.GooseAI method)
(langchain.llms.GPT4All method)
(langchain.llms.HuggingFaceEndpoint method)
(langchain.llms.HuggingFaceHub method)
(langchain.llms.HuggingFacePipeline method)
(langchain.llms.LlamaCpp method)
(langchain.llms.Modal method)
(langchain.llms.NLPCloud method)
(langchain.llms.OpenAI method)
(langchain.llms.OpenAIChat method)
(langchain.llms.Petals method)
(langchain.llms.PromptLayerOpenAI method)
(langchain.llms.PromptLayerOpenAIChat method)
(langchain.llms.Replicate method)
(langchain.llms.RWKV method)
(langchain.llms.SagemakerEndpoint method)
(langchain.llms.SelfHostedHuggingFaceLLM method) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-32 | (langchain.llms.SelfHostedHuggingFaceLLM method)
(langchain.llms.SelfHostedPipeline method)
(langchain.llms.StochasticAI method)
(langchain.llms.Writer method)
(langchain.prompts.BasePromptTemplate method)
(langchain.prompts.ChatPromptTemplate method)
save_agent() (langchain.agents.AgentExecutor method)
save_local() (langchain.vectorstores.FAISS method)
search() (langchain.docstore.InMemoryDocstore method)
(langchain.docstore.Wikipedia method)
(langchain.vectorstores.DeepLake method)
search_kwargs (langchain.chains.ChatVectorDBChain attribute)
(langchain.chains.VectorDBQA attribute)
(langchain.chains.VectorDBQAWithSourcesChain attribute)
search_type (langchain.chains.VectorDBQA attribute)
searx_host (langchain.utilities.searx_search.SearxSearchWrapper attribute)
SearxResults (class in langchain.utilities.searx_search)
seed (langchain.embeddings.LlamaCppEmbeddings attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
select_examples() (langchain.prompts.example_selector.LengthBasedExampleSelector method)
(langchain.prompts.example_selector.MaxMarginalRelevanceExampleSelector method)
(langchain.prompts.example_selector.SemanticSimilarityExampleSelector method)
SELF_ASK_WITH_SEARCH (langchain.agents.AgentType attribute)
serpapi_api_key (langchain.serpapi.SerpAPIWrapper attribute)
similarity_search() (langchain.vectorstores.AtlasDB method)
(langchain.vectorstores.Chroma method)
(langchain.vectorstores.DeepLake method)
(langchain.vectorstores.ElasticVectorSearch method)
(langchain.vectorstores.FAISS method)
(langchain.vectorstores.Milvus method) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-33 | (langchain.vectorstores.FAISS method)
(langchain.vectorstores.Milvus method)
(langchain.vectorstores.OpenSearchVectorSearch method)
(langchain.vectorstores.Pinecone method)
(langchain.vectorstores.Qdrant method)
(langchain.vectorstores.VectorStore method)
(langchain.vectorstores.Weaviate method)
similarity_search_by_vector() (langchain.vectorstores.Chroma method)
(langchain.vectorstores.DeepLake method)
(langchain.vectorstores.FAISS method)
(langchain.vectorstores.VectorStore method)
(langchain.vectorstores.Weaviate method)
similarity_search_with_score() (langchain.vectorstores.Chroma method)
(langchain.vectorstores.DeepLake method)
(langchain.vectorstores.FAISS method)
(langchain.vectorstores.Milvus method)
(langchain.vectorstores.Pinecone method)
(langchain.vectorstores.Qdrant method)
similarity_search_with_score_by_vector() (langchain.vectorstores.FAISS method)
SpacyTextSplitter (class in langchain.text_splitter)
split_documents() (langchain.text_splitter.TextSplitter method)
split_text() (langchain.text_splitter.CharacterTextSplitter method)
(langchain.text_splitter.NLTKTextSplitter method)
(langchain.text_splitter.RecursiveCharacterTextSplitter method)
(langchain.text_splitter.SpacyTextSplitter method)
(langchain.text_splitter.TextSplitter method)
(langchain.text_splitter.TokenTextSplitter method)
sql_chain (langchain.chains.SQLDatabaseSequentialChain attribute)
stop (langchain.agents.LLMSingleActionAgent attribute)
(langchain.chains.PALChain attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
(langchain.llms.Writer attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-34 | (langchain.llms.LlamaCpp attribute)
(langchain.llms.Writer attribute)
stop_sequences (langchain.llms.AlephAlpha attribute)
strategy (langchain.llms.RWKV attribute)
stream() (langchain.llms.Anthropic method)
(langchain.llms.AzureOpenAI method)
(langchain.llms.OpenAI method)
(langchain.llms.PromptLayerOpenAI method)
streaming (langchain.llms.Anthropic attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.OpenAIChat attribute)
(langchain.llms.PromptLayerOpenAIChat attribute)
strip_outputs (langchain.chains.SimpleSequentialChain attribute)
suffix (langchain.llms.LlamaCpp attribute)
(langchain.prompts.FewShotPromptTemplate attribute)
(langchain.prompts.FewShotPromptWithTemplates attribute)
T
task (langchain.embeddings.HuggingFaceHubEmbeddings attribute)
(langchain.llms.HuggingFaceEndpoint attribute)
(langchain.llms.HuggingFaceHub attribute)
(langchain.llms.SelfHostedHuggingFaceLLM attribute)
temp (langchain.llms.GPT4All attribute)
temperature (langchain.llms.AI21 attribute)
(langchain.llms.AlephAlpha attribute)
(langchain.llms.Anthropic attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.Cohere attribute)
(langchain.llms.ForefrontAI attribute)
(langchain.llms.GooseAI attribute)
(langchain.llms.LlamaCpp attribute)
(langchain.llms.NLPCloud attribute)
(langchain.llms.Petals attribute)
(langchain.llms.RWKV attribute)
(langchain.llms.Writer attribute)
template (langchain.prompts.PromptTemplate attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-35 | (langchain.llms.Writer attribute)
template (langchain.prompts.PromptTemplate attribute)
template_format (langchain.prompts.FewShotPromptTemplate attribute)
(langchain.prompts.FewShotPromptWithTemplates attribute)
(langchain.prompts.PromptTemplate attribute)
text_length (langchain.chains.LLMRequestsChain attribute)
text_splitter (langchain.chains.AnalyzeDocumentChain attribute)
(langchain.chains.MapReduceChain attribute)
(langchain.chains.QAGenerationChain attribute)
TextSplitter (class in langchain.text_splitter)
tokenizer (langchain.llms.Petals attribute)
tokens (langchain.llms.AlephAlpha attribute)
tokens_path (langchain.llms.RWKV attribute)
tokens_to_generate (langchain.llms.Writer attribute)
TokenTextSplitter (class in langchain.text_splitter)
tool() (in module langchain.agents)
tool_run_logging_kwargs() (langchain.agents.Agent method)
(langchain.agents.BaseMultiActionAgent method)
(langchain.agents.BaseSingleActionAgent method)
(langchain.agents.LLMSingleActionAgent method)
tools (langchain.agents.AgentExecutor attribute)
(langchain.agents.MRKLChain attribute)
(langchain.agents.ReActChain attribute)
(langchain.agents.SelfAskWithSearchChain attribute)
top_k (langchain.chains.SQLDatabaseChain attribute)
(langchain.llms.AlephAlpha attribute)
(langchain.llms.Anthropic attribute)
(langchain.llms.ForefrontAI attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
(langchain.llms.NLPCloud attribute)
(langchain.llms.Petals attribute)
(langchain.llms.Writer attribute)
top_k_docs_for_context (langchain.chains.ChatVectorDBChain attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-36 | top_k_docs_for_context (langchain.chains.ChatVectorDBChain attribute)
top_p (langchain.llms.AlephAlpha attribute)
(langchain.llms.Anthropic attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.ForefrontAI attribute)
(langchain.llms.GooseAI attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
(langchain.llms.NLPCloud attribute)
(langchain.llms.Petals attribute)
(langchain.llms.RWKV attribute)
(langchain.llms.Writer attribute)
topP (langchain.llms.AI21 attribute)
transform (langchain.chains.TransformChain attribute)
truncate (langchain.embeddings.CohereEmbeddings attribute)
(langchain.llms.Cohere attribute)
U
unsecure (langchain.utilities.searx_search.SearxSearchWrapper attribute)
update_forward_refs() (langchain.llms.AI21 class method)
(langchain.llms.AlephAlpha class method)
(langchain.llms.Anthropic class method)
(langchain.llms.AzureOpenAI class method)
(langchain.llms.Banana class method)
(langchain.llms.CerebriumAI class method)
(langchain.llms.Cohere class method)
(langchain.llms.DeepInfra class method)
(langchain.llms.ForefrontAI class method)
(langchain.llms.GooseAI class method)
(langchain.llms.GPT4All class method)
(langchain.llms.HuggingFaceEndpoint class method)
(langchain.llms.HuggingFaceHub class method)
(langchain.llms.HuggingFacePipeline class method)
(langchain.llms.LlamaCpp class method)
(langchain.llms.Modal class method)
(langchain.llms.NLPCloud class method) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-37 | (langchain.llms.NLPCloud class method)
(langchain.llms.OpenAI class method)
(langchain.llms.OpenAIChat class method)
(langchain.llms.Petals class method)
(langchain.llms.PromptLayerOpenAI class method)
(langchain.llms.PromptLayerOpenAIChat class method)
(langchain.llms.Replicate class method)
(langchain.llms.RWKV class method)
(langchain.llms.SagemakerEndpoint class method)
(langchain.llms.SelfHostedHuggingFaceLLM class method)
(langchain.llms.SelfHostedPipeline class method)
(langchain.llms.StochasticAI class method)
(langchain.llms.Writer class method)
use_mlock (langchain.embeddings.LlamaCppEmbeddings attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
use_multiplicative_presence_penalty (langchain.llms.AlephAlpha attribute)
V
validate_template (langchain.prompts.FewShotPromptTemplate attribute)
(langchain.prompts.FewShotPromptWithTemplates attribute)
(langchain.prompts.PromptTemplate attribute)
VectorStore (class in langchain.vectorstores)
vectorstore (langchain.chains.ChatVectorDBChain attribute)
(langchain.chains.VectorDBQA attribute)
(langchain.chains.VectorDBQAWithSourcesChain attribute)
(langchain.prompts.example_selector.SemanticSimilarityExampleSelector attribute)
verbose (langchain.agents.MRKLChain attribute)
(langchain.agents.ReActChain attribute)
(langchain.agents.SelfAskWithSearchChain attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.OpenAI attribute)
(langchain.llms.OpenAIChat attribute)
vocab_only (langchain.embeddings.LlamaCppEmbeddings attribute) |
{
"url": "https://python.langchain.com/en/latest/genindex.html"
} | f445e36f9edb-38 | vocab_only (langchain.embeddings.LlamaCppEmbeddings attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
W
Weaviate (class in langchain.vectorstores)
Wikipedia (class in langchain.docstore)
Z
ZERO_SHOT_REACT_DESCRIPTION (langchain.agents.AgentType attribute)
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/glossary.html"
} | e9f602475ea6-0 | .md
.pdf
Glossary
Contents
Chain of Thought Prompting
Action Plan Generation
ReAct Prompting
Self-ask
Prompt Chaining
Memetic Proxy
Self Consistency
Inception
MemPrompt
Glossary#
This is a collection of terminology commonly used when developing LLM applications.
It contains reference to external papers or sources where the concept was first introduced,
as well as to places in LangChain where the concept is used.
Chain of Thought Prompting#
A prompting technique used to encourage the model to generate a series of intermediate reasoning steps.
A less formal way to induce this behavior is to include βLetβs think step-by-stepβ in the prompt.
Resources:
Chain-of-Thought Paper
Step-by-Step Paper
Action Plan Generation#
A prompt usage that uses a language model to generate actions to take.
The results of these actions can then be fed back into the language model to generate a subsequent action.
Resources:
WebGPT Paper
SayCan Paper
ReAct Prompting#
A prompting technique that combines Chain-of-Thought prompting with action plan generation.
This induces the to model to think about what action to take, then take it.
Resources:
Paper
LangChain Example
Self-ask#
A prompting method that builds on top of chain-of-thought prompting.
In this method, the model explicitly asks itself follow-up questions, which are then answered by an external search engine.
Resources:
Paper
LangChain Example
Prompt Chaining#
Combining multiple LLM calls together, with the output of one-step being the input to the next.
Resources:
PromptChainer Paper
Language Model Cascades
ICE Primer Book
Socratic Models
Memetic Proxy# |
{
"url": "https://python.langchain.com/en/latest/glossary.html"
} | e9f602475ea6-1 | Language Model Cascades
ICE Primer Book
Socratic Models
Memetic Proxy#
Encouraging the LLM to respond in a certain way framing the discussion in a context that the model knows of and that will result in that type of response. For example, as a conversation between a student and a teacher.
Resources:
Paper
Self Consistency#
A decoding strategy that samples a diverse set of reasoning paths and then selects the most consistent answer.
Is most effective when combined with Chain-of-thought prompting.
Resources:
Paper
Inception#
Also called βFirst Person Instructionβ.
Encouraging the model to think a certain way by including the start of the modelβs response in the prompt.
Resources:
Example
MemPrompt#
MemPrompt maintains a memory of errors and user feedback, and uses them to prevent repetition of mistakes.
Resources:
Paper
previous
Writer
next
LangChain Gallery
Contents
Chain of Thought Prompting
Action Plan Generation
ReAct Prompting
Self-ask
Prompt Chaining
Memetic Proxy
Self Consistency
Inception
MemPrompt
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/reference.html"
} | f60104d7b9b5-0 | .rst
.pdf
API References
API References#
All of LangChainβs reference documentation, in one place.
Full documentation on all methods, classes, and APIs in LangChain.
Prompts
Utilities
Chains
Agents
previous
Integrations
next
Utilities
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/index.html"
} | 23852d460fa9-0 | .rst
.pdf
Welcome to LangChain
Contents
Getting Started
Modules
Use Cases
Reference Docs
LangChain Ecosystem
Additional Resources
Welcome to LangChain#
LangChain is a framework for developing applications powered by language models. We believe that the most powerful and differentiated applications will not only call out to a language model via an API, but will also:
Be data-aware: connect a language model to other sources of data
Be agentic: allow a language model to interact with its environment
The LangChain framework is designed with the above principles in mind.
This is the Python specific portion of the documentation. For a purely conceptual guide to LangChain, see here. For the JavaScript documentation, see here.
Getting Started#
Checkout the below guide for a walkthrough of how to get started using LangChain to create an Language Model application.
Getting Started Documentation
Modules#
There are several main modules that LangChain provides support for.
For each module we provide some examples to get started, how-to guides, reference docs, and conceptual guides.
These modules are, in increasing order of complexity:
Models: The various model types and model integrations LangChain supports.
Prompts: This includes prompt management, prompt optimization, and prompt serialization.
Memory: Memory is the concept of persisting state between calls of a chain/agent. LangChain provides a standard interface for memory, a collection of memory implementations, and examples of chains/agents that use memory.
Indexes: Language models are often more powerful when combined with your own text data - this module covers best practices for doing exactly that.
Chains: Chains go beyond just a single LLM call, and are sequences of calls (whether to an LLM or a different utility). LangChain provides a standard interface for chains, lots of integrations with other tools, and end-to-end chains for common applications. |
{
"url": "https://python.langchain.com/en/latest/index.html"
} | 23852d460fa9-1 | Agents: Agents involve an LLM making decisions about which Actions to take, taking that Action, seeing an Observation, and repeating that until done. LangChain provides a standard interface for agents, a selection of agents to choose from, and examples of end to end agents.
Use Cases#
The above modules can be used in a variety of ways. LangChain also provides guidance and assistance in this. Below are some of the common use cases LangChain supports.
Personal Assistants: The main LangChain use case. Personal assistants need to take actions, remember interactions, and have knowledge about your data.
Question Answering: The second big LangChain use case. Answering questions over specific documents, only utilizing the information in those documents to construct an answer.
Chatbots: Since language models are good at producing text, that makes them ideal for creating chatbots.
Querying Tabular Data: If you want to understand how to use LLMs to query data that is stored in a tabular format (csvs, SQL, dataframes, etc) you should read this page.
Interacting with APIs: Enabling LLMs to interact with APIs is extremely powerful in order to give them more up-to-date information and allow them to take actions.
Extraction: Extract structured information from text.
Summarization: Summarizing longer documents into shorter, more condensed chunks of information. A type of Data Augmented Generation.
Evaluation: Generative models are notoriously hard to evaluate with traditional metrics. One new way of evaluating them is using language models themselves to do the evaluation. LangChain provides some prompts/chains for assisting in this.
Reference Docs#
All of LangChainβs reference documentation, in one place. Full documentation on all methods, classes, installation methods, and integration setups for LangChain.
Reference Documentation
LangChain Ecosystem#
Guides for how other companies/products can be used with LangChain
LangChain Ecosystem |
{
"url": "https://python.langchain.com/en/latest/index.html"
} | 23852d460fa9-2 | Guides for how other companies/products can be used with LangChain
LangChain Ecosystem
Additional Resources#
Additional collection of resources we think may be useful as you develop your application!
LangChainHub: The LangChainHub is a place to share and explore other prompts, chains, and agents.
Glossary: A glossary of all related terms, papers, methods, etc. Whether implemented in LangChain or not!
Gallery: A collection of our favorite projects that use LangChain. Useful for finding inspiration or seeing how things were done in other applications.
Deployments: A collection of instructions, code snippets, and template repositories for deploying LangChain apps.
Tracing: A guide on using tracing in LangChain to visualize the execution of chains and agents.
Model Laboratory: Experimenting with different prompts, models, and chains is a big part of developing the best possible application. The ModelLaboratory makes it easy to do so.
Discord: Join us on our Discord to discuss all things LangChain!
Production Support: As you move your LangChains into production, weβd love to offer more comprehensive support. Please fill out this form and weβll set up a dedicated support Slack channel.
next
Quickstart Guide
Contents
Getting Started
Modules
Use Cases
Reference Docs
LangChain Ecosystem
Additional Resources
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/gallery.html"
} | 8147846d684e-0 | .rst
.pdf
LangChain Gallery
Contents
Open Source
Misc. Colab Notebooks
Proprietary
LangChain Gallery#
Lots of people have built some pretty awesome stuff with LangChain.
This is a collection of our favorites.
If you see any other demos that you think we should highlight, be sure to let us know!
Open Source#
HowDoI.ai
This is an experiment in building a large-language-model-backed chatbot. It can hold a conversation, remember previous comments/questions,
and answer all types of queries (history, web search, movie data, weather, news, and more).
YouTube Transcription QA with Sources
An end-to-end example of doing question answering on YouTube transcripts, returning the timestamps as sources to legitimize the answer.
QA Slack Bot
This application is a Slack Bot that uses Langchain and OpenAIβs GPT3 language model to provide domain specific answers. You provide the documents.
ThoughtSource
A central, open resource and community around data and tools related to chain-of-thought reasoning in large language models.
LLM Strategy
This Python package adds a decorator llm_strategy that connects to an LLM (such as OpenAIβs GPT-3) and uses the LLM to βimplementβ abstract methods in interface classes. It does this by forwarding requests to the LLM and converting the responses back to Python data using Pythonβs @dataclasses.
Zero-Shot Corporate Lobbyist
A notebook showing how to use GPT to help with the work of a corporate lobbyist.
Dagster Documentation ChatBot
A jupyter notebook demonstrating how you could create a semantic search engine on documents in one of your Google Folders
Google Folder Semantic Search
Build a GitHub support bot with GPT3, LangChain, and Python.
Talk With Wind
Record sounds of anything (birds, wind, fire, train station) and chat with it. |
{
"url": "https://python.langchain.com/en/latest/gallery.html"
} | 8147846d684e-1 | Record sounds of anything (birds, wind, fire, train station) and chat with it.
ChatGPT LangChain
This simple application demonstrates a conversational agent implemented with OpenAI GPT-3.5 and LangChain. When necessary, it leverages tools for complex math, searching the internet, and accessing news and weather.
GPT Math Techniques
A Hugging Face spaces project showing off the benefits of using PAL for math problems.
GPT Political Compass
Measure the political compass of GPT.
Notion Database Question-Answering Bot
Open source GitHub project shows how to use LangChain to create a chatbot that can answer questions about an arbitrary Notion database.
LlamaIndex
LlamaIndex (formerly GPT Index) is a project consisting of a set of data structures that are created using GPT-3 and can be traversed using GPT-3 in order to answer queries.
Groverβs Algorithm
Leveraging Qiskit, OpenAI and LangChain to demonstrate Groverβs algorithm
QNimGPT
A chat UI to play Nim, where a player can select an opponent, either a quantum computer or an AI
ReAct TextWorld
Leveraging the ReActTextWorldAgent to play TextWorld with an LLM!
Fact Checker
This repo is a simple demonstration of using LangChain to do fact-checking with prompt chaining.
DocsGPT
Answer questions about the documentation of any project
Misc. Colab Notebooks#
Wolfram Alpha in Conversational Agent
Give ChatGPT a WolframAlpha neural implant
Tool Updates in Agents
Agent improvements (6th Jan 2023)
Conversational Agent with Tools (Langchain AGI)
Langchain AGI (23rd Dec 2022)
Proprietary#
Daimon
A chat-based AI personal assistant with long-term memory about you. |
{
"url": "https://python.langchain.com/en/latest/gallery.html"
} | 8147846d684e-2 | Daimon
A chat-based AI personal assistant with long-term memory about you.
AI Assisted SQL Query Generator
An app to write SQL using natural language, and execute against real DB.
Clerkie
Stack Tracing QA Bot to help debug complex stack tracing (especially the ones that go multi-function/file deep).
Sales Email Writer
By Raza Habib, this demo utilizes LangChain + SerpAPI + HumanLoop to write sales emails. Give it a company name and a person, this application will use Google Search (via SerpAPI) to get more information on the company and the person, and then write them a sales message.
Question-Answering on a Web Browser
By Zahid Khawaja, this demo utilizes question answering to answer questions about a given website. A followup added this for YouTube videos, and then another followup added it for Wikipedia.
Mynd
A journaling app for self-care that uses AI to uncover insights and patterns over time.
previous
Glossary
next
Deployments
Contents
Open Source
Misc. Colab Notebooks
Proprietary
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/ecosystem.html"
} | 6bc875b46e8e-0 | .rst
.pdf
LangChain Ecosystem
LangChain Ecosystem#
Guides for how other companies/products can be used with LangChain
AI21 Labs
Aim
Apify
AtlasDB
Banana
CerebriumAI
Chroma
ClearML Integration
Getting API Credentials
Setting Up
Scenario 1: Just an LLM
Scenario 2: Creating a agent with tools
Tips and Next Steps
Cohere
DeepInfra
Deep Lake
ForefrontAI
Google Search Wrapper
Google Serper Wrapper
GooseAI
GPT4All
Graphsignal
Hazy Research
Helicone
Hugging Face
Jina
Llama.cpp
Milvus
Modal
NLPCloud
OpenAI
OpenSearch
Petals
PGVector
Pinecone
PromptLayer
Qdrant
Replicate
Runhouse
RWKV-4
SearxNG Search API
SerpAPI
StochasticAI
Unstructured
Weights & Biases
Weaviate
Wolfram Alpha Wrapper
Writer
previous
Agents
next
AI21 Labs
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/model_laboratory.html"
} | edf665b7054b-0 | .ipynb
.pdf
Model Comparison
Model Comparison#
Constructing your language model application will likely involved choosing between many different options of prompts, models, and even chains to use. When doing so, you will want to compare these different options on different inputs in an easy, flexible, and intuitive way.
LangChain provides the concept of a ModelLaboratory to test out and try different models.
from langchain import LLMChain, OpenAI, Cohere, HuggingFaceHub, PromptTemplate
from langchain.model_laboratory import ModelLaboratory
llms = [
OpenAI(temperature=0),
Cohere(model="command-xlarge-20221108", max_tokens=20, temperature=0),
HuggingFaceHub(repo_id="google/flan-t5-xl", model_kwargs={"temperature":1})
]
model_lab = ModelLaboratory.from_llms(llms)
model_lab.compare("What color is a flamingo?")
Input:
What color is a flamingo?
OpenAI
Params: {'model': 'text-davinci-002', 'temperature': 0.0, 'max_tokens': 256, 'top_p': 1, 'frequency_penalty': 0, 'presence_penalty': 0, 'n': 1, 'best_of': 1}
Flamingos are pink.
Cohere
Params: {'model': 'command-xlarge-20221108', 'max_tokens': 20, 'temperature': 0.0, 'k': 0, 'p': 1, 'frequency_penalty': 0, 'presence_penalty': 0}
Pink
HuggingFaceHub
Params: {'repo_id': 'google/flan-t5-xl', 'temperature': 1}
pink |
{
"url": "https://python.langchain.com/en/latest/model_laboratory.html"
} | edf665b7054b-1 | pink
prompt = PromptTemplate(template="What is the capital of {state}?", input_variables=["state"])
model_lab_with_prompt = ModelLaboratory.from_llms(llms, prompt=prompt)
model_lab_with_prompt.compare("New York")
Input:
New York
OpenAI
Params: {'model': 'text-davinci-002', 'temperature': 0.0, 'max_tokens': 256, 'top_p': 1, 'frequency_penalty': 0, 'presence_penalty': 0, 'n': 1, 'best_of': 1}
The capital of New York is Albany.
Cohere
Params: {'model': 'command-xlarge-20221108', 'max_tokens': 20, 'temperature': 0.0, 'k': 0, 'p': 1, 'frequency_penalty': 0, 'presence_penalty': 0}
The capital of New York is Albany.
HuggingFaceHub
Params: {'repo_id': 'google/flan-t5-xl', 'temperature': 1}
st john s
from langchain import SelfAskWithSearchChain, SerpAPIWrapper
open_ai_llm = OpenAI(temperature=0)
search = SerpAPIWrapper()
self_ask_with_search_openai = SelfAskWithSearchChain(llm=open_ai_llm, search_chain=search, verbose=True)
cohere_llm = Cohere(temperature=0, model="command-xlarge-20221108")
search = SerpAPIWrapper()
self_ask_with_search_cohere = SelfAskWithSearchChain(llm=cohere_llm, search_chain=search, verbose=True)
chains = [self_ask_with_search_openai, self_ask_with_search_cohere]
names = [str(open_ai_llm), str(cohere_llm)] |
{
"url": "https://python.langchain.com/en/latest/model_laboratory.html"
} | edf665b7054b-2 | names = [str(open_ai_llm), str(cohere_llm)]
model_lab = ModelLaboratory(chains, names=names)
model_lab.compare("What is the hometown of the reigning men's U.S. Open champion?")
Input:
What is the hometown of the reigning men's U.S. Open champion?
OpenAI
Params: {'model': 'text-davinci-002', 'temperature': 0.0, 'max_tokens': 256, 'top_p': 1, 'frequency_penalty': 0, 'presence_penalty': 0, 'n': 1, 'best_of': 1}
> Entering new chain...
What is the hometown of the reigning men's U.S. Open champion?
Are follow up questions needed here: Yes.
Follow up: Who is the reigning men's U.S. Open champion?
Intermediate answer: Carlos Alcaraz.
Follow up: Where is Carlos Alcaraz from?
Intermediate answer: El Palmar, Spain.
So the final answer is: El Palmar, Spain
> Finished chain.
So the final answer is: El Palmar, Spain
Cohere
Params: {'model': 'command-xlarge-20221108', 'max_tokens': 256, 'temperature': 0.0, 'k': 0, 'p': 1, 'frequency_penalty': 0, 'presence_penalty': 0}
> Entering new chain...
What is the hometown of the reigning men's U.S. Open champion?
Are follow up questions needed here: Yes.
Follow up: Who is the reigning men's U.S. Open champion?
Intermediate answer: Carlos Alcaraz.
So the final answer is:
Carlos Alcaraz
> Finished chain.
So the final answer is:
Carlos Alcaraz
By Harrison Chase |
{
"url": "https://python.langchain.com/en/latest/model_laboratory.html"
} | edf665b7054b-3 | So the final answer is:
Carlos Alcaraz
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/tracing.html"
} | 3b985276c6a0-0 | .md
.pdf
Tracing
Contents
Tracing Walkthrough
Changing Sessions
Tracing#
By enabling tracing in your LangChain runs, youβll be able to more effectively visualize, step through, and debug your chains and agents.
First, you should install tracing and set up your environment properly.
You can use either a locally hosted version of this (uses Docker) or a cloud hosted version (in closed alpha).
If youβre interested in using the hosted platform, please fill out the form here.
Locally Hosted Setup
Cloud Hosted Setup
Tracing Walkthrough#
When you first access the UI, you should see a page with your tracing sessions.
An initial one βdefaultβ should already be created for you.
A session is just a way to group traces together.
If you click on a session, it will take you to a page with no recorded traces that says βNo Runs.β
You can create a new session with the new session form.
If we click on the default session, we can see that to start we have no traces stored.
If we now start running chains and agents with tracing enabled, we will see data show up here.
To do so, we can run this notebook as an example.
After running it, we will see an initial trace show up.
From here we can explore the trace at a high level by clicking on the arrow to show nested runs.
We can keep on clicking further and further down to explore deeper and deeper.
We can also click on the βExploreβ button of the top level run to dive even deeper.
Here, we can see the inputs and outputs in full, as well as all the nested traces.
We can keep on exploring each of these nested traces in more detail.
For example, here is the lowest level trace with the exact inputs/outputs to the LLM.
Changing Sessions# |
{
"url": "https://python.langchain.com/en/latest/tracing.html"
} | 3b985276c6a0-1 | Changing Sessions#
To initially record traces to a session other than "default", you can set the LANGCHAIN_SESSION environment variable to the name of the session you want to record to:
import os
os.environ["LANGCHAIN_HANDLER"] = "langchain"
os.environ["LANGCHAIN_SESSION"] = "my_session" # Make sure this session actually exists. You can create a new session in the UI.
To switch sessions mid-script or mid-notebook, do NOT set the LANGCHAIN_SESSION environment variable. Instead: langchain.set_tracing_callback_manager(session_name="my_session")
previous
Deployments
Contents
Tracing Walkthrough
Changing Sessions
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/deployments.html"
} | 166820098a9e-0 | .md
.pdf
Deployments
Contents
Streamlit
Gradio (on Hugging Face)
Beam
Vercel
SteamShip
Langchain-serve
Deployments#
So youβve made a really cool chain - now what? How do you deploy it and make it easily sharable with the world?
This section covers several options for that.
Note that these are meant as quick deployment options for prototypes and demos, and not for production systems.
If you are looking for help with deployment of a production system, please contact us directly.
What follows is a list of template GitHub repositories aimed that are intended to be
very easy to fork and modify to use your chain.
This is far from an exhaustive list of options, and we are EXTREMELY open to contributions here.
Streamlit#
This repo serves as a template for how to deploy a LangChain with Streamlit.
It implements a chatbot interface.
It also contains instructions for how to deploy this app on the Streamlit platform.
Gradio (on Hugging Face)#
This repo serves as a template for how deploy a LangChain with Gradio.
It implements a chatbot interface, with a βBring-Your-Own-Tokenβ approach (nice for not wracking up big bills).
It also contains instructions for how to deploy this app on the Hugging Face platform.
This is heavily influenced by James Weaverβs excellent examples.
Beam#
This repo serves as a template for how deploy a LangChain with Beam.
It implements a Question Answering app and contains instructions for deploying the app as a serverless REST API.
Vercel#
A minimal example on how to run LangChain on Vercel using Flask.
SteamShip#
This repository contains LangChain adapters for Steamship, enabling LangChain developers to rapidly deploy their apps on Steamship. |
{
"url": "https://python.langchain.com/en/latest/deployments.html"
} | 166820098a9e-1 | This includes: production ready endpoints, horizontal scaling across dependencies, persistant storage of app state, multi-tenancy support, etc.
Langchain-serve#
This repository allows users to serve local chains and agents as RESTful, gRPC, or Websocket APIs thanks to Jina. Deploy your chains & agents with ease and enjoy independent scaling, serverless and autoscaling APIs, as well as a Streamlit playground on Jina AI Cloud.
previous
LangChain Gallery
next
Tracing
Contents
Streamlit
Gradio (on Hugging Face)
Beam
Vercel
SteamShip
Langchain-serve
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/search.html"
} | 4bcfa78caad0-0 | Search
Error
Please activate JavaScript to enable the search functionality.
Ctrl+K
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/reference/prompts.html"
} | 29448f94ed77-0 | .rst
.pdf
Prompts
Prompts#
The reference guides here all relate to objects for working with Prompts.
PromptTemplates
Example Selector
previous
How to serialize prompts
next
PromptTemplates
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/reference/integrations.html"
} | 8e4645c1026b-0 | .md
.pdf
Integrations
Integrations#
Besides the installation of this python package, you will also need to install packages and set environment variables depending on which chains you want to use.
Note: the reason these packages are not included in the dependencies by default is that as we imagine scaling this package, we do not want to force dependencies that are not needed.
The following use cases require specific installs and api keys:
OpenAI:
Install requirements with pip install openai
Get an OpenAI api key and either set it as an environment variable (OPENAI_API_KEY) or pass it to the LLM constructor as openai_api_key.
Cohere:
Install requirements with pip install cohere
Get a Cohere api key and either set it as an environment variable (COHERE_API_KEY) or pass it to the LLM constructor as cohere_api_key.
GooseAI:
Install requirements with pip install openai
Get an GooseAI api key and either set it as an environment variable (GOOSEAI_API_KEY) or pass it to the LLM constructor as gooseai_api_key.
Hugging Face Hub
Install requirements with pip install huggingface_hub
Get a Hugging Face Hub api token and either set it as an environment variable (HUGGINGFACEHUB_API_TOKEN) or pass it to the LLM constructor as huggingfacehub_api_token.
Petals:
Install requirements with pip install petals
Get an GooseAI api key and either set it as an environment variable (HUGGINGFACE_API_KEY) or pass it to the LLM constructor as huggingface_api_key.
CerebriumAI:
Install requirements with pip install cerebrium
Get a Cerebrium api key and either set it as an environment variable (CEREBRIUMAI_API_KEY) or pass it to the LLM constructor as cerebriumai_api_key. |
{
"url": "https://python.langchain.com/en/latest/reference/integrations.html"
} | 8e4645c1026b-1 | PromptLayer:
Install requirements with pip install promptlayer (be sure to be on version 0.1.62 or higher)
Get an API key from promptlayer.com and set it using promptlayer.api_key=<API KEY>
SerpAPI:
Install requirements with pip install google-search-results
Get a SerpAPI api key and either set it as an environment variable (SERPAPI_API_KEY) or pass it to the LLM constructor as serpapi_api_key.
GoogleSearchAPI:
Install requirements with pip install google-api-python-client
Get a Google api key and either set it as an environment variable (GOOGLE_API_KEY) or pass it to the LLM constructor as google_api_key. You will also need to set the GOOGLE_CSE_ID environment variable to your custom search engine id. You can pass it to the LLM constructor as google_cse_id as well.
WolframAlphaAPI:
Install requirements with pip install wolframalpha
Get a Wolfram Alpha api key and either set it as an environment variable (WOLFRAM_ALPHA_APPID) or pass it to the LLM constructor as wolfram_alpha_appid.
NatBot:
Install requirements with pip install playwright
Wikipedia:
Install requirements with pip install wikipedia
Elasticsearch:
Install requirements with pip install elasticsearch
Set up Elasticsearch backend. If you want to do locally, this is a good guide.
FAISS:
Install requirements with pip install faiss for Python 3.7 and pip install faiss-cpu for Python 3.10+.
Manifest:
Install requirements with pip install manifest-ml (Note: this is only available in Python 3.8+ currently).
OpenSearch:
Install requirements with pip install opensearch-py
If you want to set up OpenSearch on your local, here
DeepLake:
Install requirements with pip install deeplake |
{
"url": "https://python.langchain.com/en/latest/reference/integrations.html"
} | 8e4645c1026b-2 | DeepLake:
Install requirements with pip install deeplake
LlamaCpp:
Install requirements with pip install llama-cpp-python
Download model and convert following llama.cpp instructions
If you are using the NLTKTextSplitter or the SpacyTextSplitter, you will also need to install the appropriate models. For example, if you want to use the SpacyTextSplitter, you will need to install the en_core_web_sm model with python -m spacy download en_core_web_sm. Similarly, if you want to use the NLTKTextSplitter, you will need to install the punkt model with python -m nltk.downloader punkt.
previous
Installation
next
API References
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/reference/utils.html"
} | fe06cc2bf5ae-0 | .rst
.pdf
Utilities
Utilities#
There are a lot of different utilities that LangChain provides integrations for
These guides go over how to use them.
These can largely be grouped into two categories: generic utilities, and then utilities for working with larger text documents.
Generic Utilities
Python REPL
SerpAPI
SearxNG Search
Utilities for working with Documents
Docstore
Text Splitter
Embeddings
VectorStores
previous
API References
next
Python REPL
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/reference/installation.html"
} | 9554fbc7ebe9-0 | .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 with various model providers, datastores, etc.
By default, the dependencies needed to do that are NOT installed.
However, there are two other ways to install LangChain that do bring in those dependencies.
To install modules needed for the common LLM providers, run:
pip install langchain[llms]
To install all modules needed for all integrations, run:
pip install langchain[all]
Note that if you are using zsh, youβll need to quote square brackets when passing them as an argument to a command, for example:
pip install 'langchain[all]'
Installing from source#
If you want to install from source, you can do so by cloning the repo and running:
pip install -e .
previous
SQL Question Answering Benchmarking: Chinook
next
Integrations
Contents
Official Releases
Installing from source
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/python.html"
} | 6a22d5789610-0 | .rst
.pdf
Python REPL
Python REPL#
Mock Python REPL.
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 with own globals/locals and returns anything printed.
previous
Utilities
next
SerpAPI
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/example_selector.html"
} | 682d8972ff00-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.prompt.PromptTemplate [Required]#
Prompt template used to format the examples.
field examples: List[dict] [Required]#
A list of the examples that the prompt template expects.
field get_text_length: Callable[[str], int] = <function _get_length_based>#
Function to measure prompt length. Defaults to word count.
field max_length: int = 2048#
Max length for the prompt, beyond which examples are cut.
add_example(example: Dict[str, str]) β None[source]#
Add new example to list.
select_examples(input_variables: Dict[str, str]) β List[dict][source]#
Select which examples to use based on the input lengths.
pydantic model langchain.prompts.example_selector.MaxMarginalRelevanceExampleSelector[source]#
ExampleSelector that selects examples based on Max Marginal Relevance.
This was shown to improve performance in this paper:
https://arxiv.org/pdf/2211.13892.pdf
field fetch_k: int = 20#
Number of examples to fetch to rerank.
classmethod from_examples(examples: List[dict], embeddings: langchain.embeddings.base.Embeddings, vectorstore_cls: Type[langchain.vectorstores.base.VectorStore], k: int = 4, input_keys: Optional[List[str]] = None, fetch_k: int = 20, **vectorstore_cls_kwargs: Any) β langchain.prompts.example_selector.semantic_similarity.MaxMarginalRelevanceExampleSelector[source]#
Create k-shot example selector using example list and embeddings. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/example_selector.html"
} | 682d8972ff00-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. FAISS.
k β Number of examples to select
input_keys β If provided, the search is based on the input variables
instead of all variables.
vectorstore_cls_kwargs β optional kwargs containing url for vector store
Returns
The ExampleSelector instantiated, backed by a vector store.
select_examples(input_variables: Dict[str, str]) β List[dict][source]#
Select which examples to use based on semantic similarity.
pydantic model langchain.prompts.example_selector.SemanticSimilarityExampleSelector[source]#
Example selector that selects examples based on SemanticSimilarity.
field example_keys: Optional[List[str]] = None#
Optional keys to filter examples to.
field input_keys: Optional[List[str]] = None#
Optional keys to filter input to. If provided, the search is based on
the input variables instead of all variables.
field k: int = 4#
Number of examples to select.
field vectorstore: langchain.vectorstores.base.VectorStore [Required]#
VectorStore than contains information about examples.
add_example(example: Dict[str, str]) β str[source]#
Add new example to vectorstore.
classmethod from_examples(examples: List[dict], embeddings: langchain.embeddings.base.Embeddings, vectorstore_cls: Type[langchain.vectorstores.base.VectorStore], k: int = 4, input_keys: Optional[List[str]] = None, **vectorstore_cls_kwargs: Any) β langchain.prompts.example_selector.semantic_similarity.SemanticSimilarityExampleSelector[source]# |
{
"url": "https://python.langchain.com/en/latest/reference/modules/example_selector.html"
} | 682d8972ff00-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 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, the search is based on the input variables
instead of all variables.
vectorstore_cls_kwargs β optional kwargs containing url for vector store
Returns
The ExampleSelector instantiated, backed by a vector store.
select_examples(input_variables: Dict[str, str]) β List[dict][source]#
Select which examples to use based on semantic similarity.
previous
PromptTemplates
next
Chat Prompt Template
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/embeddings.html"
} | f9d90154b39f-0 | .rst
.pdf
Embeddings
Embeddings#
Wrappers around embedding modules.
pydantic model langchain.embeddings.AlephAlphaAsymmetricSemanticEmbedding[source]#
Wrapper for Aleph Alphaβs Asymmetric Embeddings
AA provides you with an endpoint to embed a document and a query.
The models were optimized to make the embeddings of documents and
the query for a document as similar as possible.
To learn more, check out: https://docs.aleph-alpha.com/docs/tasks/semantic_embed/
Example
from aleph_alpha import AlephAlphaAsymmetricSemanticEmbedding
embeddings = AlephAlphaSymmetricSemanticEmbedding()
document = "This is a content of the document"
query = "What is the content of the document?"
doc_result = embeddings.embed_documents([document])
query_result = embeddings.embed_query(query)
field compress_to_size: Optional[int] = 128#
Should the returned embeddings come back as an original 5120-dim vector,
or should it be compressed to 128-dim.
field contextual_control_threshold: Optional[int] = None#
Attention control parameters only apply to those tokens that have
explicitly been set in the request.
field control_log_additive: Optional[bool] = True#
Apply controls on prompt items by adding the log(control_factor)
to attention scores.
field hosting: Optional[str] = 'https://api.aleph-alpha.com'#
Optional parameter that specifies which datacenters may process the request.
field model: Optional[str] = 'luminous-base'#
Model name to use.
field normalize: Optional[bool] = True#
Should returned embeddings be normalized
embed_documents(texts: List[str]) β List[List[float]][source]#
Call out to Aleph Alphaβs asymmetric Document endpoint.
Parameters
texts β The list of texts to embed.
Returns |
{
"url": "https://python.langchain.com/en/latest/reference/modules/embeddings.html"
} | f9d90154b39f-1 | Parameters
texts β The list of texts to embed.
Returns
List of embeddings, one for each text.
embed_query(text: str) β List[float][source]#
Call out to Aleph Alphaβs asymmetric, query embedding endpoint
:param text: The text to embed.
Returns
Embeddings for the text.
pydantic model langchain.embeddings.AlephAlphaSymmetricSemanticEmbedding[source]#
The symmetric version of the Aleph Alphaβs semantic embeddings.
The main difference is that here, both the documents and
queries are embedded with a SemanticRepresentation.Symmetric
.. rubric:: Example
embed_documents(texts: List[str]) β List[List[float]][source]#
Call out to Aleph Alphaβs Document endpoint.
Parameters
texts β The list of texts to embed.
Returns
List of embeddings, one for each text.
embed_query(text: str) β List[float][source]#
Call out to Aleph Alphaβs asymmetric, query embedding endpoint
:param text: The text to embed.
Returns
Embeddings for the text.
pydantic model langchain.embeddings.CohereEmbeddings[source]#
Wrapper around Cohere embedding models.
To use, you should have the cohere python package installed, and the
environment variable COHERE_API_KEY set with your API key or pass it
as a named parameter to the constructor.
Example
from langchain.embeddings import CohereEmbeddings
cohere = CohereEmbeddings(model="medium", cohere_api_key="my-api-key")
field model: str = 'large'#
Model name to use.
field truncate: Optional[str] = None#
Truncate embeddings that are too long from start or end (βNONEβ|βSTARTβ|βENDβ)
embed_documents(texts: List[str]) β List[List[float]][source]# |
{
"url": "https://python.langchain.com/en/latest/reference/modules/embeddings.html"
} | f9d90154b39f-2 | embed_documents(texts: List[str]) β List[List[float]][source]#
Call out to Cohereβs embedding endpoint.
Parameters
texts β The list of texts to embed.
Returns
List of embeddings, one for each text.
embed_query(text: str) β List[float][source]#
Call out to Cohereβs embedding endpoint.
Parameters
text β The text to embed.
Returns
Embeddings for the text.
pydantic model langchain.embeddings.FakeEmbeddings[source]#
embed_documents(texts: List[str]) β List[List[float]][source]#
Embed search docs.
embed_query(text: str) β List[float][source]#
Embed query text.
pydantic model langchain.embeddings.HuggingFaceEmbeddings[source]#
Wrapper around sentence_transformers embedding models.
To use, you should have the sentence_transformers python package installed.
Example
from langchain.embeddings import HuggingFaceEmbeddings
model_name = "sentence-transformers/all-mpnet-base-v2"
hf = HuggingFaceEmbeddings(model_name=model_name)
field model_name: str = 'sentence-transformers/all-mpnet-base-v2'#
Model name to use.
embed_documents(texts: List[str]) β List[List[float]][source]#
Compute doc embeddings using a HuggingFace transformer model.
Parameters
texts β The list of texts to embed.
Returns
List of embeddings, one for each text.
embed_query(text: str) β List[float][source]#
Compute query embeddings using a HuggingFace transformer model.
Parameters
text β The text to embed.
Returns
Embeddings for the text.
pydantic model langchain.embeddings.HuggingFaceHubEmbeddings[source]#
Wrapper around HuggingFaceHub embedding models. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/embeddings.html"
} | f9d90154b39f-3 | Wrapper around HuggingFaceHub embedding models.
To use, you should have the huggingface_hub python package installed, and the
environment variable HUGGINGFACEHUB_API_TOKEN set with your API token, or pass
it as a named parameter to the constructor.
Example
from langchain.embeddings import HuggingFaceHubEmbeddings
repo_id = "sentence-transformers/all-mpnet-base-v2"
hf = HuggingFaceHubEmbeddings(
repo_id=repo_id,
task="feature-extraction",
huggingfacehub_api_token="my-api-key",
)
field model_kwargs: Optional[dict] = None#
Key word arguments to pass to the model.
field repo_id: str = 'sentence-transformers/all-mpnet-base-v2'#
Model name to use.
field task: Optional[str] = 'feature-extraction'#
Task to call the model with.
embed_documents(texts: List[str]) β List[List[float]][source]#
Call out to HuggingFaceHubβs embedding endpoint for embedding search docs.
Parameters
texts β The list of texts to embed.
Returns
List of embeddings, one for each text.
embed_query(text: str) β List[float][source]#
Call out to HuggingFaceHubβs embedding endpoint for embedding query text.
Parameters
text β The text to embed.
Returns
Embeddings for the text.
pydantic model langchain.embeddings.HuggingFaceInstructEmbeddings[source]#
Wrapper around sentence_transformers embedding models.
To use, you should have the sentence_transformers
and InstructorEmbedding python package installed.
Example
from langchain.embeddings import HuggingFaceInstructEmbeddings
model_name = "hkunlp/instructor-large"
hf = HuggingFaceInstructEmbeddings(model_name=model_name) |
{
"url": "https://python.langchain.com/en/latest/reference/modules/embeddings.html"
} | f9d90154b39f-4 | hf = HuggingFaceInstructEmbeddings(model_name=model_name)
field embed_instruction: str = 'Represent the document for retrieval: '#
Instruction to use for embedding documents.
field model_name: str = 'hkunlp/instructor-large'#
Model name to use.
field query_instruction: str = 'Represent the question for retrieving supporting documents: '#
Instruction to use for embedding query.
embed_documents(texts: List[str]) β List[List[float]][source]#
Compute doc embeddings using a HuggingFace instruct model.
Parameters
texts β The list of texts to embed.
Returns
List of embeddings, one for each text.
embed_query(text: str) β List[float][source]#
Compute query embeddings using a HuggingFace instruct model.
Parameters
text β The text to embed.
Returns
Embeddings for the text.
pydantic model langchain.embeddings.LlamaCppEmbeddings[source]#
Wrapper around llama.cpp embedding models.
To use, you should have the llama-cpp-python library installed, and provide the
path to the Llama model as a named parameter to the constructor.
Check out: abetlen/llama-cpp-python
Example
from langchain.embeddings import LlamaCppEmbeddings
llama = LlamaCppEmbeddings(model_path="/path/to/model.bin")
field f16_kv: bool = False#
Use half-precision for key/value cache.
field logits_all: bool = False#
Return logits for all tokens, not just the last token.
field n_batch: Optional[int] = 8#
Number of tokens to process in parallel.
Should be a number between 1 and n_ctx.
field n_ctx: int = 512#
Token context window.
field n_parts: int = -1#
Number of parts to split the model into. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/embeddings.html"
} | f9d90154b39f-5 | field n_parts: int = -1#
Number of parts to split the model into.
If -1, the number of parts is automatically determined.
field n_threads: Optional[int] = None#
Number of threads to use. If None, the number
of threads is automatically determined.
field seed: int = -1#
Seed. If -1, a random seed is used.
field use_mlock: bool = False#
Force system to keep model in RAM.
field vocab_only: bool = False#
Only load the vocabulary, no weights.
embed_documents(texts: List[str]) β List[List[float]][source]#
Embed a list of documents using the Llama model.
Parameters
texts β The list of texts to embed.
Returns
List of embeddings, one for each text.
embed_query(text: str) β List[float][source]#
Embed a query using the Llama model.
Parameters
text β The text to embed.
Returns
Embeddings for the text.
pydantic model langchain.embeddings.OpenAIEmbeddings[source]#
Wrapper around OpenAI embedding models.
To use, you should have the openai python package installed, and the
environment variable OPENAI_API_KEY set with your API key or pass it
as a named parameter to the constructor.
Example
from langchain.embeddings import OpenAIEmbeddings
openai = OpenAIEmbeddings(openai_api_key="my-api-key")
In order to use the library with Microsoft Azure endpoints, you need to set
the OPENAI_API_TYPE, OPENAI_API_BASE, OPENAI_API_KEY and optionally and
API_VERSION.
The OPENAI_API_TYPE must be set to βazureβ and the others correspond to
the properties of your endpoint.
In addition, the deployment name must be passed as the model parameter.
Example
import os |
{
"url": "https://python.langchain.com/en/latest/reference/modules/embeddings.html"
} | f9d90154b39f-6 | In addition, the deployment name must be passed as the model parameter.
Example
import os
os.environ["OPENAI_API_TYPE"] = "azure"
os.environ["OPENAI_API_BASE"] = "https://<your-endpoint.openai.azure.com/"
os.environ["OPENAI_API_KEY"] = "your AzureOpenAI key"
from langchain.embeddings.openai import OpenAIEmbeddings
embeddings = OpenAIEmbeddings(model="your-embeddings-deployment-name")
text = "This is a test query."
query_result = embeddings.embed_query(text)
field chunk_size: int = 1000#
Maximum number of texts to embed in each batch
field max_retries: int = 6#
Maximum number of retries to make when generating.
embed_documents(texts: List[str], chunk_size: Optional[int] = 0) β List[List[float]][source]#
Call out to OpenAIβs embedding endpoint for embedding search docs.
Parameters
texts β The list of texts to embed.
chunk_size β The chunk size of embeddings. If None, will use the chunk size
specified by the class.
Returns
List of embeddings, one for each text.
embed_query(text: str) β List[float][source]#
Call out to OpenAIβs embedding endpoint for embedding query text.
Parameters
text β The text to embed.
Returns
Embeddings for the text.
pydantic model langchain.embeddings.SagemakerEndpointEmbeddings[source]#
Wrapper around custom Sagemaker Inference Endpoints.
To use, you must supply the endpoint name from your deployed
Sagemaker model & the region where it is deployed.
To authenticate, the AWS client uses the following methods to
automatically load credentials:
https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html |
{
"url": "https://python.langchain.com/en/latest/reference/modules/embeddings.html"
} | f9d90154b39f-7 | https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
If a specific credential profile should be used, you must pass
the name of the profile from the ~/.aws/credentials file that is to be used.
Make sure the credentials / roles used have the required policies to
access the Sagemaker endpoint.
See: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html
field content_handler: langchain.llms.sagemaker_endpoint.ContentHandlerBase [Required]#
The content handler class that provides an input and
output transform functions to handle formats between LLM
and the endpoint.
field credentials_profile_name: Optional[str] = None#
The name of the profile in the ~/.aws/credentials or ~/.aws/config files, which
has either access keys or role information specified.
If not specified, the default credential profile or, if on an EC2 instance,
credentials from IMDS will be used.
See: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
field endpoint_kwargs: Optional[Dict] = None#
Optional attributes passed to the invoke_endpoint
function. See `boto3`_. docs for more info.
.. _boto3: <https://boto3.amazonaws.com/v1/documentation/api/latest/index.html>
field endpoint_name: str = ''#
The name of the endpoint from the deployed Sagemaker model.
Must be unique within an AWS Region.
field model_kwargs: Optional[Dict] = None#
Key word arguments to pass to the model.
field region_name: str = ''#
The aws region where the Sagemaker model is deployed, eg. us-west-2.
embed_documents(texts: List[str], chunk_size: int = 64) β List[List[float]][source]#
Compute doc embeddings using a SageMaker Inference Endpoint. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/embeddings.html"
} | f9d90154b39f-8 | Compute doc embeddings using a SageMaker Inference Endpoint.
Parameters
texts β The list of texts to embed.
chunk_size β The chunk size defines how many input texts will
be grouped together as request. If None, will use the
chunk size specified by the class.
Returns
List of embeddings, one for each text.
embed_query(text: str) β List[float][source]#
Compute query embeddings using a SageMaker inference endpoint.
Parameters
text β The text to embed.
Returns
Embeddings for the text.
pydantic model langchain.embeddings.SelfHostedEmbeddings[source]#
Runs custom embedding models on self-hosted remote hardware.
Supported hardware includes auto-launched instances on AWS, GCP, Azure,
and Lambda, as well as servers specified
by IP address and SSH credentials (such as on-prem, or another
cloud like Paperspace, Coreweave, etc.).
To use, you should have the runhouse python package installed.
Example using a model load function:from langchain.embeddings import SelfHostedEmbeddings
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
import runhouse as rh
gpu = rh.cluster(name="rh-a10x", instance_type="A100:1")
def get_pipeline():
model_id = "facebook/bart-large"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
return pipeline("feature-extraction", model=model, tokenizer=tokenizer)
embeddings = SelfHostedEmbeddings(
model_load_fn=get_pipeline,
hardware=gpu
model_reqs=["./", "torch", "transformers"],
)
Example passing in a pipeline path:from langchain.embeddings import SelfHostedHFEmbeddings
import runhouse as rh |
{
"url": "https://python.langchain.com/en/latest/reference/modules/embeddings.html"
} | f9d90154b39f-9 | import runhouse as rh
from transformers import pipeline
gpu = rh.cluster(name="rh-a10x", instance_type="A100:1")
pipeline = pipeline(model="bert-base-uncased", task="feature-extraction")
rh.blob(pickle.dumps(pipeline),
path="models/pipeline.pkl").save().to(gpu, path="models")
embeddings = SelfHostedHFEmbeddings.from_pipeline(
pipeline="models/pipeline.pkl",
hardware=gpu,
model_reqs=["./", "torch", "transformers"],
)
Validators
set_callback_manager Β» callback_manager
set_verbose Β» verbose
field inference_fn: Callable = <function _embed_documents>#
Inference function to extract the embeddings on the remote hardware.
field inference_kwargs: Any = None#
Any kwargs to pass to the modelβs inference function.
embed_documents(texts: List[str]) β List[List[float]][source]#
Compute doc embeddings using a HuggingFace transformer model.
Parameters
texts β The list of texts to embed.s
Returns
List of embeddings, one for each text.
embed_query(text: str) β List[float][source]#
Compute query embeddings using a HuggingFace transformer model.
Parameters
text β The text to embed.
Returns
Embeddings for the text.
pydantic model langchain.embeddings.SelfHostedHuggingFaceEmbeddings[source]#
Runs sentence_transformers embedding models on self-hosted remote hardware.
Supported hardware includes auto-launched instances on AWS, GCP, Azure,
and Lambda, as well as servers specified
by IP address and SSH credentials (such as on-prem, or another cloud
like Paperspace, Coreweave, etc.).
To use, you should have the runhouse python package installed.
Example
from langchain.embeddings import SelfHostedHuggingFaceEmbeddings |
{
"url": "https://python.langchain.com/en/latest/reference/modules/embeddings.html"
} | f9d90154b39f-10 | Example
from langchain.embeddings import SelfHostedHuggingFaceEmbeddings
import runhouse as rh
model_name = "sentence-transformers/all-mpnet-base-v2"
gpu = rh.cluster(name="rh-a10x", instance_type="A100:1")
hf = SelfHostedHuggingFaceEmbeddings(model_name=model_name, hardware=gpu)
Validators
set_callback_manager Β» callback_manager
set_verbose Β» verbose
field hardware: Any = None#
Remote hardware to send the inference function to.
field inference_fn: Callable = <function _embed_documents>#
Inference function to extract the embeddings.
field load_fn_kwargs: Optional[dict] = None#
Key word arguments to pass to the model load function.
field model_id: str = 'sentence-transformers/all-mpnet-base-v2'#
Model name to use.
field model_load_fn: Callable = <function load_embedding_model>#
Function to load the model remotely on the server.
field model_reqs: List[str] = ['./', 'sentence_transformers', 'torch']#
Requirements to install on hardware to inference the model.
pydantic model langchain.embeddings.SelfHostedHuggingFaceInstructEmbeddings[source]#
Runs InstructorEmbedding embedding models on self-hosted remote hardware.
Supported hardware includes auto-launched instances on AWS, GCP, Azure,
and Lambda, as well as servers specified
by IP address and SSH credentials (such as on-prem, or another
cloud like Paperspace, Coreweave, etc.).
To use, you should have the runhouse python package installed.
Example
from langchain.embeddings import SelfHostedHuggingFaceInstructEmbeddings
import runhouse as rh
model_name = "hkunlp/instructor-large"
gpu = rh.cluster(name='rh-a10x', instance_type='A100:1') |
{
"url": "https://python.langchain.com/en/latest/reference/modules/embeddings.html"
} | f9d90154b39f-11 | gpu = rh.cluster(name='rh-a10x', instance_type='A100:1')
hf = SelfHostedHuggingFaceInstructEmbeddings(
model_name=model_name, hardware=gpu)
Validators
set_callback_manager Β» callback_manager
set_verbose Β» verbose
field embed_instruction: str = 'Represent the document for retrieval: '#
Instruction to use for embedding documents.
field model_id: str = 'hkunlp/instructor-large'#
Model name to use.
field model_reqs: List[str] = ['./', 'InstructorEmbedding', 'torch']#
Requirements to install on hardware to inference the model.
field query_instruction: str = 'Represent the question for retrieving supporting documents: '#
Instruction to use for embedding query.
embed_documents(texts: List[str]) β List[List[float]][source]#
Compute doc embeddings using a HuggingFace instruct model.
Parameters
texts β The list of texts to embed.
Returns
List of embeddings, one for each text.
embed_query(text: str) β List[float][source]#
Compute query embeddings using a HuggingFace instruct model.
Parameters
text β The text to embed.
Returns
Embeddings for the text.
pydantic model langchain.embeddings.TensorflowHubEmbeddings[source]#
Wrapper around tensorflow_hub embedding models.
To use, you should have the tensorflow_text python package installed.
Example
from langchain.embeddings import TensorflowHubEmbeddings
url = "https://tfhub.dev/google/universal-sentence-encoder-multilingual/3"
tf = TensorflowHubEmbeddings(model_url=url)
field model_url: str = 'https://tfhub.dev/google/universal-sentence-encoder-multilingual/3'#
Model name to use.
embed_documents(texts: List[str]) β List[List[float]][source]# |
{
"url": "https://python.langchain.com/en/latest/reference/modules/embeddings.html"
} | f9d90154b39f-12 | embed_documents(texts: List[str]) β List[List[float]][source]#
Compute doc embeddings using a TensorflowHub embedding model.
Parameters
texts β The list of texts to embed.
Returns
List of embeddings, one for each text.
embed_query(text: str) β List[float][source]#
Compute query embeddings using a TensorflowHub embedding model.
Parameters
text β The text to embed.
Returns
Embeddings for the text.
previous
Text Splitter
next
VectorStores
By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/text_splitter.html"
} | c7562d5f5ebd-0 | .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 langchain.text_splitter.LatexTextSplitter(**kwargs: Any)[source]#
Attempts to split the text along Latex-formatted layout elements.
class langchain.text_splitter.MarkdownTextSplitter(**kwargs: Any)[source]#
Attempts to split the text along Markdown-formatted headings.
class langchain.text_splitter.NLTKTextSplitter(separator: str = '\n\n', **kwargs: Any)[source]#
Implementation of splitting text that looks at sentences using NLTK.
split_text(text: str) β List[str][source]#
Split incoming text and return chunks.
class langchain.text_splitter.PythonCodeTextSplitter(**kwargs: Any)[source]#
Attempts to split the text along Python syntax.
class langchain.text_splitter.RecursiveCharacterTextSplitter(separators: Optional[List[str]] = None, **kwargs: Any)[source]#
Implementation of splitting text that looks at characters.
Recursively tries to split by different characters to find one
that works.
split_text(text: str) β List[str][source]#
Split incoming text and return chunks.
class langchain.text_splitter.SpacyTextSplitter(separator: str = '\n\n', pipeline: str = 'en_core_web_sm', **kwargs: Any)[source]#
Implementation of splitting text that looks at sentences using Spacy.
split_text(text: str) β List[str][source]#
Split incoming text and return chunks. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/text_splitter.html"
} | c7562d5f5ebd-1 | Split incoming text and return chunks.
class langchain.text_splitter.TextSplitter(chunk_size: int = 4000, chunk_overlap: int = 200, length_function: typing.Callable[[str], int] = <built-in function len>)[source]#
Interface for splitting text into chunks.
create_documents(texts: List[str], metadatas: Optional[List[dict]] = None) β List[langchain.schema.Document][source]#
Create documents from a list of texts.
classmethod from_huggingface_tokenizer(tokenizer: Any, **kwargs: Any) β langchain.text_splitter.TextSplitter[source]#
Text splitter that uses HuggingFace tokenizer to count length.
classmethod from_tiktoken_encoder(encoding_name: str = 'gpt2', allowed_special: Union[Literal['all'], AbstractSet[str]] = {}, disallowed_special: Union[Literal['all'], Collection[str]] = 'all', **kwargs: Any) β langchain.text_splitter.TextSplitter[source]#
Text splitter that uses tiktoken encoder to count length.
split_documents(documents: List[langchain.schema.Document]) β List[langchain.schema.Document][source]#
Split documents.
abstract split_text(text: str) β List[str][source]#
Split text into multiple components.
class langchain.text_splitter.TokenTextSplitter(encoding_name: str = 'gpt2', allowed_special: Union[Literal['all'], AbstractSet[str]] = {}, disallowed_special: Union[Literal['all'], Collection[str]] = 'all', **kwargs: Any)[source]#
Implementation of splitting text that looks at tokens.
split_text(text: str) β List[str][source]#
Split incoming text and return chunks.
previous
Docstore
next
Embeddings
By Harrison Chase
Β© Copyright 2023, Harrison Chase. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/text_splitter.html"
} | c7562d5f5ebd-2 | By Harrison Chase
Β© Copyright 2023, Harrison Chase.
Last updated on Apr 08, 2023. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/vectorstore.html"
} | 423a5ff855c1-0 | .rst
.pdf
VectorStores
VectorStores#
Wrappers on top of vector stores.
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 database and rhizomatic instrument.
To use, you should have the nomic python package installed.
Example
from langchain.vectorstores import AtlasDB
from langchain.embeddings.openai import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
vectorstore = AtlasDB("my_project", embeddings.embed_query)
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, refresh: bool = True, **kwargs: Any) β List[str][source]#
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts (Iterable[str]) β Texts to add to the vectorstore.
metadatas (Optional[List[dict]], optional) β Optional list of metadatas.
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#nomic.project.AtlasProject.create_index
for full detail. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/vectorstore.html"
} | 423a5ff855c1-1 | for full detail.
classmethod from_documents(documents: List[langchain.schema.Document], embedding: Optional[langchain.embeddings.base.Embeddings] = None, ids: Optional[List[str]] = None, name: Optional[str] = None, api_key: Optional[str] = None, persist_directory: Optional[str] = None, description: str = 'A description for your project', is_public: bool = True, reset_project_if_exists: bool = False, index_kwargs: Optional[dict] = None, **kwargs: Any) β langchain.vectorstores.atlas.AtlasDB[source]#
Create an AtlasDB vectorstore from a list of documents.
Parameters
name (str) β Name of the collection to create.
api_key (str) β Your nomic API key,
documents (List[Document]) β List of documents to add to the vectorstore.
embedding (Optional[Embeddings]) β Embedding function. Defaults to None.
ids (Optional[List[str]]) β Optional list of document IDs. If None,
ids will be auto created
description (str) β A description for your project.
is_public (bool) β Whether your project is publicly accessible.
True by default.
reset_project_if_exists (bool) β Whether to reset this project if
it already exists. Default False.
Generally userful during development and testing.
index_kwargs (Optional[dict]) β Dict of kwargs for index creation.
See https://docs.nomic.ai/atlas_api.html
Returns
Nomicβs neural database and finest rhizomatic instrument
Return type
AtlasDB |
{
"url": "https://python.langchain.com/en/latest/reference/modules/vectorstore.html"
} | 423a5ff855c1-2 | Returns
Nomicβs neural database and finest rhizomatic instrument
Return type
AtlasDB
classmethod from_texts(texts: List[str], embedding: Optional[langchain.embeddings.base.Embeddings] = None, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, name: Optional[str] = None, api_key: Optional[str] = None, description: str = 'A description for your project', is_public: bool = True, reset_project_if_exists: bool = False, index_kwargs: Optional[dict] = None, **kwargs: Any) β langchain.vectorstores.atlas.AtlasDB[source]#
Create an AtlasDB vectorstore from a raw documents.
Parameters
texts (List[str]) β The list of texts to ingest.
name (str) β Name of the project to create.
api_key (str) β Your nomic API key,
embedding (Optional[Embeddings]) β Embedding function. Defaults to None.
metadatas (Optional[List[dict]]) β List of metadatas. Defaults to None.
ids (Optional[List[str]]) β Optional list of document IDs. If None,
ids will be auto created
description (str) β A description for your project.
is_public (bool) β Whether your project is publicly accessible.
True by default.
reset_project_if_exists (bool) β Whether to reset this project if it
already exists. Default False.
Generally userful during development and testing.
index_kwargs (Optional[dict]) β Dict of kwargs for index creation.
See https://docs.nomic.ai/atlas_api.html
Returns
Nomicβs neural database and finest rhizomatic instrument
Return type
AtlasDB
similarity_search(query: str, k: int = 4, **kwargs: Any) β List[langchain.schema.Document][source]# |
{
"url": "https://python.langchain.com/en/latest/reference/modules/vectorstore.html"
} | 423a5ff855c1-3 | Run similarity search with AtlasDB
Parameters
query (str) β Query text to search for.
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: Optional[chromadb.config.Settings] = None)[source]#
Wrapper around ChromaDB embeddings platform.
To use, you should have the chromadb python package installed.
Example
from langchain.vectorstores import Chroma
from langchain.embeddings.openai import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
vectorstore = Chroma("langchain_store", embeddings.embed_query)
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) β List[str][source]#
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts (Iterable[str]) β Texts to add to the vectorstore.
metadatas (Optional[List[dict]], optional) β Optional list of metadatas.
ids (Optional[List[str]], optional) β Optional list of IDs.
Returns
List of IDs of the added texts.
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.config.Settings] = None, **kwargs: Any) β Chroma[source]# |
{
"url": "https://python.langchain.com/en/latest/reference/modules/vectorstore.html"
} | 423a5ff855c1-4 | Create a Chroma vectorstore from a list of documents.
If a persist_directory is specified, the collection will be persisted there.
Otherwise, the data will be ephemeral in-memory.
Parameters
collection_name (str) β Name of the collection to create.
persist_directory (Optional[str]) β Directory to persist the collection.
ids (Optional[List[str]]) β List of document IDs. Defaults to None.
documents (List[Document]) β List of documents to add to the vectorstore.
embedding (Optional[Embeddings]) β Embedding function. Defaults to None.
client_settings (Optional[chromadb.config.Settings]) β Chroma client settings
Returns
Chroma vectorstore.
Return type
Chroma
classmethod from_texts(texts: List[str], embedding: Optional[Embeddings] = None, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, collection_name: str = 'langchain', persist_directory: Optional[str] = None, client_settings: Optional[chromadb.config.Settings] = None, **kwargs: Any) β Chroma[source]#
Create a Chroma vectorstore from a raw documents.
If a persist_directory is specified, the collection will be persisted there.
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 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.config.Settings]) β Chroma client settings
Returns
Chroma vectorstore. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/vectorstore.html"
} | 423a5ff855c1-5 | Returns
Chroma vectorstore.
Return type
Chroma
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, filter: Optional[Dict[str, str]] = None) β List[langchain.schema.Document][source]#
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
:param query: Text to look up documents similar to.
:param k: Number of Documents to return. Defaults to 4.
:param fetch_k: Number of Documents to fetch to pass to MMR algorithm.
:param filter: Filter by metadata. Defaults to None.
:type filter: Optional[Dict[str, str]]
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, filter: Optional[Dict[str, str]] = None) β List[langchain.schema.Document][source]#
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 fetch to pass to MMR algorithm.
:param filter: Filter by metadata. Defaults to None.
:type filter: Optional[Dict[str, str]]
Returns
List of Documents selected by maximal marginal relevance.
persist() β None[source]#
Persist the collection.
This can be used to explicitly persist the data to disk.
It will also be called automatically when the object is destroyed. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/vectorstore.html"
} | 423a5ff855c1-6 | It will also be called automatically when the object is destroyed.
similarity_search(query: str, k: int = 4, filter: Optional[Dict[str, str]] = None, **kwargs: Any) β List[langchain.schema.Document][source]#
Run similarity search with Chroma.
Parameters
query (str) β Query text to search for.
k (int) β Number of results to return. Defaults to 4.
filter (Optional[Dict[str, str]]) β Filter by metadata. Defaults to None.
Returns
List of documents most similar to the query text.
Return type
List[Document]
similarity_search_by_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.
:param 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, k: int = 4, filter: Optional[Dict[str, str]] = None, **kwargs: Any) β List[Tuple[langchain.schema.Document, float]][source]#
Run similarity search with Chroma with distance.
Parameters
query (str) β Query text to search for.
k (int) β Number of results to return. Defaults to 4.
filter (Optional[Dict[str, str]]) β Filter by metadata. Defaults to None.
Returns
List of documents most similar to the querytext with distance in float.
Return type
List[Tuple[Document, float]] |
{
"url": "https://python.langchain.com/en/latest/reference/modules/vectorstore.html"
} | 423a5ff855c1-7 | Return type
List[Tuple[Document, float]]
class langchain.vectorstores.DeepLake(dataset_path: str = 'mem://langchain', token: Optional[str] = None, embedding_function: Optional[langchain.embeddings.base.Embeddings] = None, read_only: Optional[bool] = None)[source]#
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 version control.
Serverless, doesnβt require another service and can be used with majorcloud providers (S3, GCS, etc.)
More than just a multi-modal vector store. You can use the datasetto fine-tune your own LLM models.
To use, you should have the deeplake python package installed.
Example
from langchain.vectorstores import DeepLake
from langchain.embeddings.openai import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
vectorstore = DeepLake("langchain_store", embeddings.embed_query)
add_texts(texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any) β List[str][source]#
Run more texts through the embeddings and add to the vectorstore.
Parameters
texts (Iterable[str]) β Texts to add to the vectorstore.
metadatas (Optional[List[dict]], optional) β Optional list of metadatas.
ids (Optional[List[str]], optional) β Optional list of IDs.
Returns
List of IDs of the added texts.
Return type
List[str] |
{
"url": "https://python.langchain.com/en/latest/reference/modules/vectorstore.html"
} | 423a5ff855c1-8 | 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 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.
classmethod from_texts(texts: List[str], embedding: Optional[langchain.embeddings.base.Embeddings] = None, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, dataset_path: str = 'mem://langchain', **kwargs: Any) β langchain.vectorstores.deeplake.DeepLake[source]#
Create a Deep Lake dataset from a raw documents.
If a dataset_path is specified, the dataset will be persisted there.
Otherwise, the data will be ephemeral in-memory.
Parameters
path (str, pathlib.Path) β
The full path to the dataset. Can be:
Deep Lake cloud path of the form hub://username/dataset_name.To write to Deep Lake cloud datasets,
ensure that you are logged in to Deep Lake
(use βactiveloop loginβ from command line)
AWS S3 path of the form s3://bucketname/path/to/dataset.Credentials are required in either the environment
Google Cloud Storage path of the form``gcs://bucketname/path/to/dataset``Credentials are required
in either the environment |
{
"url": "https://python.langchain.com/en/latest/reference/modules/vectorstore.html"
} | 423a5ff855c1-9 | 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 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 None.
Returns
Deep Lake dataset.
Return type
DeepLake
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20) β List[langchain.schema.Document][source]#
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
:param query: Text to look up documents similar to.
:param k: Number of Documents to return. Defaults to 4.
:param fetch_k: Number of Documents to fetch to pass to MMR algorithm.
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) β List[langchain.schema.Document][source]#
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 fetch to pass to MMR algorithm.
Returns
List of Documents selected by maximal marginal relevance. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/vectorstore.html"
} | 423a5ff855c1-10 | Returns
List of Documents selected by maximal marginal relevance.
persist() β None[source]#
Persist the collection.
search(query: Any[str, None] = None, embedding: Any[float, None] = None, k: int = 4, distance_metric: str = 'L2', use_maximal_marginal_relevance: Optional[bool] = False, fetch_k: Optional[int] = 20, filter: Optional[Dict[str, str]] = None, return_score: Optional[bool] = False, **kwargs: Any) β Any[List[Document], List[Tuple[Document, float]]][source]#
Return docs most similar to query.
Parameters
query β Text to look up documents similar to.
embedding β Embedding function to use. Defaults to None.
k β Number of Documents to return. Defaults to 4.
distance_metric β L2 for Euclidean, L1 for Nuclear,
max L-infinity distance, cos for cosine similarity,
βdotβ for dot product. Defaults to L2.
filter β Attribute filter by metadata example {βkeyβ: βvalueβ}.
Defaults to None.
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 True, return a tuple of (Document, score)
similarity_search(query: str, k: int = 4, **kwargs: Any) β List[langchain.schema.Document][source]#
Return docs most similar to query.
Parameters
query β text to embed and run the query on.
k β Number of Documents to return.
Defaults to 4. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/vectorstore.html"
} | 423a5ff855c1-11 | k β Number of Documents to return.
Defaults to 4.
query β Text to look up documents similar to.
embedding β Embedding function to use.
Defaults to None.
k β Number of Documents to return.
Defaults to 4.
distance_metric β L2 for Euclidean, L1 for Nuclear, max
L-infinity distance, cos for cosine similarity, βdotβ for dot product
Defaults to L2.
filter β Attribute filter by metadata example {βkeyβ: βvalueβ}.
Defaults to None.
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 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 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 Deep Lake with distance returned.
Parameters
query (str) β Query text to search for.
distance_metric β L2 for Euclidean, L1 for Nuclear, max L-infinity
distance, cos for cosine similarity, βdotβ for dot product.
Defaults to L2. |
{
"url": "https://python.langchain.com/en/latest/reference/modules/vectorstore.html"
} | 423a5ff855c1-12 | distance, cos for cosine similarity, βdotβ for dot product.
Defaults to L2.
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 querytext with distance in float.
Return type
List[Tuple[Document, float]]
class langchain.vectorstores.ElasticVectorSearch(elasticsearch_url: str, index_name: str, embedding: langchain.embeddings.base.Embeddings)[source]#
Wrapper around Elasticsearch as a vector database.
To connect to an Elasticsearch instance that does not require
login credentials, pass the Elasticsearch URL and index name along with the
embedding object to the constructor.
Example
from langchain import ElasticVectorSearch
from langchain.embeddings import OpenAIEmbeddings
embedding = OpenAIEmbeddings()
elastic_vector_search = ElasticVectorSearch(
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 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 deployment, and
navigating to the βDeploymentsβ page.
To obtain your Elastic Cloud password for the default βelasticβ user:
Log in to the Elastic Cloud console at https://cloud.elastic.co
Go to βSecurityβ > βUsersβ
Locate the βelasticβ user and click βEditβ |
End of preview. Expand
in Dataset Viewer.
No dataset card yet
New: Create and edit this dataset card directly on the website!
Contribute a Dataset Card- Downloads last month
- 3