Quickstart
To learn how to use the Langflow Workspace, build a Basic Prompting flow for a chatbot application that uses OpenAI.
In this quickstart, you create a chatbot application using OpenAI, while learning the basics of building in the Langflow Workspace.
Prerequisites
Create an OpenAI API key and save it for later use.
Open Langflow and start a new project
-
In the Astra Portal header, switch your active app from Astra DB Serverless to Langflow.
-
In Langflow, click New Project, and then select the Basic Prompting (Hello,World) project.
This opens a starter project with the necessary components to run a chatbot application using OpenAI.
Basic prompting flow
The flow logic moves from Chat Input to Chat Output via the connectors between the components.
Each component accepts inputs on its left side, and outputs on its right side.
Hover over the connection ports to see the data types that the component accepts.
The Basic Prompting flow has four components:
-
The Chat Input component accepts user input to the chat.
-
The Prompt component combines the user input with a user-defined prompt.
-
The OpenAI model component sends the user input and prompt to the OpenAI API and receives a response.
-
The Chat Output component prints the flow’s output to the chat.
Run the Basic Prompting flow
-
Add your credentials to the OpenAI component. The fastest way to complete these fields is with Langflow’s Global Variables.
-
In the OpenAI component’s OpenAI API Key field, click the
Globe icon, and then click Add New Variable. Alternatively, click your username in the top right corner, and then click Settings, Global Variables, and then Add New. -
Name your variable. Paste your OpenAI API key (
sk-…
) in the Value field. -
In the Apply To Fields field, select the OpenAI API Key field to apply this variable to all OpenAI Embeddings components.
-
-
In the Chat Output component, click
Play to start the end-to-end application flow. A Chat Output built successfully message and a Check on all components indicate that the flow ran successfully. -
Click Playground to start a chat session.
-
Enter a query, and then make sure the bot responds according to the prompt you set in the Prompt component.
Now that your query has completed the journey from Chat Input to Chat Output, you have completed the Basic Prompting flow.
Next steps
To interact with this flow as an API endpoint, see the Langflow API.
To build a more advanced flow, see the Vector Store RAG.