02. User-required port-based meta prompt generation agent

User-required port-based meta prompt generation agent

This tutorial explains how to create a chatbot that helps users create prompts. The chatbot first collects the requirements from the user, then creates a prompt based on this and modifies it according to the user input. The process is divided into two separate states, where LLM determines when to switch states.

The graphical representation of this system can be found below.

Mainly covered

  • Gather information : Define graphs for collecting user requirements

  • Generate Prompt : Set the status above prompt creation

  • Define the state logic : Define the state logic of the chatbot

  • Create the graph : Create graphs and save conversation history

  • Use the graph : How to use the chatbot created

In this example, we create a chatbot that helps users create prompts.

The chatbot first collects the requirements from the user, then creates a prompt based on this and modifies it according to the user input.

The process is divided into two separate states, where LLM determines when to switch states.

The graphical representation of the system can be found below.

Preferences

Collection of ports from users

First, it defines a node that collects user requirements.

During this process, you can ask the user for specific information. All the information you need Meet It requires the user to need the information until it becomes.

Prompt generation

Now set the state to create the prompt.

A separate system message is required for this, and a function that filters all messages before the tool call is also required.

  • The last message tool call In the case of "prompt creator" ( prompt ) Is in a state to respond to.

  • The last message HumanMessage If not, the user will have to respond next END In state.

  • The last message HumanMessage If it is, before tool call If there was prompt In state.

  • Otherwise, "collect information" ( info ) In a state.

Describe the logic that determines the state of the chatbot.

State logic definition

  1. Goal-oriented structure Meta prompts clearly define the information you want to obtain as a result, and include a step-by-step design process for this.

  2. Adaptive design Includes an approach to correct or repeatedly optimize the prompt, taking into account the model's answer characteristics, limitations, and strengths.

  3. Prompt engineering Adjust the model's response in detail, including conditional statements, guides, and role instructions.

  4. Multilayer approach Adopt a way to gradually refine answers through sub-questions, not just a single question.

Main features

Meta Prompt Methodology or strategy to optimize prompt design and creation itself A concept referring to, used to make more effective and efficient use of the artificial language model (LLM). Beyond simply entering text, A structured and creative approach needed to induce a model's response in a specific way or to increase the quality of the results. Includes.

Definition of Meta Prompt

The definition of the meta prompt we use here is as follows.

Now you can create a graph. To save conversation history MemorySaver Will use

Graph generation

Visualize the graph.

Execution

Now run the generated graph to generate a prompt.

Last updated