id stringlengths 14 16 | text stringlengths 31 2.73k | source stringlengths 39 114 |
|---|---|---|
43149bd5dc41-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/index.html |
43149bd5dc41-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/index.html |
43149bd5dc41-2 | Reference Documentation
LangChain Ecosystem#
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 prompt... | https://python.langchain.com/index.html |
e7ab7e9a17c2-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 |
e7ab7e9a17c2-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 |
e7ab7e9a17c2-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 met... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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 met... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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.OpenAPIEndp... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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
call... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-6 | completion_bias_exclusion_first_token_only (langchain.llms.AlephAlpha attribute)
compress_to_size (langchain.embeddings.AlephAlphaAsymmetricSemanticEmbedding attribute)
constitutional_principles (langchain.chains.ConstitutionalChain attribute)
construct() (langchain.llms.AI21 class method)
(langchain.llms.AlephAlpha cl... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-7 | (langchain.llms.StochasticAI class method)
(langchain.llms.Writer class method)
content_handler (langchain.embeddings.SagemakerEndpointEmbeddings attribute)
(langchain.llms.SagemakerEndpoint attribute)
CONTENT_KEY (langchain.vectorstores.Qdrant attribute)
contextual_control_threshold (langchain.embeddings.AlephAlphaAsy... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-8 | (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)
coroutine (langchain.agents.Tool attribute)
countPenalt... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-9 | credentials_profile_name (langchain.embeddings.SagemakerEndpointEmbeddings attribute)
(langchain.llms.SagemakerEndpoint attribute)
critique_chain (langchain.chains.ConstitutionalChain attribute)
D
database (langchain.chains.SQLDatabaseChain attribute)
decider_chain (langchain.chains.SQLDatabaseSequentialChain attribute... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-10 | (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.SelfHostedHugg... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-11 | (langchain.embeddings.HuggingFaceHubEmbeddings method)
(langchain.embeddings.HuggingFaceInstructEmbeddings method)
(langchain.embeddings.LlamaCppEmbeddings method)
(langchain.embeddings.OpenAIEmbeddings method)
(langchain.embeddings.SagemakerEndpointEmbeddings method)
(langchain.embeddings.SelfHostedEmbeddings method)
... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-12 | (langchain.llms.SagemakerEndpoint attribute)
endpoint_url (langchain.llms.CerebriumAI attribute)
(langchain.llms.ForefrontAI attribute)
(langchain.llms.HuggingFaceEndpoint attribute)
(langchain.llms.Modal attribute)
engines (langchain.utilities.searx_search.SearxSearchWrapper attribute)
entity_extraction_chain (langcha... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-13 | (langchain.prompts.FewShotPromptTemplate method)
(langchain.prompts.FewShotPromptWithTemplates method)
(langchain.prompts.PromptTemplate method)
format_messages() (langchain.prompts.BaseChatPromptTemplate method)
(langchain.prompts.ChatPromptTemplate method)
(langchain.prompts.MessagesPlaceholder method)
format_prompt(... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-14 | from_llm() (langchain.chains.ChatVectorDBChain class method)
(langchain.chains.ConstitutionalChain class method)
(langchain.chains.ConversationalRetrievalChain class method)
(langchain.chains.GraphQAChain class method)
(langchain.chains.HypotheticalDocumentEmbedder class method)
(langchain.chains.QAGenerationChain clas... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-15 | (langchain.vectorstores.Qdrant class method)
(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... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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)
(l... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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)
(langcha... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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.embeddi... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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.Hu... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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_s... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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)
lo... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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)
(langch... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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 attri... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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.Ope... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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 ... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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)... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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 lan... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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.... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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.... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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() (l... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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_ve... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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)
stre... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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.Llama... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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... | https://python.langchain.com/en/latest/genindex.html |
e7ab7e9a17c2-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
© C... | https://python.langchain.com/en/latest/genindex.html |
23addbe88ec3-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 |
23addbe88ec3-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 |
23addbe88ec3-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 |
23addbe88ec3-3 | So the final answer is:
Carlos Alcaraz
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 13, 2023. | https://python.langchain.com/en/latest/model_laboratory.html |
d59a6e34511a-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 |
d59a6e34511a-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 |
d59a6e34511a-2 | Reference Documentation
LangChain Ecosystem#
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 prompt... | https://python.langchain.com/en/latest/index.html |
4f3447a62e3e-0 | Search
Error
Please activate JavaScript to enable the search functionality.
Ctrl+K
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 13, 2023. | https://python.langchain.com/en/latest/search.html |
4b72e7147db3-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 ... | https://python.langchain.com/en/latest/reference.html |
37f4b8c06ffa-0 | .md
.pdf
Deployments
Contents
Streamlit
Gradio (on Hugging Face)
Beam
Vercel
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 these are meant as quick d... | https://python.langchain.com/en/latest/deployments.html |
37f4b8c06ffa-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 enj... | https://python.langchain.com/en/latest/deployments.html |
2579272b6cca-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 |
2579272b6cca-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 |
2579272b6cca-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
... | https://python.langchain.com/en/latest/gallery.html |
480ba0b5b11f-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 |
480ba0b5b11f-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 |
220e1c76ecf6-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 |
0ab30fa47d76-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 |
0ab30fa47d76-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 |
8bf2a8e508b1-0 | .md
.pdf
Question Answering over Docs
Contents
Document Question Answering
Adding in sources
Additional Related Resources
Question Answering over Docs#
Conceptual Guide
Question answering in this context refers to question answering over your document data.
For question answering over other types of data, please see ... | https://python.langchain.com/en/latest/use_cases/question_answering.html |
8bf2a8e508b1-1 | The recommended way to get started using a question answering chain is:
from langchain.chains.question_answering import load_qa_chain
chain = load_qa_chain(llm, chain_type="stuff")
chain.run(input_documents=docs, question=query)
The following resources exist:
Question Answering Notebook: A notebook walking through how ... | https://python.langchain.com/en/latest/use_cases/question_answering.html |
8bf2a8e508b1-2 | CombineDocuments Chains: A conceptual overview of specific types of chains by which you can accomplish this task.
previous
Personal Assistants (Agents)
next
Chatbots
Contents
Document Question Answering
Adding in sources
Additional Related Resources
By Harrison Chase
© Copyright 2023, Harrison Chase.
... | https://python.langchain.com/en/latest/use_cases/question_answering.html |
612262e69438-0 | .md
.pdf
Querying Tabular Data
Contents
Document Loading
Querying
Chains
Agents
Querying Tabular Data#
Conceptual Guide
Lots of data and information is stored in tabular data, whether it be csvs, excel sheets, or SQL tables.
This page covers all resources available in LangChain for working with data in this format.
D... | https://python.langchain.com/en/latest/use_cases/tabular.html |
adfc71211a37-0 | .md
.pdf
Interacting with APIs
Contents
Chains
Agents
Interacting with APIs#
Conceptual Guide
Lots of data and information is stored behind APIs.
This page covers all resources available in LangChain for working with APIs.
Chains#
If you are just getting started, and you have relatively simple apis, you should get st... | https://python.langchain.com/en/latest/use_cases/apis.html |
6e10987f7f70-0 | .md
.pdf
Code Understanding
Contents
Conversational Retriever Chain
Code Understanding#
Overview
LangChain is a useful tool designed to parse GitHub code repositories. By leveraging VectorStores, Conversational RetrieverChain, and GPT-4, it can answer questions in the context of an entire GitHub repository or generat... | https://python.langchain.com/en/latest/use_cases/code.html |
6e10987f7f70-1 | The full tutorial is available below.
Twitter the-algorithm codebase analysis with Deep Lake: A notebook walking through how to parse github source code and run queries conversation.
previous
Querying Tabular Data
next
Interacting with APIs
Contents
Conversational Retriever Chain
By Harrison Chase
© Copy... | https://python.langchain.com/en/latest/use_cases/code.html |
1356dc1fa9d1-0 | .md
.pdf
Extraction
Extraction#
Conceptual Guide
Most APIs and databases still deal with structured information.
Therefore, in order to better work with those, it can be useful to extract structured information from text.
Examples of this include:
Extracting a structured row to insert into a database from a sentence
Ex... | https://python.langchain.com/en/latest/use_cases/extraction.html |
02812b3622cb-0 | .md
.pdf
Summarization
Summarization#
Conceptual Guide
Summarization involves creating a smaller summary of multiple longer documents.
This can be useful for distilling long documents into the core pieces of information.
The recommended way to get started using a summarization chain is:
from langchain.chains.summarize ... | https://python.langchain.com/en/latest/use_cases/summarization.html |
307c5f152e27-0 | .md
.pdf
Personal Assistants (Agents)
Personal Assistants (Agents)#
Conceptual Guide
We use “personal assistant” here in a very broad sense.
Personal assistants have a few characteristics:
They can interact with the outside world
They have knowledge of your data
They remember your interactions
Really all of the functio... | https://python.langchain.com/en/latest/use_cases/personal_assistants.html |
c4b2a1c19eda-0 | .md
.pdf
Chatbots
Chatbots#
Conceptual Guide
Since language models are good at producing text, that makes them ideal for creating chatbots.
Aside from the base prompts/LLMs, an important concept to know for Chatbots is memory.
Most chat based applications rely on remembering what happened in previous interactions, whic... | https://python.langchain.com/en/latest/use_cases/chatbots.html |
6f16ed79d423-0 | .rst
.pdf
Evaluation
Contents
The Problem
The Solution
The Examples
Other Examples
Evaluation#
Note
Conceptual Guide
This section of documentation covers how we approach and think about evaluation in LangChain.
Both evaluation of internal chains/agents, but also how we would recommend people building on top of LangCh... | https://python.langchain.com/en/latest/use_cases/evaluation.html |
6f16ed79d423-1 | We intend this to be a collection of open source datasets for evaluating common chains and agents.
We have contributed five datasets of our own to start, but we highly intend this to be a community effort.
In order to contribute a dataset, you simply need to join the community and then you will be able to upload datase... | https://python.langchain.com/en/latest/use_cases/evaluation.html |
6f16ed79d423-2 | SQL Question Answering (Chinook): A notebook showing evaluation of a question-answering task over a SQL database (the Chinook database).
Agent Vectorstore: A notebook showing evaluation of an agent doing question answering while routing between two different vector databases.
Agent Search + Calculator: A notebook showi... | https://python.langchain.com/en/latest/use_cases/evaluation.html |
aa9aaf96d2ad-0 | .ipynb
.pdf
Custom Agent with PlugIn Retrieval
Contents
Set up environment
Setup LLM
Set up plugins
Tool Retriever
Prompt Template
Output Parser
Set up LLM, stop sequence, and the agent
Use the Agent
Custom Agent with PlugIn Retrieval#
This notebook combines two concepts in order to build a custom agent that can inte... | https://python.langchain.com/en/latest/use_cases/agents/custom_agent_with_plugin_retrieval.html |
aa9aaf96d2ad-1 | Set up plugins#
Load and index plugins
urls = [
"https://datasette.io/.well-known/ai-plugin.json",
"https://api.speak.com/.well-known/ai-plugin.json",
"https://www.wolframalpha.com/.well-known/ai-plugin.json",
"https://www.zapier.com/.well-known/ai-plugin.json",
"https://www.klarna.com/.well-known/a... | https://python.langchain.com/en/latest/use_cases/agents/custom_agent_with_plugin_retrieval.html |
aa9aaf96d2ad-2 | Attempting to load an OpenAPI 3.0.1 spec. This may result in degraded performance. Convert your OpenAPI spec to 3.1.* spec for better support.
Attempting to load an OpenAPI 3.0.1 spec. This may result in degraded performance. Convert your OpenAPI spec to 3.1.* spec for better support.
Attempting to load an OpenAPI 3.... | https://python.langchain.com/en/latest/use_cases/agents/custom_agent_with_plugin_retrieval.html |
aa9aaf96d2ad-3 | # Get the tools: a separate NLAChain for each endpoint
tools = []
for tk in tool_kits:
tools.extend(tk.nla_tools)
return tools
We can now test this retriever to see if it seems to work.
tools = get_tools("What could I do today with my kiddo")
[t.name for t in tools]
['Milo.askMilo',
'Zapier_Natural... | https://python.langchain.com/en/latest/use_cases/agents/custom_agent_with_plugin_retrieval.html |
aa9aaf96d2ad-4 | ['Open_AI_Klarna_product_Api.productsUsingGET',
'Milo.askMilo',
'Zapier_Natural_Language_Actions_(NLA)_API_(Dynamic)_-_Beta.search_all_actions',
'Zapier_Natural_Language_Actions_(NLA)_API_(Dynamic)_-_Beta.preview_a_zap',
'Zapier_Natural_Language_Actions_(NLA)_API_(Dynamic)_-_Beta.get_configuration_link',
'Zapier_N... | https://python.langchain.com/en/latest/use_cases/agents/custom_agent_with_plugin_retrieval.html |
aa9aaf96d2ad-5 | Action Input: the input to the action
Observation: the result of the action
... (this Thought/Action/Action Input/Observation can repeat N times)
Thought: I now know the final answer
Final Answer: the final answer to the original input question
Begin! Remember to speak as a pirate when giving your final answer. Use lot... | https://python.langchain.com/en/latest/use_cases/agents/custom_agent_with_plugin_retrieval.html |
aa9aaf96d2ad-6 | prompt = CustomPromptTemplate(
template=template,
tools_getter=get_tools,
# This omits the `agent_scratchpad`, `tools`, and `tool_names` variables because those are generated dynamically
# This includes the `intermediate_steps` variable because that is needed
input_variables=["input", "intermediate_... | https://python.langchain.com/en/latest/use_cases/agents/custom_agent_with_plugin_retrieval.html |
aa9aaf96d2ad-7 | Also the same as the previous notebook
llm = OpenAI(temperature=0)
# LLM chain consisting of the LLM and a prompt
llm_chain = LLMChain(llm=llm, prompt=prompt)
tool_names = [tool.name for tool in tools]
agent = LLMSingleActionAgent(
llm_chain=llm_chain,
output_parser=output_parser,
stop=["\nObservation:"], ... | https://python.langchain.com/en/latest/use_cases/agents/custom_agent_with_plugin_retrieval.html |
aa9aaf96d2ad-8 | By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 13, 2023. | https://python.langchain.com/en/latest/use_cases/agents/custom_agent_with_plugin_retrieval.html |
5c965b0bf737-0 | .ipynb
.pdf
CAMEL Role-Playing Autonomous Cooperative Agents
Contents
Import LangChain related modules
Define a CAMEL agent helper class
Setup OpenAI API key and roles and task for role-playing
Create a task specify agent for brainstorming and get the specified task
Create inception prompts for AI assistant and AI us... | https://python.langchain.com/en/latest/use_cases/agents/camel_role_playing.html |
5c965b0bf737-1 | Arxiv paper: https://arxiv.org/abs/2303.17760
Import LangChain related modules#
from typing import List
from langchain.chat_models import ChatOpenAI
from langchain.prompts.chat import (
SystemMessagePromptTemplate,
HumanMessagePromptTemplate,
)
from langchain.schema import (
AIMessage,
HumanMessage,
... | https://python.langchain.com/en/latest/use_cases/agents/camel_role_playing.html |
5c965b0bf737-2 | Create a task specify agent for brainstorming and get the specified task#
task_specifier_sys_msg = SystemMessage(content="You can make a task more specific.")
task_specifier_prompt = (
"""Here is a task that {assistant_role_name} will help {user_role_name} to complete: {task}.
Please make it more specific. Be creative ... | https://python.langchain.com/en/latest/use_cases/agents/camel_role_playing.html |
5c965b0bf737-3 | I must give you one instruction at a time.
You must write a specific solution that appropriately completes the requested instruction.
You must decline my instruction honestly if you cannot perform the instruction due to physical, moral, legal reasons or your capability and explain the reasons.
Do not add anything else ... | https://python.langchain.com/en/latest/use_cases/agents/camel_role_playing.html |
5c965b0bf737-4 | You should instruct me not ask me questions.
Now you must start to instruct me using the two ways described above.
Do not add anything else other than your instruction and the optional corresponding input!
Keep giving me instructions and necessary inputs until you think the task is completed.
When the task is completed... | https://python.langchain.com/en/latest/use_cases/agents/camel_role_playing.html |
5c965b0bf737-5 | "Now start to give me introductions one by one. "
"Only reply with Instruction and Input."))
user_msg = HumanMessage(content=f"{assistant_sys_msg.content}")
user_msg = assistant_agent.step(user_msg)
Start role-playing session to solve the task!#
print(f"Original task prompt:\n{task}\n")
print(f"Specifie... | https://python.langchain.com/en/latest/use_cases/agents/camel_role_playing.html |
5c965b0bf737-6 | pip install pandas numpy matplotlib ta-lib
```
Next request.
AI User (Stock Trader):
Instruction: Import the necessary libraries in the Python script.
Input: None
AI Assistant (Python Programmer):
Solution: We can import the necessary libraries in the Python script using the import statement. We need to import pandas, ... | https://python.langchain.com/en/latest/use_cases/agents/camel_role_playing.html |
5c965b0bf737-7 | df = df.set_index('date')
df = df.sort_index(ascending=True)
```
This will set the date column as the index and sort the DataFrame in ascending order by date. Next request.
AI User (Stock Trader):
Instruction: Calculate the short-term and long-term moving averages for the stock data using the `ta.SMA()` function from t... | https://python.langchain.com/en/latest/use_cases/agents/camel_role_playing.html |
5c965b0bf737-8 | ```
new_df = pd.concat([df, short_ma, long_ma], axis=1)
new_df.columns = ['open', 'high', 'low', 'close', 'volume', 'short_ma', 'long_ma']
```
This will create a new DataFrame called `new_df` that combines the historical stock data with the short-term and long-term moving averages. The columns of the new DataFrame are ... | https://python.langchain.com/en/latest/use_cases/agents/camel_role_playing.html |
5c965b0bf737-9 | Input: The stop loss and profit target as percentages.
AI Assistant (Python Programmer):
Solution: We can create a new column in the DataFrame that indicates the profit or loss for each trade based on the buy and sell signals and the defined stop loss and profit target. We need to pass the stop loss and profit target a... | https://python.langchain.com/en/latest/use_cases/agents/camel_role_playing.html |
5c965b0bf737-10 | ```
This will create a new column called 'pnl' in the DataFrame that indicates the profit or loss for each trade based on the buy and sell signals and the defined stop loss and profit target. The stop loss and profit target are calculated based on the stop_loss_percent and profit_target_percent variables, respectively.... | https://python.langchain.com/en/latest/use_cases/agents/camel_role_playing.html |
5c965b0bf737-11 | plt.plot(new_df.index, new_df['close'], label='Close')
plt.plot(new_df.index, new_df['short_ma'], label='Short MA')
plt.plot(new_df.index, new_df['long_ma'], label='Long MA')
plt.xlabel('Date')
plt.ylabel('Price')
plt.title('Stock Data with Moving Averages')
plt.legend()
plt.show()
```
This will create a line chart tha... | https://python.langchain.com/en/latest/use_cases/agents/camel_role_playing.html |
5c965b0bf737-12 | AI User (Stock Trader):
Instruction: Print the total profit or loss for all trades.
Input: None.
AI Assistant (Python Programmer):
Solution: We can print the total profit or loss for all trades using the `print()` function. We can use the following code to print the total profit or loss:
```
print('Total Profit/Loss: {... | https://python.langchain.com/en/latest/use_cases/agents/camel_role_playing.html |
5c965b0bf737-13 | # Create a new column in the DataFrame that indicates when to buy or sell the stock based on the crossover of the short-term and long-term moving averages
new_df['signal'] = np.where(new_df['short_ma'] > new_df['long_ma'], 1, -1)
# Create a new column in the DataFrame that indicates the profit or loss for each trade ba... | https://python.langchain.com/en/latest/use_cases/agents/camel_role_playing.html |
5c965b0bf737-14 | plt.plot(new_df.index, new_df['close'], label='Close')
plt.plot(new_df.index, new_df['short_ma'], label='Short MA')
plt.plot(new_df.index, new_df['long_ma'], label='Long MA')
plt.xlabel('Date')
plt.ylabel('Price')
plt.title('Stock Data with Moving Averages')
plt.legend()
plt.show()
# Visualize the buy and sell signals ... | https://python.langchain.com/en/latest/use_cases/agents/camel_role_playing.html |
5c965b0bf737-15 | Create a task specify agent for brainstorming and get the specified task
Create inception prompts for AI assistant and AI user for role-playing
Create a helper helper to get system messages for AI assistant and AI user from role names and the task
Create AI assistant agent and AI user agent from obtained system message... | https://python.langchain.com/en/latest/use_cases/agents/camel_role_playing.html |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 3