Skip to main content

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

OptionDescriptionPossible ValuesMandatory
IF NOT EXISTSIf specified, the prompt will only be created if it does not already exist.N/AOptional
prompt_nameThe name of the prompt to be created.StringYes
message_typeThe type of the message to be included in the prompt.system, ai, humanYes
message_contentThe content of the message. Can be a direct message or a template string with placeholders.StringYes

Message Types

Message TypeDescriptionPossible ValuesSample Value
systemA system message providing context or instructions for the AI.String"You are an agent designed to generate SQL queries."
aiA message from the AI, typically used in examples or to set expectations.String"Generating the required information."
humanA 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
idnamemessages
cc2586ed-d4e6-4664-9572-d21da2735232generate_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-a368b9126d6astory_prompt[["system",{"Template":"You are a helpful assistant. Write a short story about {{topic}}"}]]