Select AI Conversations

Conversations in Select AI refer to the interactive dialogue between the user and the system, where a sequence of user-provided natural language prompts are stored and managed to support long-term memory for LLM interactions.

Select AI supports short-term, session-based conversations, which are enabled in the AI profile, as well as long-term, named conversations, which are enabled using specific procedures or functions and conversation IDs.

Types of Conversations

Select AI supports session-based short-term conversations and customizable conversations.

Session-based Short-Term Conversations: Select AI includes session-based short-term conversations to generate context-aware responses for the current prompt based on prior interactions.

You can enable it by setting the conversation attribute to true|false in your AI profile. Unlike the multiple conversation feature, session-based conversations store prompts only for the duration of the session. Prompts are stored in a temporary table, automatically dropped when the session ends, and cannot be reused and switched among conversations.

Customizable Long-Term Conversations: Select AI supports creating and using customizable conversations enabling you to use Select AI with different topics without mixing context, improving both flexibility and efficiency. You can create, set, delete, and update conversations through the DBMS_CLOUD_AI conversation procedures and functions. When you enable conversations, Select AI retrieves prompt history and sends them to the LLM to generate a response for the current prompt. These responses are stored in a persistent table for future use.

Note:

Select AI Conversations support the following actions: runsql, showsql, explainsql, narrate, and chat.

How to Use Customizable Conversations

You can use Select AI for customizable conversations in the following ways:

  • Set the conversation ID in the session using the DBMS_CLOUD_AI.SET_CONVERSATION_ID procedure, and run SELECT AI <ACTION> <PROMPT>.

  • Pass the conversation_id in the params argument of the DBMS_CLOUD_AI.GENERATE function.

Note:

If you use both multiple conversations and the conversation: [true|false] setting, the system ignores the conversation setting.

In the context of SQL query generation (NL2SQL), conversations enable a more intuitive and accessible way to work with your data, making it easier for users to extract insights and perform tasks without needing deep technical knowledge of SQL. Conversations can also be used with chat and RAG capabilities of Select AI.

For example, conversations provide an intuitive way to analyze data:
  • Ask a question such as "What are the total number of customers"
  • Follow up with context aware questions like:
    • "break out count of customers by country"
    • "What age group is most common"
    • "keep the top 5 customers and their country by their purchases and include a rank in the result"

To enable conversations, see Example: Enable Conversations in Select AI for a complete example.

Session-Based Conversations vs Customizable Conversations

The following table compares the session-based conversation and the customizable conversations in Select AI:

Questions Session-Based Short-Term Conversations Customizable Long-Term Conversations

When do I use?

Best for quick, temporary chats where you want the model to remember recent questions and answers during a single session. It’s useful when you don’t need to save or reuse the conversation later.

Designed for longer or ongoing conversations that may span multiple sessions. It’s useful when you want to track, review, or manage the conversation history, or when different parts of an application need to access the same conversation context over time.

How do I enable?

Set {"conversation": true or false} in your AI profile.

Use the DBMS_CLOUD_AI.SET_CONVERSATION_ID procedure or the DBMS_CLOUD_AI.GENERATE function.

How many conversations are permitted?

One.

You can create multiple conversations.

If you explicitly specify conversation IDs, you can alternate between them to associate prompts with the appropriate conversations as needed.

Where are prompts stored and for how long?

Prompts are stored in a temporary table and dropped when the session ends.

Prompts are stored in a permanent table.

Prompts are retained in the database for the number of days specified by the retention_days parameter in the DBMS_CLOUD_AI.CREATE_CONVERSATION procedure. After the retention period, the conversation and its prompts are automatically deleted. You can also manually delete prompts using the DBMS_CLOUD_AI.DELETE_CONVERSATION_PROMPT procedure.

How many prompts are stored and how many prompts are sent to the LLM?

A maximum of 10 prompts are stored and sent to the LLM. You cannot customize this limit.

All prompts are stored.

By default, the system sends the 10 most recent prompts to the LLM. You can customize this using the conversation_length parameter. See CREATE_CONVERSATION Attributes.

Can I delete individual prompts?

No, you cannot delete individual prompt manually.

You can delete specific individual prompts by using the prompt id as specified in the USER_CLOUD_AI_CONVERSATION_PROMPTS View and using the DBMS_CLOUD_AI.DELETE_CONVERSATION_PROMPT procedure.

Are AI profiles used for retrieval of conversations?

Yes, Select AI retrieves prompts and responses previously generated using the same AI profile.

No, Select AI tracks the AI profile used when storing prompts and responses but does not restrict their retrieval based on that profile. It sends all conversation histories to the LLM to guide response generation, regardless of the profile used to generate them.

Where can I check history of prompts?

Prompts are saved in a temporary table under CLOUD USER but are not accessible for querying.

You can query and review conversations and prompts through the DBMS_CLOUD_AI conversation views. See DBMS_CLOUD_AI Views for details.