CREATE PROMPT
The CREATE PROMPT
statement is used to define a new prompt with specific messages. This statement allows you to specify different types of messages that will be part of the prompt.
Syntax
CREATE PROMPT [IF NOT EXISTS] prompt_name (
message_type "message_content",
...
);
Options
Option | Description | Possible Values | Mandatory |
---|---|---|---|
IF NOT EXISTS | If specified, the prompt will only be created if it does not already exist. | N/A | Optional |
prompt_name | The name of the prompt to be created. | String | Yes |
message_type | The type of the message to be included in the prompt. | system , ai , human | Yes |
message_content | The content of the message. Can be a direct message or a template string with placeholders. | String | Yes |
Message Types
Message Type | Description | Possible Values | Sample Value |
---|---|---|---|
system | A system message providing context or instructions for the AI. | String | "You are an agent designed to generate SQL queries." |
ai | A message from the AI, typically used in examples or to set expectations. | String | "Generating the required information." |
human | A message from the human user, often including dynamic content or variables. | String (can include templates) | "{{input}}" |
Example
Here is an example of a CREATE PROMPT
statement:
CREATE PROMPT generate_sql_prompt (
system "You are an agent designed to generate SQL queries. Fetch the schemas of the tables using the get_semantics tool and understand the schema of the cities tables thoroughly. Generate a valid Clickhouse SQL query to get the required information if possible. Otherwise, say that the required information cannot be retrieved from the available information in the table.",
human "{{input}}"
);
SELECT * FROM langdb.prompts
id | name | messages |
---|---|---|
cc2586ed-d4e6-4664-9572-d21da2735232 | generate_sql_prompt | [["system",{"Message":"You are an agent designed to generate SQL queries. Fetch the schemas of the tables using the get_semantics tool and understand the schema of the |
cities tables thoroughly. Generate a valid Clickhouse SQL query to get the required information if possible. Otherwise, say that the required information cannot be | ||
retrieved from the available information in the table."}],["human",{"Template":"{{input}}"}]] | ||
f17f1dd8-be50-426b-a20c-a368b9126d6a | story_prompt | [["system",{"Template":"You are a helpful assistant. Write a short story about {{topic}}"}]] |