🔧 chore(chains.mdx): add import statement for Admonition component to improve code organization and readability

🔧 chore(chains.mdx): fix formatting and indentation for better code readability
🔧 chore(chains.mdx): update verbose parameter description to improve clarity
🔧 chore(chains.mdx): fix formatting and indentation for better code readability
🔧 chore(chains.mdx): update verbose parameter description to improve clarity
🔧 chore(chains.mdx): fix formatting and indentation for better code readability
🔧 chore(chains.mdx): update verbose parameter description to improve clarity
🔧 chore(chains.mdx): fix formatting and indentation for better code readability
🔧 chore(chains.mdx): update verbose parameter description to improve clarity
🔧 chore(chains.mdx): fix formatting and indentation for better code readability
🔧 chore(chains.mdx): update verbose parameter description to improve clarity
🔧 chore(chains.mdx): fix formatting and indentation for better code readability
🔧 chore(chains.mdx): update verbose parameter description to improve clarity
🔧 chore(chains.mdx): fix formatting and indentation for better code readability
🔧 chore(chains.mdx): update verbose parameter description to improve clarity
🔧 chore(chains.mdx): fix formatting and indentation for better code readability
🔧 chore(chains.mdx): update verbose parameter description to improve clarity
🔧 chore(chains.mdx): fix formatting and indentation for better code readability
🔧 chore(chains.mdx): update verbose parameter description to improve clarity
🔧 chore(chains.mdx): fix formatting and indentation for better code readability
🔧 chore(chains.mdx): update verbose parameter description to improve clarity
🔧 chore(chains.mdx): fix formatting and indentation for better code readability
🔧 chore(chains.mdx): update verbose parameter description to improve clarity
🔧 chore(chains.mdx): fix formatting and indentation for better code readability
🔧 chore(chains.mdx): update verbose parameter description to improve clarity
🔧 chore(chains.mdx): fix formatting and indentation for better code readability
🔧 chore(chains.mdx): update verbose parameter description to improve clarity
🔧 chore(chains.mdx): fix formatting and indentation for better code readability
🔧

📝 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
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-07-26 14:42:48 -03:00
commit 8ac890c553
10 changed files with 122 additions and 74 deletions

View file

@ -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";
#### <a target="\_blank" href="json_files/Buffer_Memory.json" download>Download Flow</a>
:::note LangChain Components 🦜🔗
<Admonition type="note" title="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)
:::
</Admonition>

View file

@ -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
<Admonition type="info">
Make sure to always get the API key from the provider.
:::
</Admonition>
## ⛓️ Langflow Example
@ -21,8 +25,9 @@ import ZoomableImage from "/src/theme/ZoomableImage.js";
#### <a target="\_blank" href="json_files/Basic_Chat.json" download>Download Flow</a>
:::note LangChain Components 🦜🔗
<Admonition type="note" title="LangChain Components 🦜🔗">
- [`ConversationChain`](https://python.langchain.com/docs/modules/chains/)
- [`ChatOpenAI`](https://python.langchain.com/docs/modules/model_io/models/chat/integrations/openai)
:::
</Admonition>

View file

@ -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).
:::
<Admonition type="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).
</Admonition>
:::tip
Once you build this flow, ask questions about the data in the chat interface (e.g., number of rows or columns).
:::
<Admonition type="tip">
Once you build this flow, ask questions about the data in the chat interface
(e.g., number of rows or columns).
</Admonition>
## ⛓️ Langflow Example
@ -30,7 +37,7 @@ import ZoomableImage from "/src/theme/ZoomableImage.js";
#### <a target="\_blank" href="json_files/CSV_Loader.json" download>Download Flow</a>
:::note LangChain Components 🦜🔗
<Admonition type="note" title="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)
:::
</Admonition>

View file

@ -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.
:::
<Admonition type="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.
</Admonition>
## ⛓️ Langflow Example
@ -33,8 +37,9 @@ import ZoomableImage from "/src/theme/ZoomableImage.js";
#### <a target="\_blank" href="json_files/MidJourney_Prompt_Chain.json" download>Download Flow</a>
:::note LangChain Components 🦜🔗
<Admonition type="note" title="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)
:::
</Admonition>

View file

@ -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).
:::
<Admonition type="info">
Get the TXT file used
[here](https://github.com/hwchase17/chat-your-data/blob/master/state_of_the_union.txt).
</Admonition>
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.
:::
<Admonition type="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.
</Admonition>
:::info
Learn more about Multiple Vector Stores [here](https://python.langchain.com/docs/modules/agents/toolkits/vectorstore?highlight=Multiple%20Vector%20Stores#multiple-vectorstores).
:::
<Admonition type="info">
Learn more about Multiple Vector Stores
[here](https://python.langchain.com/docs/modules/agents/toolkits/vectorstore?highlight=Multiple%20Vector%20Stores#multiple-vectorstores).
</Admonition>
## ⛓️ Langflow Example
@ -37,7 +42,7 @@ import ZoomableImage from "/src/theme/ZoomableImage.js";
#### <a target="\_blank" href="json_files/Multiple_Vector_Stores.json" download>Download Flow</a>
:::note LangChain Components 🦜🔗
<Admonition type="note" title="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)
:::
</Admonition>

View file

@ -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.
:::
<Admonition type="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.
</Admonition>
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).
:::
<Admonition type="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).
</Admonition>
## ⛓️ Langflow Example
@ -40,9 +46,10 @@ import ZoomableImage from "/src/theme/ZoomableImage.js";
#### <a target="\_blank" href="json_files/Python_Function.json" download>Download Flow</a>
:::note LangChain Components 🦜🔗
<Admonition type="note" title="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/)
:::
</Admonition>

View file

@ -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.
:::
<Admonition type="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.
</Admonition>
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!
:::
<Admonition type="tip">
In this example, we used [`ChatOpenAI`](https://platform.openai.com/) as the
LLM, but feel free to experiment with other Language Models!
</Admonition>
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).
:::
<Admonition type="info">
Learn more about the Serp API
[here](https://python.langchain.com/docs/modules/agents/tools/integrations/serpapi).
</Admonition>
## ⛓️ Langflow Example
@ -35,11 +40,12 @@ import ZoomableImage from "/src/theme/ZoomableImage.js";
#### <a target="\_blank" href="json_files/SerpAPI_Tool.json" download>Download Flow</a>
:::note LangChain Components 🦜🔗
<Admonition type="note" title="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)
:::
</Admonition>