From 8ac890c5536995919bc0bb1bc982962e91972bd9 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 26 Jul 2023 14:42:48 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore(chains.mdx):=20add=20impor?= =?UTF-8?q?t=20statement=20for=20Admonition=20component=20to=20improve=20c?= =?UTF-8?q?ode=20organization=20and=20readability=20=F0=9F=94=A7=20chore(c?= =?UTF-8?q?hains.mdx):=20fix=20formatting=20and=20indentation=20for=20bett?= =?UTF-8?q?er=20code=20readability=20=F0=9F=94=A7=20chore(chains.mdx):=20u?= =?UTF-8?q?pdate=20verbose=20parameter=20description=20to=20improve=20clar?= =?UTF-8?q?ity=20=F0=9F=94=A7=20chore(chains.mdx):=20fix=20formatting=20an?= =?UTF-8?q?d=20indentation=20for=20better=20code=20readability=20?= =?UTF-8?q?=F0=9F=94=A7=20chore(chains.mdx):=20update=20verbose=20paramete?= =?UTF-8?q?r=20description=20to=20improve=20clarity=20=F0=9F=94=A7=20chore?= =?UTF-8?q?(chains.mdx):=20fix=20formatting=20and=20indentation=20for=20be?= =?UTF-8?q?tter=20code=20readability=20=F0=9F=94=A7=20chore(chains.mdx):?= =?UTF-8?q?=20update=20verbose=20parameter=20description=20to=20improve=20?= =?UTF-8?q?clarity=20=F0=9F=94=A7=20chore(chains.mdx):=20fix=20formatting?= =?UTF-8?q?=20and=20indentation=20for=20better=20code=20readability=20?= =?UTF-8?q?=F0=9F=94=A7=20chore(chains.mdx):=20update=20verbose=20paramete?= =?UTF-8?q?r=20description=20to=20improve=20clarity=20=F0=9F=94=A7=20chore?= =?UTF-8?q?(chains.mdx):=20fix=20formatting=20and=20indentation=20for=20be?= =?UTF-8?q?tter=20code=20readability=20=F0=9F=94=A7=20chore(chains.mdx):?= =?UTF-8?q?=20update=20verbose=20parameter=20description=20to=20improve=20?= =?UTF-8?q?clarity=20=F0=9F=94=A7=20chore(chains.mdx):=20fix=20formatting?= =?UTF-8?q?=20and=20indentation=20for=20better=20code=20readability=20?= =?UTF-8?q?=F0=9F=94=A7=20chore(chains.mdx):=20update=20verbose=20paramete?= =?UTF-8?q?r=20description=20to=20improve=20clarity=20=F0=9F=94=A7=20chore?= =?UTF-8?q?(chains.mdx):=20fix=20formatting=20and=20indentation=20for=20be?= =?UTF-8?q?tter=20code=20readability=20=F0=9F=94=A7=20chore(chains.mdx):?= =?UTF-8?q?=20update=20verbose=20parameter=20description=20to=20improve=20?= =?UTF-8?q?clarity=20=F0=9F=94=A7=20chore(chains.mdx):=20fix=20formatting?= =?UTF-8?q?=20and=20indentation=20for=20better=20code=20readability=20?= =?UTF-8?q?=F0=9F=94=A7=20chore(chains.mdx):=20update=20verbose=20paramete?= =?UTF-8?q?r=20description=20to=20improve=20clarity=20=F0=9F=94=A7=20chore?= =?UTF-8?q?(chains.mdx):=20fix=20formatting=20and=20indentation=20for=20be?= =?UTF-8?q?tter=20code=20readability=20=F0=9F=94=A7=20chore(chains.mdx):?= =?UTF-8?q?=20update=20verbose=20parameter=20description=20to=20improve=20?= =?UTF-8?q?clarity=20=F0=9F=94=A7=20chore(chains.mdx):=20fix=20formatting?= =?UTF-8?q?=20and=20indentation=20for=20better=20code=20readability=20?= =?UTF-8?q?=F0=9F=94=A7=20chore(chains.mdx):=20update=20verbose=20paramete?= =?UTF-8?q?r=20description=20to=20improve=20clarity=20=F0=9F=94=A7=20chore?= =?UTF-8?q?(chains.mdx):=20fix=20formatting=20and=20indentation=20for=20be?= =?UTF-8?q?tter=20code=20readability=20=F0=9F=94=A7=20chore(chains.mdx):?= =?UTF-8?q?=20update=20verbose=20parameter=20description=20to=20improve=20?= =?UTF-8?q?clarity=20=F0=9F=94=A7=20chore(chains.mdx):=20fix=20formatting?= =?UTF-8?q?=20and=20indentation=20for=20better=20code=20readability=20?= =?UTF-8?q?=F0=9F=94=A7=20chore(chains.mdx):=20update=20verbose=20paramete?= =?UTF-8?q?r=20description=20to=20improve=20clarity=20=F0=9F=94=A7=20chore?= =?UTF-8?q?(chains.mdx):=20fix=20formatting=20and=20indentation=20for=20be?= =?UTF-8?q?tter=20code=20readability=20=F0=9F=94=A7=20chore(chains.mdx):?= =?UTF-8?q?=20update=20verbose=20parameter=20description=20to=20improve=20?= =?UTF-8?q?clarity=20=F0=9F=94=A7=20chore(chains.mdx):=20fix=20formatting?= =?UTF-8?q?=20and=20indentation=20for=20better=20code=20readability=20?= =?UTF-8?q?=F0=9F=94=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ“ chore(docs): update import statements for Admonition component in examples πŸ“ chore(docs): update link in Prompts component to use Admonition component πŸ“ chore(docs): update import statements for Admonition component in examples πŸ“ chore(docs): update link in Conversation Chain component to use Admonition component πŸ“ chore(docs): update import statements for Admonition component in examples πŸ“ chore(docs): update link in CSV Loader component to use Admonition component πŸ“ chore(docs): update import statements for Admonition component in examples πŸ“ chore(docs): update link in MidJourney Prompt Chain component to use Admonition component πŸ“ chore(docs): update import statements for Admonition component in examples πŸ“ chore(docs): update link in Multiple Vector Stores component to use Admonition component πŸ“ docs(examples/python-function.mdx): add import statement for Admonition component πŸ“ docs(examples/python-function.mdx): improve readability of tip admonition by breaking lines πŸ“ docs(examples/python-function.mdx): improve readability of info admonition by breaking lines πŸ“ docs(examples/serp-api-tool.mdx): add import statement for Admonition component πŸ“ docs(examples/serp-api-tool.mdx): improve readability of info admonition by breaking lines πŸ“ docs(guidelines/features.mdx): add import statement for Admonition component πŸ“ docs(guidelines/features.mdx): improve readability of caution admonition by breaking lines --- docs/docs/components/chains.mdx | 41 ++++++++++--------- docs/docs/components/prompts.mdx | 12 ++++-- docs/docs/examples/buffer-memory.mdx | 7 +++- docs/docs/examples/conversation-chain.mdx | 13 ++++-- docs/docs/examples/csv-loader.mdx | 24 +++++++---- .../docs/examples/midjourney-prompt-chain.mdx | 15 ++++--- docs/docs/examples/multiple-vectorstores.mdx | 27 +++++++----- docs/docs/examples/python-function.mdx | 23 +++++++---- docs/docs/examples/serp-api-tool.mdx | 28 ++++++++----- docs/docs/guidelines/features.mdx | 6 ++- 10 files changed, 122 insertions(+), 74 deletions(-) diff --git a/docs/docs/components/chains.mdx b/docs/docs/components/chains.mdx index 52de6c481..96dcac2d0 100644 --- a/docs/docs/components/chains.mdx +++ b/docs/docs/components/chains.mdx @@ -1,6 +1,7 @@ import ThemedImage from "@theme/ThemedImage"; import useBaseUrl from "@docusaurus/useBaseUrl"; import ZoomableImage from "/src/theme/ZoomableImage.js"; +import Admonition from "@theme/Admonition"; # Chains @@ -12,22 +13,23 @@ Chains, in the context of language models, refer to a series of calls made to a The `CombineDocsChain` incorporates methods to combine or aggregate loaded documents for question-answering functionality. -:::info + Works as a proxy of LangChain’s [documents](https://python.langchain.com/docs/modules/chains/document/) chains generated by the `load_qa_chain` function. -::: + **Params** - **LLM:** Language Model to use in the chain. - **chain_type:** The chain type to be used. Each one of them applies a different β€œcombination strategy”. - - **stuff**: The stuff [documents](https://python.langchain.com/docs/modules/chains/document/stuff) chain (β€œstuff" as in "to stuff" or "to fill") is the most straightforward of *the* document chains. It takes a list of documents, inserts them all into a prompt, and passes that prompt to an LLM. This chain is well-suited for applications where documents are small and only a few are passed in for most calls. - - **map_reduce**: The map-reduce [documents](https://python.langchain.com/docs/modules/chains/document/map_reduce) chain first applies an LLM chain to each document individually (the Map step), treating the chain output as a new document. It then passes all the new documents to a separate combined documents chain to get a single output (the Reduce step). It can optionally first compress or collapse the mapped documents to make sure that they fit in the combined documents chain (which will often pass them to an LLM). This compression step is performed recursively if necessary. - - **map_rerank**: The map re-rank [documents](https://python.langchain.com/docs/modules/chains/document/map_rerank) chain runs an initial prompt on each document that not only tries to complete a task but also gives a score for how certain it is in its answer. The highest-scoring response is returned. - - **refine**: The refine [documents](https://python.langchain.com/docs/modules/chains/document/refine) chain constructs a response by looping over the input documents and iteratively updating its answer. For each document, it passes all non-document inputs, the current document, and the latest intermediate answer to an LLM chain to get a new answer. - Since the Refine chain only passes a single document to the LLM at a time, it is well-suited for tasks that require analyzing more documents than can fit in the model's context. The obvious tradeoff is that this chain will make far more LLM calls than, for example, the Stuff documents chain. There are also certain tasks that are difficult to accomplish iteratively. For example, the Refine chain can perform poorly when documents frequently cross-reference one another or when a task requires detailed information from many documents. + - **stuff**: The stuff [documents](https://python.langchain.com/docs/modules/chains/document/stuff) chain (β€œstuff" as in "to stuff" or "to fill") is the most straightforward of _the_ document chains. It takes a list of documents, inserts them all into a prompt, and passes that prompt to an LLM. This chain is well-suited for applications where documents are small and only a few are passed in for most calls. + - **map_reduce**: The map-reduce [documents](https://python.langchain.com/docs/modules/chains/document/map_reduce) chain first applies an LLM chain to each document individually (the Map step), treating the chain output as a new document. It then passes all the new documents to a separate combined documents chain to get a single output (the Reduce step). It can optionally first compress or collapse the mapped documents to make sure that they fit in the combined documents chain (which will often pass them to an LLM). This compression step is performed recursively if necessary. + - **map_rerank**: The map re-rank [documents](https://python.langchain.com/docs/modules/chains/document/map_rerank) chain runs an initial prompt on each document that not only tries to complete a task but also gives a score for how certain it is in its answer. The highest-scoring response is returned. + - **refine**: The refine [documents](https://python.langchain.com/docs/modules/chains/document/refine) chain constructs a response by looping over the input documents and iteratively updating its answer. For each document, it passes all non-document inputs, the current document, and the latest intermediate answer to an LLM chain to get a new answer. + + Since the Refine chain only passes a single document to the LLM at a time, it is well-suited for tasks that require analyzing more documents than can fit in the model's context. The obvious tradeoff is that this chain will make far more LLM calls than, for example, the Stuff documents chain. There are also certain tasks that are difficult to accomplish iteratively. For example, the Refine chain can perform poorly when documents frequently cross-reference one another or when a task requires detailed information from many documents. --- @@ -41,7 +43,7 @@ The `ConversationChain` is a straightforward chain for interactive conversations - **Memory:** Default memory store. - **input_key:** Used to specify the key under which the user input will be stored in the conversation memory. It allows you to provide the user's input to the chain for processing and generating a response. - **output_key:** Used to specify the key under which the generated response will be stored in the conversation memory. It allows you to retrieve the response using the specified key. -- **verbose:** This parameter is used to control the level of detail in the output of the chain. When set to True, it will print out some internal states of the chain while it is being run, which can be helpful for debugging and understanding the chain's behavior. If set to False, it will suppress the verbose output β€” defaults to `False`. +- **verbose:** This parameter is used to control the level of detail in the output of the chain. When set to True, it will print out some internal states of the chain while it is being run, which can be helpful for debugging and understanding the chain's behavior. If set to False, it will suppress the verbose output β€” defaults to `False`. --- @@ -49,11 +51,11 @@ The `ConversationChain` is a straightforward chain for interactive conversations The `ConversationalRetrievalChain` extracts information and provides answers by combining document search and question-answering abilities. -:::info + A retriever is a component that finds documents based on a query. It doesn't store the documents themselves, but it returns the ones that match the query. -::: + **Params** @@ -61,12 +63,13 @@ A retriever is a component that finds documents based on a query. It doesn't sto - **Memory:** Default memory store. - **Retriever:** The retriever used to fetch relevant documents. - **chain_type:** The chain type to be used. Each one of them applies a different β€œcombination strategy”. - - **stuff**: The stuff [documents](https://python.langchain.com/docs/modules/chains/document/stuff) chain (β€œstuff" as in "to stuff" or "to fill") is the most straightforward of *the* document chains. It takes a list of documents, inserts them all into a prompt, and passes that prompt to an LLM. This chain is well-suited for applications where documents are small and only a few are passed in for most calls. - - **map_reduce**: The map-reduce [documents](https://python.langchain.com/docs/modules/chains/document/map_reduce) chain first applies an LLM chain to each document individually (the Map step), treating the chain output as a new document. It then passes all the new documents to a separate combined documents chain to get a single output (the Reduce step). It can optionally first compress or collapse the mapped documents to make sure that they fit in the combined documents chain (which will often pass them to an LLM). This compression step is performed recursively if necessary. - - **map_rerank**: The map re-rank [documents](https://python.langchain.com/docs/modules/chains/document/map_rerank) chain runs an initial prompt on each document that not only tries to complete a task but also gives a score for how certain it is in its answer. The highest-scoring response is returned. - - **refine**: The refine [documents](https://python.langchain.com/docs/modules/chains/document/refine) chain constructs a response by looping over the input documents and iteratively updating its answer. For each document, it passes all non-document inputs, the current document, and the latest intermediate answer to an LLM chain to get a new answer. - Since the Refine chain only passes a single document to the LLM at a time, it is well-suited for tasks that require analyzing more documents than can fit in the model's context. The obvious tradeoff is that this chain will make far more LLM calls than, for example, the Stuff documents chain. There are also certain tasks that are difficult to accomplish iteratively. For example, the Refine chain can perform poorly when documents frequently cross-reference one another or when a task requires detailed information from many documents. + - **stuff**: The stuff [documents](https://python.langchain.com/docs/modules/chains/document/stuff) chain (β€œstuff" as in "to stuff" or "to fill") is the most straightforward of _the_ document chains. It takes a list of documents, inserts them all into a prompt, and passes that prompt to an LLM. This chain is well-suited for applications where documents are small and only a few are passed in for most calls. + - **map_reduce**: The map-reduce [documents](https://python.langchain.com/docs/modules/chains/document/map_reduce) chain first applies an LLM chain to each document individually (the Map step), treating the chain output as a new document. It then passes all the new documents to a separate combined documents chain to get a single output (the Reduce step). It can optionally first compress or collapse the mapped documents to make sure that they fit in the combined documents chain (which will often pass them to an LLM). This compression step is performed recursively if necessary. + - **map_rerank**: The map re-rank [documents](https://python.langchain.com/docs/modules/chains/document/map_rerank) chain runs an initial prompt on each document that not only tries to complete a task but also gives a score for how certain it is in its answer. The highest-scoring response is returned. + - **refine**: The refine [documents](https://python.langchain.com/docs/modules/chains/document/refine) chain constructs a response by looping over the input documents and iteratively updating its answer. For each document, it passes all non-document inputs, the current document, and the latest intermediate answer to an LLM chain to get a new answer. + + Since the Refine chain only passes a single document to the LLM at a time, it is well-suited for tasks that require analyzing more documents than can fit in the model's context. The obvious tradeoff is that this chain will make far more LLM calls than, for example, the Stuff documents chain. There are also certain tasks that are difficult to accomplish iteratively. For example, the Refine chain can perform poorly when documents frequently cross-reference one another or when a task requires detailed information from many documents. - **return_source_documents:** Used to specify whether or not to include the source documents that were used to answer the question in the output. When set to `True`, source documents will be included in the output along with the generated answer. This can be useful for providing additional context or references to the user β€” defaults to `True`. - **verbose:** Whether or not to run in verbose mode. In verbose mode, intermediate logs will be printed to the console β€” defaults to `False`. @@ -108,17 +111,17 @@ The `LLMMathChain` works by using the language model with an `LLMChain` to under `RetrievalQA` is a chain used to find relevant documents or information to answer a given query. The retriever is responsible for returning the relevant documents based on the query, and the QA component then extracts the answer from those documents. The retrieval QA system combines the capabilities of both the retriever and the QA component to provide accurate and relevant answers to user queries. -:::info + A retriever is a component that finds documents based on a query. It doesn't store the documents themselves, but it returns the ones that match the query. -::: + **Params** - **Combine Documents Chain:** Chain to use to combine the documents. - **Memory:** Default memory store. -- **Retriever:** The retriever used to fetch relevant documents. +- **Retriever:** The retriever used to fetch relevant documents. - **input_key:** This parameter is used to specify the key in the input data that contains the question. It is used to retrieve the question from the input data and pass it to the question-answering model for generating the answer β€” defaults to `query`. - **output_key:** This parameter is used to specify the key in the output data where the generated answer will be stored. It is used to retrieve the answer from the output data after the question-answering model has generated it β€” defaults to `result`. - **return_source_documents:** Used to specify whether or not to include the source documents that were used to answer the question in the output. When set to `True`, source documents will be included in the output along with the generated answer. This can be useful for providing additional context or references to the user β€” defaults to `True`. @@ -134,4 +137,4 @@ The `SQLDatabaseChain` finds answers to questions using a SQL database. It works - **Db:** SQL Database to connect to. - **LLM:** Language Model to use in the chain. -- **Prompt:** Prompt template to translate natural language to SQL. \ No newline at end of file +- **Prompt:** Prompt template to translate natural language to SQL. diff --git a/docs/docs/components/prompts.mdx b/docs/docs/components/prompts.mdx index f4f2c4cae..0c7257272 100644 --- a/docs/docs/components/prompts.mdx +++ b/docs/docs/components/prompts.mdx @@ -1,3 +1,5 @@ +import Admonition from "@theme/Admonition"; + # Prompts A prompt refers to the input given to a language model. It is constructed from multiple components and can be parametrized using prompt templates. A prompt template is a reproducible way to generate prompts and allow for easy customization through input variables. @@ -8,8 +10,10 @@ A prompt refers to the input given to a language model. It is constructed from m The `PromptTemplate` component allows users to create prompts and define variables that provide control over instructing the model. The template can take in a set of variables from the end user and generates the prompt once the conversation is initiated. -:::info -Once a variable is defined in the prompt template, it becomes a component input of its own. Check out [Prompt Customization](../guidelines/prompt-customization.mdx) to learn more. -::: + + Once a variable is defined in the prompt template, it becomes a component + input of its own. Check out [Prompt + Customization](../guidelines/prompt-customization.mdx) to learn more. + -- **template:** Template used to format an individual request. \ No newline at end of file +- **template:** Template used to format an individual request. diff --git a/docs/docs/examples/buffer-memory.mdx b/docs/docs/examples/buffer-memory.mdx index c3e886cf9..d34649991 100644 --- a/docs/docs/examples/buffer-memory.mdx +++ b/docs/docs/examples/buffer-memory.mdx @@ -1,3 +1,5 @@ +import Admonition from "@theme/Admonition"; + # Buffer Memory For certain applications, retaining past interactions is crucial. For that, chains and agents may accept a memory component as one of their input parameters. The `ConversationBufferMemory` component is one of them. It stores messages and extracts them into variables. @@ -17,9 +19,10 @@ import ZoomableImage from "/src/theme/ZoomableImage.js"; #### Download Flow -:::note LangChain Components πŸ¦œπŸ”— + - [`ConversationBufferMemory`](https://python.langchain.com/docs/modules/memory/how_to/buffer) - [`ConversationChain`](https://python.langchain.com/docs/modules/chains/) - [`ChatOpenAI`](https://python.langchain.com/docs/modules/model_io/models/chat/integrations/openai) - ::: + + diff --git a/docs/docs/examples/conversation-chain.mdx b/docs/docs/examples/conversation-chain.mdx index b8cbb11bb..db3181881 100644 --- a/docs/docs/examples/conversation-chain.mdx +++ b/docs/docs/examples/conversation-chain.mdx @@ -1,10 +1,14 @@ +import Admonition from "@theme/Admonition"; + # Conversation Chain This example shows how to instantiate a simple `ConversationChain` component using a Language Model (LLM). Once the Node Status turns green 🟒, the chat will be ready to take in user messages. Here, we used `ChatOpenAI` to act as the required LLM input, but you can use any LLM for this purpose. -:::info + + Make sure to always get the API key from the provider. -::: + + ## ⛓️ Langflow Example @@ -21,8 +25,9 @@ import ZoomableImage from "/src/theme/ZoomableImage.js"; #### Download Flow -:::note LangChain Components πŸ¦œπŸ”— + - [`ConversationChain`](https://python.langchain.com/docs/modules/chains/) - [`ChatOpenAI`](https://python.langchain.com/docs/modules/model_io/models/chat/integrations/openai) - ::: + + diff --git a/docs/docs/examples/csv-loader.mdx b/docs/docs/examples/csv-loader.mdx index de808ec3d..c59dfc1e7 100644 --- a/docs/docs/examples/csv-loader.mdx +++ b/docs/docs/examples/csv-loader.mdx @@ -1,3 +1,5 @@ +import Admonition from "@theme/Admonition"; + # CSV Loader The `VectoStoreAgent` component retrieves information from one or more vector stores. This example shows a `VectoStoreAgent` connected to a CSV file through the `Chroma` vector store. Process description: @@ -7,13 +9,18 @@ The `VectoStoreAgent` component retrieves information from one or more vector st - These chunks feed the `Chroma` vector store, which converts them into vectors and stores them for fast indexing. - Finally, the agent accesses the information of the vector store through the `VectorStoreInfo` tool. -:::info -The vector store is used for efficient semantic search, while `VectorStoreInfo` carries information about it, such as its name and description. Embeddings are a way to represent words, phrases, or any entities in a vector space. Learn more about them [here](https://platform.openai.com/docs/guides/embeddings/what-are-embeddings). -::: + + The vector store is used for efficient semantic search, while + `VectorStoreInfo` carries information about it, such as its name and + description. Embeddings are a way to represent words, phrases, or any entities + in a vector space. Learn more about them + [here](https://platform.openai.com/docs/guides/embeddings/what-are-embeddings). + -:::tip -Once you build this flow, ask questions about the data in the chat interface (e.g., number of rows or columns). -::: + + Once you build this flow, ask questions about the data in the chat interface + (e.g., number of rows or columns). + ## ⛓️ Langflow Example @@ -30,7 +37,7 @@ import ZoomableImage from "/src/theme/ZoomableImage.js"; #### Download Flow -:::note LangChain Components πŸ¦œπŸ”— + - [`CSVLoader`](https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/csv) - [`CharacterTextSplitter`](https://python.langchain.com/docs/modules/data_connection/document_transformers/text_splitters/character_text_splitter) @@ -39,4 +46,5 @@ import ZoomableImage from "/src/theme/ZoomableImage.js"; - [`VectorStoreInfo`](https://python.langchain.com/docs/modules/data_connection/vectorstores/) - [`OpenAI`](https://python.langchain.com/docs/modules/model_io/models/llms/integrations/openai) - [`VectorStoreAgent`](https://python.langchain.com/docs/modules/agents/toolkits/vectorstore) - ::: + + diff --git a/docs/docs/examples/midjourney-prompt-chain.mdx b/docs/docs/examples/midjourney-prompt-chain.mdx index d3ca57c91..c79bb0b27 100644 --- a/docs/docs/examples/midjourney-prompt-chain.mdx +++ b/docs/docs/examples/midjourney-prompt-chain.mdx @@ -1,3 +1,5 @@ +import Admonition from "@theme/Admonition"; + # MidJourney Prompt Chain The `MidJourneyPromptChain` can be used to generate imaginative and detailed MidJourney prompts. @@ -14,9 +16,11 @@ And get a response such as: Imagine a mysterious forest, the trees are tall and ancient, their branches reaching up to the sky. Through the darkness, a dragon emerges from the shadows, its scales shimmering in the moonlight. Its wingspan is immense, and its eyes glow with a fierce intensity. It is a majestic and powerful creature, one that commands both respect and fear. ``` -:::tip -Notice that the `ConversationSummaryMemory` stores a summary of the conversation over time. Try using it to create better prompts as the conversation goes on. -::: + + Notice that the `ConversationSummaryMemory` stores a summary of the + conversation over time. Try using it to create better prompts as the + conversation goes on. + ## ⛓️ Langflow Example @@ -33,8 +37,9 @@ import ZoomableImage from "/src/theme/ZoomableImage.js"; #### Download Flow -:::note LangChain Components πŸ¦œπŸ”— + - [`OpenAI`](https://python.langchain.com/docs/modules/model_io/models/llms/integrations/openai) - [`ConversationSummaryMemory`](https://python.langchain.com/docs/modules/memory/how_to/summary) - ::: + + diff --git a/docs/docs/examples/multiple-vectorstores.mdx b/docs/docs/examples/multiple-vectorstores.mdx index 36890c866..0bb6b9ade 100644 --- a/docs/docs/examples/multiple-vectorstores.mdx +++ b/docs/docs/examples/multiple-vectorstores.mdx @@ -1,12 +1,15 @@ +import Admonition from "@theme/Admonition"; + # Multiple Vector Stores The example below shows an agent operating with two vector stores built upon different data sources. The `TextLoader` loads a TXT file, while the `WebBaseLoader` pulls text from webpages into a document format to accessed downstream. The `Chroma` vector stores are created analogous to what we have demonstrated in our [CSV Loader](/examples/csv-loader.mdx) example. Finally, the `VectorStoreRouterAgent` constructs an agent that routes between the vector stores. -:::info -Get the TXT file used [here](https://github.com/hwchase17/chat-your-data/blob/master/state_of_the_union.txt). -::: + + Get the TXT file used + [here](https://github.com/hwchase17/chat-your-data/blob/master/state_of_the_union.txt). + URL used by the `WebBaseLoader`: @@ -14,13 +17,15 @@ URL used by the `WebBaseLoader`: https://pt.wikipedia.org/wiki/Harry_Potter ``` -:::tip -When you build the flow, request information about one of the sources. The agent should be able to use the correct source to generate a response. -::: + + When you build the flow, request information about one of the sources. The + agent should be able to use the correct source to generate a response. + -:::info -Learn more about Multiple Vector Stores [here](https://python.langchain.com/docs/modules/agents/toolkits/vectorstore?highlight=Multiple%20Vector%20Stores#multiple-vectorstores). -::: + + Learn more about Multiple Vector Stores + [here](https://python.langchain.com/docs/modules/agents/toolkits/vectorstore?highlight=Multiple%20Vector%20Stores#multiple-vectorstores). + ## ⛓️ Langflow Example @@ -37,7 +42,7 @@ import ZoomableImage from "/src/theme/ZoomableImage.js"; #### Download Flow -:::note LangChain Components πŸ¦œπŸ”— + - [`WebBaseLoader`](https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/web_base) - [`TextLoader`](https://python.langchain.com/docs/modules/data_connection/document_loaders/integrations/unstructured_file) @@ -49,4 +54,4 @@ import ZoomableImage from "/src/theme/ZoomableImage.js"; - [`VectorStoreRouterToolkit`](https://python.langchain.com/docs/modules/agents/toolkits/vectorstore) - [`VectorStoreRouterAgent`](https://python.langchain.com/docs/modules/agents/toolkits/vectorstore) -::: + diff --git a/docs/docs/examples/python-function.mdx b/docs/docs/examples/python-function.mdx index 12a262a3f..f537075c6 100644 --- a/docs/docs/examples/python-function.mdx +++ b/docs/docs/examples/python-function.mdx @@ -1,3 +1,5 @@ +import Admonition from "@theme/Admonition"; + # Python Function Langflow allows you to create a customized tool using the `PythonFunction` connected to a `Tool` component. In this example, Regex is used in Python to validate a pattern. @@ -15,15 +17,19 @@ def is_brazilian_zipcode(zipcode: str) -> bool: return False ``` -:::tip -When a tool is called, it is often desirable to have its output returned directly to the user. You can do this by setting the **return_direct** flag for a tool to be True. -::: + + When a tool is called, it is often desirable to have its output returned + directly to the user. You can do this by setting the **return_direct** flag + for a tool to be True. + The `AgentInitializer` component is a quick way to construct an agent from the model and tools. -:::info -The `PythonFunction` is a custom component that uses the LangChain πŸ¦œπŸ”— tool decorator. Learn more about it [here](https://python.langchain.com/docs/modules/agents/tools/how_to/custom_tools). -::: + + The `PythonFunction` is a custom component that uses the LangChain πŸ¦œπŸ”— tool + decorator. Learn more about it + [here](https://python.langchain.com/docs/modules/agents/tools/how_to/custom_tools). + ## ⛓️ Langflow Example @@ -40,9 +46,10 @@ import ZoomableImage from "/src/theme/ZoomableImage.js"; #### Download Flow -:::note LangChain Components πŸ¦œπŸ”— + - [`PythonFunctionTool`](https://python.langchain.com/docs/modules/agents/tools/how_to/custom_tools) - [`ChatOpenAI`](https://python.langchain.com/docs/modules/model_io/models/chat/integrations/openai) - [`AgentInitializer`](https://python.langchain.com/docs/modules/agents/) - ::: + + diff --git a/docs/docs/examples/serp-api-tool.mdx b/docs/docs/examples/serp-api-tool.mdx index a7e1d3d8e..60e55791a 100644 --- a/docs/docs/examples/serp-api-tool.mdx +++ b/docs/docs/examples/serp-api-tool.mdx @@ -1,24 +1,29 @@ +import Admonition from "@theme/Admonition"; + # Serp API Tool The [Serp API](https://serpapi.com/) (Search Engine Results Page) allows developers to scrape results from search engines such as Google, Bing and Yahoo, and can be used as in Langflow through the `Search` component. -:::info -To use the Serp API, you first need to sign up [Serp API](https://serpapi.com/) for an API key on the provider's website. -::: + + To use the Serp API, you first need to sign up [Serp + API](https://serpapi.com/) for an API key on the provider's website. + Here, the `ZeroShotPrompt` component specifies a prompt template for the `ZeroShotAgent`. Set a _Prefix_ and _Suffix_ with rules for the agent to obey. In the example, we used default templates. The `LLMChain` is a simple chain that takes in a prompt template, formats it with the user input, and returns the response from an LLM. -:::tip -In this example, we used [`ChatOpenAI`](https://platform.openai.com/) as the LLM, but feel free to experiment with other Language Models! -::: + + In this example, we used [`ChatOpenAI`](https://platform.openai.com/) as the + LLM, but feel free to experiment with other Language Models! + The `ZeroShotAgent` takes the `LLMChain` and the `Search` tool as inputs, using the tool to find information when necessary. -:::info -Learn more about the Serp API [here](https://python.langchain.com/docs/modules/agents/tools/integrations/serpapi). -::: + + Learn more about the Serp API + [here](https://python.langchain.com/docs/modules/agents/tools/integrations/serpapi). + ## ⛓️ Langflow Example @@ -35,11 +40,12 @@ import ZoomableImage from "/src/theme/ZoomableImage.js"; #### Download Flow -:::note LangChain Components πŸ¦œπŸ”— + - [`ZeroShotPrompt`](https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/) - [`OpenAI`](https://python.langchain.com/docs/modules/model_io/models/llms/integrations/openai) - [`LLMChain`](https://python.langchain.com/docs/modules/chains/foundational/llm_chain) - [`Search`](https://python.langchain.com/docs/modules/agents/tools/integrations/serpapi) - [`ZeroShotAgent`](https://python.langchain.com/docs/modules/agents/how_to/custom_mrkl_agent) - ::: + + diff --git a/docs/docs/guidelines/features.mdx b/docs/docs/guidelines/features.mdx index cf8b09c6e..18bd0bd75 100644 --- a/docs/docs/guidelines/features.mdx +++ b/docs/docs/guidelines/features.mdx @@ -2,6 +2,7 @@ import ThemedImage from "@theme/ThemedImage"; import useBaseUrl from "@docusaurus/useBaseUrl"; import ZoomableImage from "/src/theme/ZoomableImage.js"; import ReactPlayer from "react-player"; +import Admonition from "@theme/Admonition"; # Features @@ -34,9 +35,10 @@ import ReactPlayer from "react-player"; Flows can be exported and imported as JSON files. -:::caution + Watch out for API keys being stored in local files. -::: + + ---