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

  1. In the Astra Portal header, switch your active app from Astra DB to Langflow.

  2. 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.

starter flow basic prompting

The Basic Prompting flow has four components:

  • Chat Input: This component accepts user input and passes it to the Prompt component.

  • Prompt: This component combines the user input with a user-defined prompt, and then passes them to the OpenAI component.

  • OpenAI: This component sends the user input and prompt to the OpenAI API and receives a response. The response is passed on to the Chat Output component.

  • Chat Output: This component prints the response from the OpenAI API.

Run the Basic Prompting flow

  1. Add your credentials to the OpenAI component. The fastest way to complete these fields is with Langflow’s Global Variables.

    1. In the OpenAI component’s OpenAI API Key field, click the language 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.

    2. Name your variable. Paste your OpenAI API key (sk-…​) in the Value field.

    3. In the Apply To Fields field, select the OpenAI API Key field to apply this variable to all OpenAI Embeddings components.

  2. In the Chat Output component, click play_arrow Play to start the end-to-end application flow. A Chat Output built successfully message and a check Check on all components indicate that the flow ran successfully.

  3. Click Playground Playground to start a chat session.

  4. 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.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com