Article
· Mar 31 2m read

Operate the database through dialogue

Prompt

Firstly, we need to understand what prompt words are and what their functions are.

Prompt Engineering

Hint word engineering is a method specifically designed for optimizing language models.
Its goal is to guide these models to generate more accurate and targeted output text by designing and adjusting the input prompt words.

Core Functions of Prompts

  • Improve content matching: By accurately expressing your needs, AI can generate high-quality content that better meets expectations
  • Efficiency and time optimization: A clear prompt can directly obtain the desired answer, reducing the time for repeated adjustments and greatly improving efficiency.
  • Easy to program: AI can return corresponding content according to its own needs, making it easier to process

 Application Introduction

The iris-data-analysis application is actually a simple demo using prompt words,It can process the database through dialogue, using AI AgentBO.OpenAI configuration URL APIKEY 、 And the Model name, to call the AI interface.By using prompt words to prompt AI to return the required SQL, we can process and execute the SQL returned by AI to obtain the data we need.

Example

For example, I would like to know AI_Agent_DB.UserInfo  How many male users and how many female users are in the UserInfo table? I can write the prompt words like this

text

As an SQL expert, please generate appropriate SQL statements based on the following requirements:
demand:{"message"}
Please only return SQL statements without any further explanation. If creating a table, please include appropriate field types and necessary constraints.

 

 

 

AI will only return SQL in the conversation with you for subsequent operations, and also vectorize the requested message to view the similarity of the problem through vector retrieval.

and also vectorize the requested message to view the similarity of the problem through vector retrieval.

Discussion (0)1
Log in or sign up to continue