id stringlengths 14 16 | text stringlengths 45 2.73k | source stringlengths 49 114 |
|---|---|---|
f9aab5578669-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... | https://python.langchain.com/en/latest/gallery.html |
f9aab5578669-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 Mat... | https://python.langchain.com/en/latest/gallery.html |
f9aab5578669-2 | Daimon
A chat-based AI personal assistant with long-term memory about you.
Summarize any file with AI
Summarize not only long docs, interview audio or video files quickly, but also entire websites and YouTube videos. Share or download your generated summaries to collaborate with others, or revisit them at any time! Bon... | https://python.langchain.com/en/latest/gallery.html |
9c3a329fce81-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 whe... | https://python.langchain.com/en/latest/glossary.html |
9c3a329fce81-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 Consiste... | https://python.langchain.com/en/latest/glossary.html |
c49294875bdb-0 | Search
Error
Please activate JavaScript to enable the search functionality.
Ctrl+K
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 21, 2023. | https://python.langchain.com/en/latest/search.html |
fdd8bca3df51-0 | .md
.pdf
YouTube
Contents
Introduction to LangChain with Harrison Chase, creator of LangChain
Tutorials
Videos (sorted by views)
YouTube#
This is a collection of LangChain tutorials and videos on YouTube.
Introduction to LangChain with Harrison Chase, creator of LangChain#
Building the Future with LLMs, LangChain, & ... | https://python.langchain.com/en/latest/youtube.html |
fdd8bca3df51-1 | Working With The New ChatGPT API
OpenAI + LangChain Wrote Me 100 Custom Sales Emails
Structured Output From OpenAI (Clean Dirty Data)
Connect OpenAI To +5,000 Tools (LangChain + Zapier)
Use LLMs To Extract Data From Text (Expert Mode)
LangChain How to and guides by Sam Witteveen:
LangChain Basics - LLMs & PromptTemplat... | https://python.langchain.com/en/latest/youtube.html |
fdd8bca3df51-2 | GPT-4 & LangChain Tutorial: How to Chat With A 56-Page PDF Document (w/Pinecone)
Videos (sorted by views)#
Building AI LLM Apps with LangChain (and more?) - LIVE STREAM by Nicholas Renotte
First look - ChatGPT + WolframAlpha (GPT-3.5 and Wolfram|Alpha via LangChain by James Weaver) by Dr Alan D. Thompson
LangChain expl... | https://python.langchain.com/en/latest/youtube.html |
fdd8bca3df51-3 | Analyze Custom CSV Data with GPT-4 using Langchain by Venelin Valkov
Langchain Overview - How to Use Langchain & ChatGPT by Python In Office
Custom langchain Agent & Tools with memory. Turn any Python function into langchain tool with Gpt 3 by echohive
ChatGPT with any YouTube video using langchain and chromadb by echo... | https://python.langchain.com/en/latest/youtube.html |
e88177a46e16-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... | https://python.langchain.com/en/latest/model_laboratory.html |
e88177a46e16-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'... | https://python.langchain.com/en/latest/model_laboratory.html |
e88177a46e16-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_tok... | https://python.langchain.com/en/latest/model_laboratory.html |
e88177a46e16-3 | So the final answer is:
Carlos Alcaraz
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 21, 2023. | https://python.langchain.com/en/latest/model_laboratory.html |
01759e4659c5-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
LLMs
Utilities
Chains
Agents
previous
Integrations
next
Utilities
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last upd... | https://python.langchain.com/en/latest/reference.html |
b9563f5ad006-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.llm... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-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.InMemory... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-2 | (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)
(langcha... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-3 | (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)
(l... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-4 | amax_marginal_relevance_search() (langchain.vectorstores.VectorStore method)
amax_marginal_relevance_search_by_vector() (langchain.vectorstores.VectorStore method)
Annoy (class in langchain.vectorstores)
answers (langchain.utilities.searx_search.SearxResults property)
api_answer_chain (langchain.chains.APIChain attribu... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-5 | asimilarity_search() (langchain.vectorstores.VectorStore method)
asimilarity_search_by_vector() (langchain.vectorstores.VectorStore method)
AtlasDB (class in langchain.vectorstores)
atransform_documents() (langchain.text_splitter.TextSplitter method)
B
bad_words (langchain.llms.NLPCloud attribute)
base_embeddings (lang... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-6 | 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... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-7 | (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 m... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-8 | (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)
(lang... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-9 | (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)... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-10 | (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)
(l... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-11 | (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.AlephAlphaSymmetricSemanticEmbed... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-12 | (langchain.embeddings.OpenAIEmbeddings method)
(langchain.embeddings.SagemakerEndpointEmbeddings method)
(langchain.embeddings.SelfHostedEmbeddings method)
(langchain.embeddings.SelfHostedHuggingFaceInstructEmbeddings method)
(langchain.embeddings.TensorflowHubEmbeddings method)
embedding (langchain.llms.GPT4All attrib... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-13 | 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)
format() (langchain.prompts.BaseChatPromptTemplate method... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-14 | (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.vectorsto... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-15 | from_template() (langchain.prompts.PromptTemplate class method)
from_texts() (langchain.vectorstores.Annoy class method)
(langchain.vectorstores.AtlasDB class method)
(langchain.vectorstores.Chroma class method)
(langchain.vectorstores.DeepLake class method)
(langchain.vectorstores.ElasticVectorSearch class method)
(la... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-16 | (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)
(lang... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-17 | (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_t... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-18 | (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_t... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-19 | (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)
g... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-20 | (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.FewShotPromptW... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-21 | (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 a... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-22 | (langchain.chains.LLMSummarizationCheckerChain attribute)
(langchain.chains.PALChain attribute)
(langchain.chains.SQLDatabaseChain attribute)
llm_chain (langchain.agents.Agent attribute)
(langchain.agents.LLMSingleActionAgent attribute)
(langchain.chains.HypotheticalDocumentEmbedder attribute)
(langchain.chains.LLMRequ... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-23 | (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)
(lan... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-24 | (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... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-25 | (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... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-26 | 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.Hugg... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-27 | (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.LlamaC... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-28 | (langchain.chains.QAGenerationChain property)
output_parser (langchain.agents.Agent attribute)
(langchain.agents.ConversationalAgent attribute)
(langchain.agents.ConversationalChatAgent attribute)
(langchain.agents.LLMSingleActionAgent attribute)
(langchain.agents.ReActTextWorldAgent attribute)
(langchain.agents.ZeroSh... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-29 | 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... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-30 | 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_tok... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-31 | 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.a... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-32 | (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... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-33 | 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.uti... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-34 | (langchain.vectorstores.Chroma method)
(langchain.vectorstores.DeepLake method)
(langchain.vectorstores.FAISS method)
(langchain.vectorstores.SupabaseVectorStore method)
(langchain.vectorstores.VectorStore method)
(langchain.vectorstores.Weaviate method)
similarity_search_by_vector_returning_embeddings() (langchain.vec... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-35 | stop (langchain.agents.LLMSingleActionAgent attribute)
(langchain.chains.PALChain attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
(langchain.llms.Writer attribute)
stop_sequences (langchain.llms.AlephAlpha attribute)
strategy (langchain.llms.RWKV attribute)
stream() (langchain.llms.Ant... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-36 | (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)
template_format (lan... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-37 | (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)... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-38 | (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... | https://python.langchain.com/en/latest/genindex.html |
b9563f5ad006-39 | (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 ... | https://python.langchain.com/en/latest/genindex.html |
546a3f48f042-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 ... | https://python.langchain.com/en/latest/index.html |
546a3f48f042-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... | https://python.langchain.com/en/latest/index.html |
546a3f48f042-2 | 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 d... | https://python.langchain.com/en/latest/index.html |
546a3f48f042-3 | By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 21, 2023. | https://python.langchain.com/en/latest/index.html |
32944cbf20c7-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... | https://python.langchain.com/en/latest/tracing.html |
32944cbf20c7-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 actual... | https://python.langchain.com/en/latest/tracing.html |
744b12cd7ecc-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
Cohere
Comet
Databerry
DeepInfra
Deep Lake
ForefrontAI
Google Search Wrapper
Google Serper Wrapper
GooseAI
GPT4All
Graphsignal
H... | https://python.langchain.com/en/latest/ecosystem.html |
73454b1e50a0-0 | .md
.pdf
Deployments
Contents
Streamlit
Gradio (on Hugging Face)
Beam
Vercel
Digitalocean App Platform
SteamShip
Langchain-serve
BentoML
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 ... | https://python.langchain.com/en/latest/deployments.html |
73454b1e50a0-1 | A minimal example on how to deploy LangChain to DigitalOcean App Platform.
SteamShip#
This repository contains LangChain adapters for Steamship, enabling LangChain developers to rapidly deploy their apps on Steamship.
This includes: production ready endpoints, horizontal scaling across dependencies, persistant storage ... | https://python.langchain.com/en/latest/deployments.html |
8ff2f9c59045-0 | Source code for langchain.text_splitter
"""Functionality for splitting text."""
from __future__ import annotations
import copy
import logging
from abc import ABC, abstractmethod
from typing import (
AbstractSet,
Any,
Callable,
Collection,
Iterable,
List,
Literal,
Optional,
Sequence,
... | https://python.langchain.com/en/latest/_modules/langchain/text_splitter.html |
8ff2f9c59045-1 | for chunk in self.split_text(text):
new_doc = Document(
page_content=chunk, metadata=copy.deepcopy(_metadatas[i])
)
documents.append(new_doc)
return documents
[docs] def split_documents(self, documents: List[Document]) -> List[Document]:
... | https://python.langchain.com/en/latest/_modules/langchain/text_splitter.html |
8ff2f9c59045-2 | docs.append(doc)
# Keep on popping if:
# - we have a larger chunk than in the chunk overlap
# - or if we still have any chunks and the length is long
while total > self._chunk_overlap or (
total + _len + (separator_l... | https://python.langchain.com/en/latest/_modules/langchain/text_splitter.html |
8ff2f9c59045-3 | [docs] @classmethod
def from_tiktoken_encoder(
cls,
encoding_name: str = "gpt2",
model_name: Optional[str] = None,
allowed_special: Union[Literal["all"], AbstractSet[str]] = set(),
disallowed_special: Union[Literal["all"], Collection[str]] = "all",
**kwargs: Any,
... | https://python.langchain.com/en/latest/_modules/langchain/text_splitter.html |
8ff2f9c59045-4 | """Asynchronously transform a sequence of documents by splitting them."""
raise NotImplementedError
[docs]class CharacterTextSplitter(TextSplitter):
"""Implementation of splitting text that looks at characters."""
def __init__(self, separator: str = "\n\n", **kwargs: Any):
"""Create a new TextSp... | https://python.langchain.com/en/latest/_modules/langchain/text_splitter.html |
8ff2f9c59045-5 | enc = tiktoken.encoding_for_model(model_name)
else:
enc = tiktoken.get_encoding(encoding_name)
self._tokenizer = enc
self._allowed_special = allowed_special
self._disallowed_special = disallowed_special
[docs] def split_text(self, text: str) -> List[str]:
"""Split ... | https://python.langchain.com/en/latest/_modules/langchain/text_splitter.html |
8ff2f9c59045-6 | # Get appropriate separator to use
separator = self._separators[-1]
for _s in self._separators:
if _s == "":
separator = _s
break
if _s in text:
separator = _s
break
# Now that we have the separator, split th... | https://python.langchain.com/en/latest/_modules/langchain/text_splitter.html |
8ff2f9c59045-7 | [docs] def split_text(self, text: str) -> List[str]:
"""Split incoming text and return chunks."""
# First we naively split the large input into a bunch of smaller ones.
splits = self._tokenizer(text)
return self._merge_splits(splits, self._separator)
[docs]class SpacyTextSplitter(Text... | https://python.langchain.com/en/latest/_modules/langchain/text_splitter.html |
8ff2f9c59045-8 | # Note the alternative syntax for headings (below) is not handled here
# Heading level 2
# ---------------
# End of code block
"```\n\n",
# Horizontal lines
"\n\n***\n\n",
"\n\n---\n\n",
"\n\n___\n\n",
# Note tha... | https://python.langchain.com/en/latest/_modules/langchain/text_splitter.html |
8ff2f9c59045-9 | # Now split by the normal type of lines
" ",
"",
]
super().__init__(separators=separators, **kwargs)
[docs]class PythonCodeTextSplitter(RecursiveCharacterTextSplitter):
"""Attempts to split the text along Python syntax."""
def __init__(self, **kwargs: Any):
"""Ini... | https://python.langchain.com/en/latest/_modules/langchain/text_splitter.html |
ae82dcd18e64-0 | Source code for langchain.vectorstores.annoy
"""Wrapper around Annoy vector database."""
from __future__ import annotations
import os
import pickle
import uuid
from configparser import ConfigParser
from pathlib import Path
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple
import numpy as np
from l... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/annoy.html |
ae82dcd18e64-1 | ):
"""Initialize with necessary components."""
self.embedding_function = embedding_function
self.index = index
self.metric = metric
self.docstore = docstore
self.index_to_docstore_id = index_to_docstore_id
[docs] def add_texts(
self,
texts: Iterable[str... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/annoy.html |
ae82dcd18e64-2 | Args:
query: Text to look up documents similar to.
k: Number of Documents to return. Defaults to 4.
search_k: inspect up to search_k nodes which defaults
to n_trees * n if not provided
Returns:
List of Documents most similar to the query and score ... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/annoy.html |
ae82dcd18e64-3 | k: Number of Documents to return. Defaults to 4.
search_k: inspect up to search_k nodes which defaults
to n_trees * n if not provided
Returns:
List of Documents most similar to the query and score for each
"""
embedding = self.embedding_function(query)
... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/annoy.html |
ae82dcd18e64-4 | Returns:
List of Documents most similar to the embedding.
"""
docs_and_scores = self.similarity_search_with_score_by_index(
docstore_index, k, search_k
)
return [doc for doc, _ in docs_and_scores]
[docs] def similarity_search(
self, query: str, k: int =... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/annoy.html |
ae82dcd18e64-5 | embedding, fetch_k, search_k=-1, include_distances=False
)
embeddings = [self.index.get_item_vector(i) for i in idxs]
mmr_selected = maximal_marginal_relevance(
np.array([embedding], dtype=np.float32), embeddings, k=k
)
# ignore the -1's if not enough docs are returne... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/annoy.html |
ae82dcd18e64-6 | embeddings: List[List[float]],
embedding: Embeddings,
metadatas: Optional[List[dict]] = None,
metric: str = DEFAULT_METRIC,
trees: int = 100,
n_jobs: int = -1,
**kwargs: Any,
) -> Annoy:
if metric not in INDEX_METRICS:
raise ValueError(
... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/annoy.html |
ae82dcd18e64-7 | metric: str = DEFAULT_METRIC,
trees: int = 100,
n_jobs: int = -1,
**kwargs: Any,
) -> Annoy:
"""Construct Annoy wrapper from raw documents.
Args:
texts: List of documents to index.
embedding: Embedding function to use.
metadatas: List of me... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/annoy.html |
ae82dcd18e64-8 | **kwargs: Any,
) -> Annoy:
"""Construct Annoy wrapper from embeddings.
Args:
text_embeddings: List of tuples of (text, embedding)
embedding: Embedding function to use.
metadatas: List of metadata dictionaries to associate with documents.
metric: Metric... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/annoy.html |
ae82dcd18e64-9 | prefault: Whether to pre-load the index into memory.
"""
path = Path(folder_path)
os.makedirs(path, exist_ok=True)
# save index, index config, docstore and index_to_docstore_id
config_object = ConfigParser()
config_object["ANNOY"] = {
"f": self.index.f,
... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/annoy.html |
ae82dcd18e64-10 | index.load(str(path / "index.annoy"))
return cls(
embeddings.embed_query, index, metric, docstore, index_to_docstore_id
)
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 21, 2023. | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/annoy.html |
10591ca1fea3-0 | Source code for langchain.vectorstores.opensearch_vector_search
"""Wrapper around OpenSearch vector database."""
from __future__ import annotations
import uuid
from typing import Any, Dict, Iterable, List, Optional
from langchain.docstore.document import Document
from langchain.embeddings.base import Embeddings
from la... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/opensearch_vector_search.html |
10591ca1fea3-1 | f"Got error: {e} "
)
return client
def _validate_embeddings_and_bulk_size(embeddings_length: int, bulk_size: int) -> None:
"""Validate Embeddings Length and Bulk Size."""
if embeddings_length == 0:
raise RuntimeError("Embeddings size is zero")
if bulk_size < embeddings_length:
ra... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/opensearch_vector_search.html |
10591ca1fea3-2 | vector_field: str = "vector_field",
) -> Dict:
"""For Painless Scripting or Script Scoring,the default mapping to create index."""
return {
"mappings": {
"properties": {
vector_field: {"type": "knn_vector", "dimension": dim},
}
}
}
def _default_text_ma... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/opensearch_vector_search.html |
10591ca1fea3-3 | return {
"size": size,
"query": {"knn": {vector_field: {"vector": query_vector, "k": k}}},
}
def _approximate_search_query_with_boolean_filter(
query_vector: List[float],
boolean_filter: Dict,
size: int = 4,
k: int = 4,
vector_field: str = "vector_field",
subquery_clause: str... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/opensearch_vector_search.html |
10591ca1fea3-4 | """For Script Scoring Search, this is the default query."""
return {
"query": {
"script_score": {
"query": pre_filter,
"script": {
"source": "knn_score",
"lang": "knn",
"params": {
... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/opensearch_vector_search.html |
10591ca1fea3-5 | "field": vector_field,
"query_value": query_vector,
},
},
}
}
}
def _get_kwargs_value(kwargs: Any, key: str, default_value: Any) -> Any:
"""Get the value of the key if present. Else get the default_value."""
if key in kwargs:
... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/opensearch_vector_search.html |
10591ca1fea3-6 | bulk_size: Bulk API request count; Default: 500
Returns:
List of ids from adding the texts into the vectorstore.
Optional Args:
vector_field: Document field embeddings are stored in. Defaults to
"vector_field".
text_field: Document field the text of the do... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/opensearch_vector_search.html |
10591ca1fea3-7 | "metadata".
Can be set to a special value "*" to include the entire document.
Optional Args for Approximate Search:
search_type: "approximate_search"; default: "approximate_search"
size: number of results the query actually returns; default: 4
boolean_filter: A Bo... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/opensearch_vector_search.html |
10591ca1fea3-8 | metadata_field = _get_kwargs_value(kwargs, "metadata_field", "metadata")
vector_field = _get_kwargs_value(kwargs, "vector_field", "vector_field")
if search_type == "approximate_search":
size = _get_kwargs_value(kwargs, "size", 4)
boolean_filter = _get_kwargs_value(kwargs, "boolea... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/opensearch_vector_search.html |
10591ca1fea3-9 | pre_filter = _get_kwargs_value(kwargs, "pre_filter", MATCH_ALL_QUERY)
search_query = _default_painless_scripting_query(
embedding, space_type, pre_filter, vector_field
)
else:
raise ValueError("Invalid `search_type` provided as an argument")
response =... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/opensearch_vector_search.html |
10591ca1fea3-10 | vector_field: Document field embeddings are stored in. Defaults to
"vector_field".
text_field: Document field the text of the document is stored in. Defaults
to "text".
Optional Keyword Args for Approximate Search:
engine: "nmslib", "faiss", "lucene"; default: "nm... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/opensearch_vector_search.html |
10591ca1fea3-11 | _validate_embeddings_and_bulk_size(len(embeddings), bulk_size)
dim = len(embeddings[0])
# Get the index name from either from kwargs or ENV Variable
# before falling back to random generation
index_name = get_from_dict_or_env(
kwargs, "index_name", "OPENSEARCH_INDEX_NAME", de... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/opensearch_vector_search.html |
10591ca1fea3-12 | By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 21, 2023. | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/opensearch_vector_search.html |
4fd0f44fb656-0 | Source code for langchain.vectorstores.faiss
"""Wrapper around FAISS vector database."""
from __future__ import annotations
import math
import pickle
import uuid
from pathlib import Path
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple
import numpy as np
from langchain.docstore.base import Addabl... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/faiss.html |
4fd0f44fb656-1 | [docs]class FAISS(VectorStore):
"""Wrapper around FAISS vector database.
To use, you should have the ``faiss`` python package installed.
Example:
.. code-block:: python
from langchain import FAISS
faiss = FAISS(embedding_function, index, docstore, index_to_docstore_id)
""... | https://python.langchain.com/en/latest/_modules/langchain/vectorstores/faiss.html |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 6