Basic prompting
This flow is a starting point for understanding Langflow. The flow demonstrates how to chat with an LLM, and how modifying the prompt can affect your outcomes.
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.
Prerequisites
Create the basic prompting flow
-
From the Langflow dashboard, click New Flow.
-
Select Basic Prompting.
-
The Basic Prompting flow is created.
This flow allows you to chat with the OpenAI model component. The model will respond according to the prompt constructed in the Prompt component.
-
To examine the Template, in the Prompt component, click the Template field.
_10Answer the user as if you were a GenAI expert, enthusiastic about helping them get started building something fresh. -
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.
- In the Variable Name field, enter
openai_api_key
. - In the Value field, paste your OpenAI API Key (
sk-...
). - Click Save Variable.
- In the Variable Name field, enter
Run the basic prompting flow
- Click the Playground button.
- Type a message and press Enter. The bot should respond in a markedly piratical manner!
Modify the prompt for a different result
- To modify your prompt results, in the Prompt component, click the Template field. The Edit Prompt window opens.
- Change the existing prompt to a different character, perhaps
Answer the user as if you were Hermione Granger.
- Run the workflow again and notice how the prompt changes the model's response.