docs: added fetching from notion (#2670)

* Added new Docusaurus instance that fetches automatically from Notion

* Add Github workflow to fetch docs from Notion

* Added legacy peer deps to solve dependency problems

* Fix git ignore and added pages
This commit is contained in:
Lucas Oliveira 2024-07-12 17:59:52 -03:00 • committed by GitHub
commit 3aa2513a86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
354 changed files with 20640 additions and 23291 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 KiB

View file

@ -0,0 +1 @@
{"position":2, "label":"Starter Projects"}

View file

@ -0,0 +1,60 @@
---
title: Basic Prompting
sidebar_position: 0
slug: /starter-projects-basic-prompting
---
Prompts serve as the inputs to a large language model (LLM), acting as the interface between human instructions and computational tasks.
By submitting natural language requests in a prompt to an LLM, you can obtain answers, generate text, and solve problems.
This article demonstrates how to use Langflow's prompt tools to issue basic prompts to an LLM, and how various prompting strategies can affect your outcomes.
## Prerequisites {#20bd7bc51ce04e2fb4922c95f00870d3}
- [Langflow installed and running](/getting-started-installation)
- [OpenAI API key created](https://platform.openai.com/)
## Create the basic prompting project {#19d5305239c841548a695e2bf7839e7a}
1. From the Langflow dashboard, click **New Project**.
![](./1835734464.png)
1. Select **Basic Prompting**.
2. The **Basic Prompting** flow is created.
![](./487525520.png)
This flow allows you to chat with the **OpenAI** component through the **Prompt** component.
Examine the **Prompt** component. The **Template** field instructs the LLM to `Answer the user as if you were a pirate.` This should be interesting...
![](./690736575.png)
1. To create an environment variable for the **OpenAI** component, in the **OpenAI API Key** field, click the **Globe** button, and then click **Add New Variable**.
1. In the **Variable Name** field, enter `openai_api_key`.
2. In the **Value** field, paste your OpenAI API Key (`sk-...`).
3. Click **Save Variable**.
![](./1390293355.png)
## Run {#ce52f8e6b491452a9dfb069feb962eed}
1. Click the **Playground** button on the control panel (bottom right side of the workspace). This is where you can interact with your AI.
2. Type a message and press Enter. The bot should respond in a markedly piratical manner!
## Modify the prompt for a different result {#3ab045fcbe774c8fb3adc528f9042ba0}
1. To modify your prompt results, in the **Prompt** template, click the **Template** field. The **Edit Prompt** window opens.
2. Change `Answer the user as if you were a pirate` to a different character, perhaps `Answer the user as if you were Hermione Granger.`
3. Run the workflow again. The response will be markedly different.

View file

@ -0,0 +1,53 @@
---
title: Blog Writer
sidebar_position: 1
slug: /starter-projects-blog-writer
---
Build a blog writer with OpenAI that uses URLs for reference content.
## Prerequisites {#899268e6c12c49b59215373a38287507}
- [Langflow installed and running](/getting-started-installation)
- [OpenAI API key created](https://platform.openai.com/)
## Create the Blog Writer project {#0c1a9c65b7d640f693ec3aad963416ff}
1. From the Langflow dashboard, click **New Project**.
2. Select **Blog Writer**.
3. A workspace for the **Blog Writer** is displayed.
![](./282456806.png)
This flow creates a one-shot article generator with **Prompt**, **OpenAI**, and **Chat Output** components, augmented with reference content and instructions from the **URL** and **Instructions** components.
The **Template** field of the **Prompt** looks like this:
![](./257920618.png)
The `{instructions}` value is received from the **Instructions** component. One or more `{references}`  are received from a list of URLs.
- **URL** extracts raw text and metadata from one or more web links.
- **Parse Data** converts the data coming from the **URL** component into plain text to feed a prompt.
![](./25156979.png)
## Run the Blog Writer {#b93be7a567f5400293693b31b8d0f81a}
---
1. Click the **Playground** button. Here you can chat with the AI that has access to the **URL** content.
2. Click the **Lighting Bolt** icon to run it.
3. To write about something different, change the values in the **URL** component and adjust the instructions on the left side bar of the **Playground**. Try again and see what the LLM constructs.
![](./447530731.png)

View file

@ -0,0 +1,39 @@
---
title: Document QA
sidebar_position: 2
slug: /starter-projects-document-qa
---
Build a question-and-answer chatbot with a document loaded from local memory.
## Prerequisites {#6555c100a30e4a21954af25e2e05403a}
- [Langflow installed and running](/getting-started-installation)
- [OpenAI API key created](https://platform.openai.com/)
## Create the Document QA project {#204500104f024553aab2b633bb99f603}
1. From the Langflow dashboard, click **New Project**.
2. Select **Document QA**.
3. The **Document QA** project is created.
![](./727819216.png)
This flow is composed of a standard chatbot with the **Chat Input**, **Prompt**, **OpenAI**, and **Chat Output** components, but it also incorporates a **File** component, which loads a file from your local machine. **Parse Data** is used to convert the data from **File** into the **Prompt** component as `{Document}`. The **Prompt** component is instructed to answer questions based on the contents of `{Document}`. This gives the **OpenAI** component context it would not otherwise have access to.
![](./1140665127.png)
## Run the Document QA {#f58fcc2b9e594156a829b1772b6a7191}
1. To select a document to load, in the **File** component, click the **Path** field. Select a local file, and then click **Open**. The file name appears in the field.
![](./1073956357.png)
1. Click the **Playground** button. Here you can chat with the AI that has access to your document's content.
2. Type in a question about the document content and press Enter. You should see a contextual response.

View file

@ -0,0 +1,70 @@
---
title: Memory Chatbot
sidebar_position: 3
slug: /starter-projects-memory-chatbot
---
This flow extends the [Basic Prompting](http://localhost:3000/starter-projects/basic-prompting) flow to include a chat memory. This makes the AI remember previous user inputs.
## Prerequisites {#a71d73e99b1543bbba827207503cf31f}
- [Langflow installed and running](/getting-started-installation)
- [OpenAI API key created](https://platform.openai.com/)
## Create the memory chatbot project {#70ce99381b7043a1b417a81e9ae74c72}
1. From the Langflow dashboard, click **New Project**.
2. Select **Memory Chatbot**.
3. The **Memory Chatbot** flow is created .
![](./1511598495.png)
This flow uses the same components as the Basic Prompting one, but extends it with a **Chat Memory** component. This component retrieves previous messages and sends them to the **Prompt** component to fill a part of the **Template** with context.
By clicking the template, you'll see the prompt editor like below:
![](./450254819.png)
This gives the **OpenAI** component a memory of previous chat messages.
1. Don't forget to [set up your OpenAI API key](http://localhost:3000/starter-projects/basic-prompting#open-ai)
## Run {#a110cad860584c98af1aead006035378}
1. Open the Playground.
2. Type multiple questions. In the **Memories** tab, your queries are logged in order. Up to 100 queries are stored by default. Try telling the AI your name and asking `What is my name?` on a second message, or `What is the first subject I asked you about?` to validate that previous knowledge is taking effect.
>
> 💡  Check and adjust advanced parameters by opening the Advanced Settings of the **Chat Memory** component.
>
![](./1079168789.png)
## Session ID {#4e68c3c0750942f98c45c1c45d7ffbbe}
`SessionID` is a unique identifier in Langflow that stores conversation sessions between the AI and a user. A `SessionID` is created when a conversation is initiated, and then associated with all subsequent messages during that session.
In the **Memory Chatbot** flow you created, the **Chat Memory** component references past interactions by **Session ID**. You can demonstrate this by modifying the **Session ID** value to switch between conversation histories.
1. In the **Session ID** field of the **Chat Memory** and **Chat Input** components, add a **Session ID** value like `MySessionID`.
2. Now, once you send a new message the **Playground**, you should have a new memory created on the **Memories** tab.
3. Notice how your conversation is being stored in different memory sessions.
>
> 💡  Every chat component in Langflow comes with a `SessionID`. It defaults to the flow ID. Explore how changing it affects what the AI remembers.
>
Learn more about memories in the [Chat Memory](/guides-chat-memory) section.

View file

@ -0,0 +1,80 @@
---
title: Vector Store RAG
sidebar_position: 4
slug: /starter-projects-vector-store-rag
---
Retrieval Augmented Generation, or RAG, is a pattern for training LLMs on your data and querying it.
RAG is backed by a **vector store**, a vector database which stores embeddings of the ingested data.
This enables **vector search**, a more powerful and context-aware search.
We've chosen [Astra DB](https://astra.datastax.com/signup?utm_source=langflow-pre-release&utm_medium=referral&utm_campaign=langflow-announcement&utm_content=create-a-free-astra-db-account) as the vector database for this starter project, but you can follow along with any of Langflow's vector database options.
## Prerequisites {#6aa2c6dff6894eccadc39d4903d79e66}
- [Langflow installed and running](http://localhost:3000/getting-started/install-langflow)
- [OpenAI API key](https://platform.openai.com/)
- [An Astra DB vector database created](https://docs.datastax.com/en/astra-db-serverless/get-started/quickstart.html) with:
- Application Token
- API Endpoint
![](./648489928.png)
## Create the vector store RAG project {#e3ed64193e5e448f81279e1d54ba43cf}
1. From the Langflow dashboard, click **New Project**.
2. Select **Vector Store RAG**.
3. The **Vector Store RAG** project is created.
![](./1946624394.png)
The vector store RAG flow is built of two separate flows. Ingestion and query.
The **ingestion** part (bottom of the screen) populates the vector store with data from a local file. It ingests data from a file (**File**), splits it into chunks (**Split Text**), indexes it in Astra DB (**Astra DB**), and computes embeddings for the chunks using an embedding model (**OpenAI Embeddings**).
>
> 💡  Embeddings are numerical vectors that represent data meaningfully. They enable efficient similarity searches in vector stores by placing similar items close together in the vector space, enhancing search and recommendation tasks.
>
This part creates a searchable index to be queried for contextual similarity.
The **query** part (top of the screen) allows users to retrieve embedded vector store data. Components:
- **Chat Input** defines where to send the user input (coming from the Playground).
- **OpenAI Embeddings** is the model used to generate embeddings from the user input.
- **Astra DB** retrieves the most relevant chunks from the Astra DB database (here, used for search, not ingestion).
- **Parse Data** converts chunks coming from the **Astra DB** component into plain text to feed a prompt.
- **Prompt** takes in the user input and the retrieved chunks as text and builds a prompt for the model.
- **OpenAI** takes in the prompt to generate a response.
- **Chat Output** component displays the response in the Playground.
1. To create an environment variable for the **OpenAI** component, in the **OpenAI API Key** field, click the **Globe** button, and then click **Add New Variable**.
1. In the **Variable Name** field, enter `openai_api_key`.
2. In the **Value** field, paste your OpenAI API Key (`sk-...`).
3. Click **Save Variable**.
1. To create environment variables for the **Astra DB** and **Astra DB Search** components:
1. In the **Token** field, click the **Globe** button, and then click **Add New Variable**.
2. In the **Variable Name** field, enter `astra_token`.
3. In the **Value** field, paste your Astra application token (`AstraCS:WSnyFUhRxsrg…`).
4. Click **Save Variable**.
5. Repeat the above steps for the **API Endpoint** field, pasting your Astra API Endpoint instead (`https://ASTRA_DB_ID-ASTRA_DB_REGION.apps.astra.datastax.com`).
6. Add the global variable to both the **Astra DB** and **Astra DB Search** components.
## Run the Vector Store RAG {#815a6536d2d548d987f0f4e375a58b15}
1. Click the **Playground** button. Here you can chat with the AI that uses context from the database you created.
2. Type a message and press Enter. (Try something like "What topics do you know about?")
3. The bot will respond with a summary of the data you've embedded.