Unnamed: 0 stringlengths 1 178 | link stringlengths 31 163 | text stringlengths 18 32.8k ⌀ |
|---|---|---|
0 | https://python.langchain.com/docs/get_started | Get startedGet startedGet started with LangChain📄️ IntroductionLangChain is a framework for developing applications powered by language models. It enables applications that:📄️ Installation📄️ QuickstartInstallationNextIntroduction |
1 | https://python.langchain.com/docs/get_started/introduction | Get startedIntroductionOn this pageIntroductionLangChain is a framework for developing applications powered by language models. It enables applications that:Are context-aware: connect a language model to sources of context (prompt instructions, few shot examples, content to ground its response in, etc.)Reason: rely on ... |
2 | https://python.langchain.com/docs/get_started/installation | Get startedInstallationInstallationOfficial releaseTo install LangChain run:PipCondapip install langchainconda install langchain -c conda-forgeThis 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 defaul... |
3 | https://python.langchain.com/docs/get_started/quickstart | Get startedQuickstartOn this pageQuickstartInstallationTo install LangChain run:PipCondapip install langchainconda install langchain -c conda-forgeFor more details, see our Installation guide.Environment setupUsing LangChain will usually require integrations with one or more model providers, data stores, APIs, etc. F... |
4 | https://python.langchain.com/docs/expression_language/ | LangChain Expression LanguageOn this pageLangChain Expression Language (LCEL)LangChain Expression Language or LCEL is a declarative way to easily compose chains together.
There are several benefits to writing chains in this manner (as opposed to writing normal code):Async, Batch, and Streaming Support
Any chain constru... |
5 | https://python.langchain.com/docs/expression_language/interface | LangChain Expression LanguageInterfaceOn this pageInterfaceIn an effort to make it as easy as possible to create custom chains, we've implemented a "Runnable" protocol that most components implement. This is a standard interface with a few different methods, which makes it easy to define custom chains as well as making... |
6 | https://python.langchain.com/docs/expression_language/how_to/ | LangChain Expression LanguageHow toHow to📄️ Bind runtime argsSometimes we want to invoke a Runnable within a Runnable sequence with constant arguments that are not part of the output of the preceding Runnable in the sequence, and which are not part of the user input. We can use Runnable.bind() to easily pass these arg... |
7 | https://python.langchain.com/docs/expression_language/how_to/binding | LangChain Expression LanguageHow toBind runtime argsOn this pageBind runtime argsSometimes we want to invoke a Runnable within a Runnable sequence with constant arguments that are not part of the output of the preceding Runnable in the sequence, and which are not part of the user input. We can use Runnable.bind() to ea... |
8 | https://python.langchain.com/docs/expression_language/how_to/fallbacks | LangChain Expression LanguageHow toAdd fallbacksOn this pageAdd fallbacksThere are many possible points of failure in an LLM application, whether that be issues with LLM API's, poor model outputs, issues with other integrations, etc. Fallbacks help you gracefully handle and isolate these issues.Crucially, fallbacks can... |
9 | https://python.langchain.com/docs/expression_language/how_to/functions | LangChain Expression LanguageHow toRun arbitrary functionsOn this pageRun arbitrary functionsYou can use arbitrary functions in the pipelineNote that all inputs to these functions need to be a SINGLE argument. If you have a function that accepts multiple arguments, you should write a wrapper that accepts a single input... |
10 | https://python.langchain.com/docs/expression_language/how_to/map | LangChain Expression LanguageHow toUse RunnableParallel/RunnableMapOn this pageUse RunnableParallel/RunnableMapRunnableParallel (aka. RunnableMap) makes it easy to execute multiple Runnables in parallel, and to return the output of these Runnables as a map.from langchain.chat_models import ChatOpenAIfrom langchain.prom... |
11 | https://python.langchain.com/docs/expression_language/how_to/routing | LangChain Expression LanguageHow toRoute between multiple RunnablesOn this pageRoute between multiple RunnablesThis notebook covers how to do routing in the LangChain Expression Language.Routing allows you to create non-deterministic chains where the output of a previous step defines the next step. Routing helps provid... |
12 | https://python.langchain.com/docs/expression_language/cookbook/ | LangChain Expression LanguageCookbookCookbookExample code for accomplishing common tasks with the LangChain Expression Language (LCEL). These examples show how to compose different Runnable (the core LCEL interface) components to achieve various tasks. If you're just getting acquainted with LCEL, the Prompt + LLM page ... |
13 | https://python.langchain.com/docs/expression_language/cookbook/prompt_llm_parser | LangChain Expression LanguageCookbookPrompt + LLMOn this pagePrompt + LLMThe most common and valuable composition is taking:PromptTemplate / ChatPromptTemplate -> LLM / ChatModel -> OutputParserAlmost any other chains you build will use this building block.PromptTemplate + LLMThe simplest composition is just combing a... |
14 | https://python.langchain.com/docs/expression_language/cookbook/retrieval | LangChain Expression LanguageCookbookRAGOn this pageRAGLet's look at adding in a retrieval step to a prompt and LLM, which adds up to a "retrieval-augmented generation" chainpip install langchain openai faiss-cpu tiktokenfrom operator import itemgetterfrom langchain.prompts import ChatPromptTemplatefrom langchain.chat_... |
15 | https://python.langchain.com/docs/expression_language/cookbook/multiple_chains | LangChain Expression LanguageCookbookMultiple chainsOn this pageMultiple chainsRunnables can easily be used to string together multiple Chainsfrom operator import itemgetterfrom langchain.chat_models import ChatOpenAIfrom langchain.prompts import ChatPromptTemplatefrom langchain.schema import StrOutputParserprompt1 = C... |
16 | https://python.langchain.com/docs/expression_language/cookbook/sql_db | LangChain Expression LanguageCookbookQuerying a SQL DBQuerying a SQL DBWe can replicate our SQLDatabaseChain with Runnables.from langchain.prompts import ChatPromptTemplatetemplate = """Based on the table schema below, write a SQL query that would answer the user's question:{schema}Question: {question}SQL Query:"""prom... |
17 | https://python.langchain.com/docs/expression_language/cookbook/agent | LangChain Expression LanguageCookbookAgentsAgentsYou can pass a Runnable into an agent.from langchain.agents import XMLAgent, tool, AgentExecutorfrom langchain.chat_models import ChatAnthropicmodel = ChatAnthropic(model="claude-2")@tooldef search(query: str) -> str: """Search things about current events.""" retur... |
18 | https://python.langchain.com/docs/expression_language/cookbook/code_writing | LangChain Expression LanguageCookbookCode writingCode writingExample of how to use LCEL to write Python code.from langchain.chat_models import ChatOpenAIfrom langchain.prompts import ChatPromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplatefrom langchain.schema.output_parser import StrOutputParserfrom... |
19 | https://python.langchain.com/docs/expression_language/cookbook/memory | LangChain Expression LanguageCookbookAdding memoryAdding memoryThis shows how to add memory to an arbitrary chain. Right now, you can use the memory classes but need to hook it up manuallyfrom operator import itemgetterfrom langchain.chat_models import ChatOpenAIfrom langchain.memory import ConversationBufferMemoryfrom... |
20 | https://python.langchain.com/docs/expression_language/cookbook/moderation | LangChain Expression LanguageCookbookAdding moderationAdding moderationThis shows how to add in moderation (or other safeguards) around your LLM application.from langchain.chains import OpenAIModerationChainfrom langchain.llms import OpenAIfrom langchain.prompts import ChatPromptTemplatemoderate = OpenAIModerationChain... |
21 | https://python.langchain.com/docs/expression_language/cookbook/tools | LangChain Expression LanguageCookbookUsing toolsUsing toolsYou can use any Tools with Runnables easily.pip install duckduckgo-searchfrom langchain.chat_models import ChatOpenAIfrom langchain.prompts import ChatPromptTemplatefrom langchain.schema.output_parser import StrOutputParserfrom langchain.tools import DuckDuckGo... |
22 | https://python.langchain.com/docs/expression_language/ | LangChain Expression LanguageOn this pageLangChain Expression Language (LCEL)LangChain Expression Language or LCEL is a declarative way to easily compose chains together.
There are several benefits to writing chains in this manner (as opposed to writing normal code):Async, Batch, and Streaming Support
Any chain constru... |
23 | https://python.langchain.com/docs/modules/ | ModulesOn this pageModulesLangChain provides standard, extendable interfaces and external integrations for the following modules, listed from least to most complex:Model I/OInterface with language modelsRetrievalInterface with application-specific dataChainsConstruct sequences of callsAgentsLet chains choose which ... |
24 | https://python.langchain.com/docs/modules/model_io/ | ModulesModel I/OModel I/OThe core element of any language model application is...the model. LangChain gives you the building blocks to interface with any language model.Prompts: Templatize, dynamically select, and manage model inputsLanguage models: Make calls to language models through common interfacesOutput parsers... |
25 | https://python.langchain.com/docs/modules/model_io/prompts/ | ModulesModel I/OPromptsPromptsA prompt for a language model is a set of instructions or input provided by a user to
guide the model's response, helping it understand the context and generate relevant
and coherent language-based output, such as answering questions, completing sentences,
or engaging in a conversation.La... |
26 | https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/ | ModulesModel I/OPromptsPrompt templatesPrompt templatesPrompt templates are pre-defined recipes for generating prompts for language models.A template may include instructions, few-shot examples, and specific context and
questions appropriate for a given task.LangChain provides tooling to create and work with prompt te... |
27 | https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/connecting_to_a_feature_store | ModulesModel I/OPromptsPrompt templatesConnecting to a Feature StoreOn this pageConnecting to a Feature StoreFeature stores are a concept from traditional machine learning that make sure data fed into models is up-to-date and relevant. For more on this, see here.This concept is extremely relevant when considering putt... |
28 | https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/custom_prompt_template | ModulesModel I/OPromptsPrompt templatesCustom prompt templateOn this pageCustom prompt templateLet's suppose we want the LLM to generate English language explanations of a function given its name. To achieve this task, we will create a custom prompt template that takes in the function name as input, and formats the pr... |
29 | https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/few_shot_examples | ModulesModel I/OPromptsPrompt templatesFew-shot prompt templatesFew-shot prompt templatesIn this tutorial, we'll learn how to create a prompt template that uses few-shot examples. A few-shot prompt template can be constructed from either a set of examples, or from an Example Selector object.Use CaseIn this tutorial, ... |
30 | https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/few_shot_examples_chat | ModulesModel I/OPromptsPrompt templatesFew-shot examples for chat modelsOn this pageFew-shot examples for chat modelsThis notebook covers how to use few-shot examples in chat models. There does not appear to be solid consensus on how best to do few-shot prompting, and the optimal prompt compilation will likely vary by... |
31 | https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/format_output | ModulesModel I/OPromptsPrompt templatesFormat template outputFormat template outputThe output of the format method is available as a string, list of messages and ChatPromptValueAs string:output = chat_prompt.format(input_language="English", output_language="French", text="I love programming.")output 'System: You ar... |
32 | https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/formats | ModulesModel I/OPromptsPrompt templatesTemplate formatsTemplate formatsPromptTemplate by default uses Python f-string as its template format. However, it can also use other formats like jinja2, specified through the template_format argument.To use the jinja2 template:from langchain.prompts import PromptTemplatejinja2_... |
33 | https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/msg_prompt_templates | ModulesModel I/OPromptsPrompt templatesTypes of MessagePromptTemplateTypes of MessagePromptTemplateLangChain provides different types of MessagePromptTemplate. The most commonly used are AIMessagePromptTemplate, SystemMessagePromptTemplate and HumanMessagePromptTemplate, which create an AI message, system message and ... |
34 | https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/partial | ModulesModel I/OPromptsPrompt templatesPartial prompt templatesPartial prompt templatesLike other methods, it can make sense to "partial" a prompt template - e.g. pass in a subset of the required values, as to create a new prompt template which expects only the remaining subset of values.LangChain supports this in two... |
35 | https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/prompt_composition | ModulesModel I/OPromptsPrompt templatesCompositionCompositionThis notebook goes over how to compose multiple prompts together. This can be useful when you want to reuse parts of prompts. This can be done with a PipelinePrompt. A PipelinePrompt consists of two main parts:Final prompt: The final prompt that is returnedP... |
36 | https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/prompt_serialization | ModulesModel I/OPromptsPrompt templatesSerializationOn this pageSerializationIt is often preferrable to store prompts not as python code but as files. This can make it easy to share, store, and version prompts. This notebook covers how to do that in LangChain, walking through all the different types of prompts and the... |
37 | https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/prompts_pipelining | ModulesModel I/OPromptsPrompt templatesPrompt pipeliningOn this pagePrompt pipeliningThe idea behind prompt pipelining is to provide a user friendly interface for composing different parts of prompts together. You can do this with either string prompts or chat prompts. Constructing prompts this way allows for easy reu... |
38 | https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/validate | ModulesModel I/OPromptsPrompt templatesValidate templateValidate templateBy default, PromptTemplate will validate the template string by checking whether the input_variables match the variables defined in template. You can disable this behavior by setting validate_template to False.template = "I am learning langchain ... |
39 | https://python.langchain.com/docs/modules/model_io/prompts/example_selectors/ | ModulesModel I/OPromptsExample selectorsExample selectorsIf you have a large number of examples, you may need to select which ones to include in the prompt. The Example Selector is the class responsible for doing so.The base interface is defined as below:class BaseExampleSelector(ABC): """Interface for selecting ex... |
40 | https://python.langchain.com/docs/modules/model_io/models/ | ModulesModel I/OLanguage modelsOn this pageLanguage modelsLangChain provides interfaces and integrations for two types of models:LLMs: Models that take a text string as input and return a text stringChat models: Models that are backed by a language model but take a list of Chat Messages as input and return a Chat Mess... |
41 | https://python.langchain.com/docs/modules/model_io/output_parsers/ | ModulesModel I/OOutput parsersOn this pageOutput parsersLanguage models output text. But many times you may want to get more structured information than just text back. This is where output parsers come in.Output parsers are classes that help structure language model responses. There are two main methods an output par... |
42 | https://python.langchain.com/docs/modules/data_connection/ | ModulesRetrievalRetrievalMany LLM applications require user-specific data that is not part of the model's training set.
The primary way of accomplishing this is through Retrieval Augmented Generation (RAG).
In this process, external data is retrieved and then passed to the LLM when doing the generation step.LangChain p... |
43 | https://python.langchain.com/docs/modules/data_connection/document_loaders/ | ModulesRetrievalDocument loadersOn this pageDocument loadersinfoHead to Integrations for documentation on built-in document loader integrations with 3rd-party tools.Use document loaders to load data from a source as Document's. A Document is a piece of text
and associated metadata. For example, there are document loade... |
44 | https://python.langchain.com/docs/modules/data_connection/document_loaders/csv | ModulesRetrievalDocument loadersCSVCSVA comma-separated values (CSV) file is a delimited text file that uses a comma to separate values. Each line of the file is a data record. Each record consists of one or more fields, separated by commas.Load CSV data with a single row per document.from langchain.document_loaders.cs... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 9