Interface Profile
An AI profile is the database-side configuration that tells Select AI which
provider and AI model to use, which credential authorizes provider calls, and which
schema metadata or vector index should be used when answering natural
language prompts. A Profile instance may represent a profile created
by this Java SDK, PL/SQL, Python, SQL tools, or any other client, as long as
that profile is visible in the current schema.
A Profile object can be configured for creation or database-backed.
A configured profile has a profile name, attributes, description, and status
in memory, but it is not persisted until create() succeeds. A
database-backed profile is opened from the database, listed from metadata, or
successfully created through this SDK.
Metadata getters can return configured values before creation. Operations
that execute against an existing database profile, such as prompt
generation, attribute updates, enable, disable, drop, feedback, summarize,
translate, and synthetic-data generation, require a database-backed profile.
The SDK rejects those operations with IllegalStateException when the
object is not bound to a profile name or is configured for creation but has
not been created yet.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionSends the prompt as a chat-style request using this profile.chat(String prompt, GenerateParams generateParams) Sends the prompt as a chat-style request using optional generate parameters.chatSession(Conversation conversation) Starts a Select AI chat session using the supplied conversation.chatSession(Conversation conversation, boolean deleteOnClose) Starts a Select AI chat session using the supplied conversation.booleancreate()Creates this configured profile in the database.booleandisable()Disables this profile so callers cannot use it for Select AI operations until it is enabled again.booleandrop(boolean force) Drops this profile from the database.booleanenable()Enables this profile so it can be used for Select AI operations.explainsql(String prompt) Generates SQL and returns a natural-language explanation.explainsql(String prompt, GenerateParams generateParams) Generates SQL and returns a natural-language explanation using optional generate parameters.booleanStores or removes feedback about generated SQL for this profile.generate(String prompt, GenerateAction generateAction) Sends a natural-language prompt to Select AI using this profile.generate(String prompt, GenerateAction generateAction, GenerateParams generateParams) Sends a natural-language prompt to Select AI using this profile and optional generate parameters.generate(String prompt, GenerateAction generateAction, ProfileAttributes profileAttributes) Sends a natural-language prompt to Select AI using this profile and request-level profile attributes.generate(String prompt, GenerateAction generateAction, ProfileAttributes profileAttributes, GenerateParams generateParams) Sends a natural-language prompt to Select AI using this profile, request-level profile attributes, and optional generate parameters.booleanGenerates synthetic data using this profile for multiple objects in one request.booleanGenerates synthetic data using this profile and a single-object request payload.Returns profile description.Returns profile attributes.Returns profile name.Returns profile status.Generates and runs SQL, then asks the model to narrate the result.narrate(String prompt, GenerateParams generateParams) Generates and runs SQL, then asks the model to narrate the result using optional generate parameters.Generates SQL from the prompt and runs it.runsql(String prompt, GenerateParams generateParams) Generates SQL from the prompt and runs it using optional generate parameters.booleansetAttribute(String attributeName, boolean attributeValue) Updates one profile attribute using a boolean value.booleansetAttribute(String attributeName, Float attributeValue) Updates one profile attribute using a floating-point value.booleansetAttribute(String attributeName, Integer attributeValue) Updates one profile attribute using an integer value.booleansetAttribute(String attributeName, String attributeValue) Updates one profile attribute using a string value.booleansetAttributes(ProfileAttributes profileAttributes) Replaces or updates multiple profile attributes in one operation.showprompt(String prompt) Returns the augmented prompt that Select AI would send to the provider.showprompt(String prompt, GenerateParams generateParams) Returns the augmented prompt that Select AI would send to the provider using optional generate parameters.Generates SQL from the prompt without running it.showsql(String prompt, GenerateParams generateParams) Generates SQL from the prompt without running it using optional generate parameters.summarize(String content, String credential_name, String location_uri, String userPrompt, SummaryParams params) Summarizes inline text or content read from an external location.Translates text using the provider configured by this profile.Translates text using the provider configured by this profile and an explicit target language.Translates text using the provider configured by this profile.
-
Method Details
-
create
Creates this configured profile in the database.For a complete runnable sample source, see CreateProfileSample source.
- Returns:
truewhen create succeeds- Throws:
IllegalStateException- when this Profile instance is not configured for creationSelectAIException- when create fails
-
drop
Drops this profile from the database.Use this when the provider and AI model configuration is no longer needed. The operation affects the database profile object, not only the Java object. For a complete runnable sample source, see DropProfileSample source.
- Parameters:
force- whentrue, force drop is attempted- Returns:
truewhen drop succeeds- Throws:
IllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when drop fails
-
enable
Enables this profile so it can be used for Select AI operations.For a complete runnable sample source, see EnableProfileSample source.
- Returns:
truewhen enable succeeds- Throws:
IllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when enable fails
-
disable
Disables this profile so callers cannot use it for Select AI operations until it is enabled again.For a complete runnable sample source, see DisableProfileSample source.
- Returns:
truewhen disable succeeds- Throws:
IllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when disable fails
-
generate
Sends a natural-language prompt to Select AI using this profile.The selected action determines whether Select AI runs SQL, returns SQL, explains SQL, narrates query results, chats, generates embeddings, or shows the provider-facing prompt. For a complete runnable sample source, see GenerateProfileSample source.
- Parameters:
prompt- natural language promptgenerateAction- action type (runsql, showsql, chat, embedding, etc.)- Returns:
- generated response text
- Throws:
IllegalArgumentException- whenpromptis null/blank orgenerateActionis nullIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when generation fails
-
generate
String generate(String prompt, GenerateAction generateAction, ProfileAttributes profileAttributes) throws SelectAIException Sends a natural-language prompt to Select AI using this profile and request-level profile attributes.The supplied
profileAttributesare passed only for this generate request. They do not update the stored profile definition. For a complete runnable sample source, see GenerateWithProfileAttributesSample source.- Parameters:
prompt- natural language promptgenerateAction- action type (runsql, showsql, chat, embedding, etc.)profileAttributes- optional request-level profile attributes- Returns:
- generated response text
- Throws:
IllegalArgumentException- whenpromptis null/blank orgenerateActionis nullIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when generation fails
-
generate
String generate(String prompt, GenerateAction generateAction, GenerateParams generateParams) throws SelectAIException Sends a natural-language prompt to Select AI using this profile and optional generate parameters.Generate parameters are serialized to the
paramspayload accepted byDBMS_CLOUD_AI.GENERATE. For example, callers can pass a conversation identifier for context-aware chat requests. For a complete runnable sample source, see GenerateWithGenerateParamsSample source.- Parameters:
prompt- natural language promptgenerateAction- action type (runsql, showsql, chat, embedding, etc.)generateParams- optional generate parameters- Returns:
- generated response text
- Throws:
IllegalArgumentException- whenpromptis null/blank orgenerateActionis nullIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when generation fails
-
generate
String generate(String prompt, GenerateAction generateAction, ProfileAttributes profileAttributes, GenerateParams generateParams) throws SelectAIException Sends a natural-language prompt to Select AI using this profile, request-level profile attributes, and optional generate parameters.The supplied
profileAttributesare passed only for this generate request and do not update the stored profile definition.generateParamsare serialized to theparamspayload accepted byDBMS_CLOUD_AI.GENERATE. For a complete runnable sample source, see GenerateWithProfileAttributesAndGenerateParamsSample source.- Parameters:
prompt- natural language promptgenerateAction- action type (runsql, showsql, chat, embedding, etc.)profileAttributes- optional request-level profile attributesgenerateParams- optional generate parameters- Returns:
- generated response text
- Throws:
IllegalArgumentException- whenpromptis null/blank orgenerateActionis nullIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when generation fails
-
runsql
Generates SQL from the prompt and runs it.Use this for NL2SQL workflows where the application wants the database result rather than only the generated SQL text. For a complete runnable sample source, see RunSqlProfileSample source.
- Parameters:
prompt- natural language prompt- Returns:
- generated SQL execution result/content
- Throws:
IllegalArgumentException- whenpromptis null or blankIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when generation fails- See Also:
-
runsql
Generates SQL from the prompt and runs it using optional generate parameters.For a complete runnable sample source, see RunSqlWithGenerateParamsSample source.
- Parameters:
prompt- natural language promptgenerateParams- optional generate parameters, such as conversation ID- Returns:
- generated SQL execution result/content
- Throws:
IllegalArgumentException- whenpromptis null or blankIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when generation fails- See Also:
-
showsql
Generates SQL from the prompt without running it.Use this when the application wants to review, log, or approve SQL before execution. For a complete runnable sample source, see ShowSqlProfileSample source.
- Parameters:
prompt- natural language prompt- Returns:
- generated SQL text
- Throws:
IllegalArgumentException- whenpromptis null or blankIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when generation fails- See Also:
-
showsql
Generates SQL from the prompt without running it using optional generate parameters.For a complete runnable sample source, see ShowSqlWithGenerateParamsSample source.
- Parameters:
prompt- natural language promptgenerateParams- optional generate parameters, such as conversation ID- Returns:
- generated SQL text
- Throws:
IllegalArgumentException- whenpromptis null or blankIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when generation fails- See Also:
-
explainsql
Generates SQL and returns a natural-language explanation.For a complete runnable sample source, see ExplainSqlProfileSample source.
- Parameters:
prompt- natural language prompt- Returns:
- explanation of generated SQL
- Throws:
IllegalArgumentException- whenpromptis null or blankIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when generation fails- See Also:
-
explainsql
Generates SQL and returns a natural-language explanation using optional generate parameters.For a complete runnable sample source, see ExplainSqlWithGenerateParamsSample source.
- Parameters:
prompt- natural language promptgenerateParams- optional generate parameters, such as conversation ID- Returns:
- explanation of generated SQL
- Throws:
IllegalArgumentException- whenpromptis null or blankIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when generation fails- See Also:
-
narrate
Generates and runs SQL, then asks the model to narrate the result.This action can require data access because the model may receive query result values to produce the narrative response. For a complete runnable sample source, see NarrateProfileSample source.
- Parameters:
prompt- natural language prompt- Returns:
- narrative response
- Throws:
IllegalArgumentException- whenpromptis null or blankIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when generation fails- See Also:
-
narrate
Generates and runs SQL, then asks the model to narrate the result using optional generate parameters.For a complete runnable sample source, see NarrateWithGenerateParamsSample source.
- Parameters:
prompt- natural language promptgenerateParams- optional generate parameters, such as conversation ID- Returns:
- narrative response
- Throws:
IllegalArgumentException- whenpromptis null or blankIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when generation fails- See Also:
-
showprompt
Returns the augmented prompt that Select AI would send to the provider.Use this for troubleshooting profile metadata, object selection, and prompt augmentation behavior. For a complete runnable sample source, see ShowPromptProfileSample source.
- Parameters:
prompt- natural language prompt- Returns:
- rewritten/provider-facing prompt
- Throws:
IllegalArgumentException- whenpromptis null or blankIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when generation fails- See Also:
-
showprompt
Returns the augmented prompt that Select AI would send to the provider using optional generate parameters.For a complete runnable sample source, see ShowPromptWithGenerateParamsSample source.
- Parameters:
prompt- natural language promptgenerateParams- optional generate parameters, such as conversation ID- Returns:
- rewritten/provider-facing prompt
- Throws:
IllegalArgumentException- whenpromptis null or blankIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when generation fails- See Also:
-
chat
Sends the prompt as a chat-style request using this profile.For a complete runnable sample source, see ChatProfileSample source.
- Parameters:
prompt- natural language prompt- Returns:
- chat response
- Throws:
IllegalArgumentException- whenpromptis null or blankIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when generation fails- See Also:
-
chat
Sends the prompt as a chat-style request using optional generate parameters.For a complete runnable sample source, see ChatWithGenerateParamsSample source.
- Parameters:
prompt- natural language promptgenerateParams- optional generate parameters, such as conversation ID- Returns:
- chat response
- Throws:
IllegalArgumentException- whenpromptis null or blankIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when generation fails- See Also:
-
chatSession
Starts a Select AI chat session using the supplied conversation.If the conversation does not yet have a conversation ID, this method calls
Conversation.create()before creating the session. The resulting conversation ID is sent with each session generation request. For a complete runnable sample source, see ChatSessionWithoutDeleteSample source.- Parameters:
conversation- conversation to use for context-aware generation- Returns:
- session bound to the conversation ID
- Throws:
IllegalArgumentException- whenconversationis nullIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when conversation creation or session initialization fails
-
chatSession
Starts a Select AI chat session using the supplied conversation.When
deleteOnCloseis true,Session.close()drops the conversation. Closing the session does not close this profile, theSelectAIclient, or the underlying JDBC connection. For a complete runnable sample source, see ChatSessionProfileSample source.- Parameters:
conversation- conversation to use for context-aware generationdeleteOnClose- whether to drop the conversation when the session closes- Returns:
- session bound to the conversation ID
- Throws:
IllegalArgumentException- whenconversationis nullIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when conversation creation, drop, or session initialization fails
-
setAttribute
Updates one profile attribute using a string value.Profile attributes tune provider settings, object selection, AI model behavior, RAG configuration, and other Select AI behavior. For a complete runnable sample source, see SetProfileStringAttributeSample source.
- Parameters:
attributeName- attribute nameattributeValue- attribute value (null clears attribute where supported)- Returns:
truewhen update succeeds- Throws:
IllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when update fails
-
setAttribute
Updates one profile attribute using a boolean value.For a complete runnable sample source, see SetProfileBooleanAttributeSample source.
- Parameters:
attributeName- attribute nameattributeValue- boolean value- Returns:
truewhen update succeeds- Throws:
IllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when update fails
-
setAttribute
Updates one profile attribute using an integer value.For a complete runnable sample source, see SetProfileIntegerAttributeSample source.
- Parameters:
attributeName- attribute nameattributeValue- integer value- Returns:
truewhen update succeeds- Throws:
IllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when update fails
-
setAttribute
Updates one profile attribute using a floating-point value.For a complete runnable sample source, see SetProfileFloatAttributeSample source.
- Parameters:
attributeName- attribute nameattributeValue- float value- Returns:
truewhen update succeeds- Throws:
IllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when update fails
-
setAttributes
Replaces or updates multiple profile attributes in one operation.For a complete runnable sample source, see SetProfileAttributesSample source.
- Parameters:
profileAttributes- attributes payload- Returns:
truewhen update succeeds- Throws:
IllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when update fails
-
feedback
Stores or removes feedback about generated SQL for this profile.Feedback is profile-specific guidance for NL2SQL behavior, not a general rating for chat or RAG answers. Positive feedback confirms that generated SQL is useful; negative feedback can include the expected response and explanatory comments so future prompts can be guided toward a better SQL shape. The target profile is this
Profileinstance. For a complete runnable sample source, see SubmitFeedbackProfileSample source.- Parameters:
feedbackRequest- feedback payload- Returns:
truewhen feedback is successfully submitted- Throws:
IllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when submission fails- See Also:
-
generateSyntheticData
Generates synthetic data using this profile and a single-object request payload.The target AI profile is this
Profileinstance. The request object keeps the object name, owner, row count, prompt guidance, and optional generation parameters together. For a complete runnable sample source, see GenerateSyntheticDataSingleRequestSample source.- Parameters:
request- single request payload- Returns:
truewhen generation request is accepted/succeeds- Throws:
IllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when single-request synthetic data generation fails- See Also:
-
generateSyntheticData
Generates synthetic data using this profile for multiple objects in one request.Batch generation is useful for related tables where referential or domain consistency across generated data matters. The target AI profile is this
Profileinstance. For a complete runnable sample source, see GenerateSyntheticDataBatchRequestSample source.- Parameters:
request- batch request payload- Returns:
truewhen generation request is accepted/succeeds- Throws:
IllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when batch synthetic data generation fails- See Also:
-
summarize
String summarize(String content, String credential_name, String location_uri, String userPrompt, SummaryParams params) throws SelectAIException Summarizes inline text or content read from an external location.Use this operation when the application wants a concise natural-language summary rather than generated SQL. The request may provide text directly or reference content through a location and credential. For a complete runnable sample source, see SummarizeProfileSample source.
- Parameters:
content- inline contentcredential_name- credential name for external source accesslocation_uri- source URIuserPrompt- summarization prompt/instructionsparams- typed summarization parameters- Returns:
- summary text
- Throws:
IllegalArgumentException- when neither or both ofcontentandlocation_uriare providedIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when the database summarization call fails- See Also:
-
translate
Translates text using the provider configured by this profile.Source and target languages are omitted. The database can use profile language attributes or source-language detection according to
DBMS_CLOUD_AI.TRANSLATEbehavior. For a complete runnable sample source, see TranslateProfileSample source.- Parameters:
text- source text- Returns:
- translated text
- Throws:
IllegalArgumentException- whentextis null or blankIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when translation fails
-
translate
Translates text using the provider configured by this profile and an explicit target language.The source language is omitted. The database can use profile language attributes or source-language detection according to
DBMS_CLOUD_AI.TRANSLATEbehavior. For a complete runnable sample source, see TranslateProfileSample source.- Parameters:
text- source texttargetLanguage- target language/code- Returns:
- translated text
- Throws:
IllegalArgumentException- whentextis null or blankIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when translation fails
-
translate
String translate(String text, String sourceLanguage, String targetLanguage) throws SelectAIException Translates text using the provider configured by this profile.Source and target language values are optional and may be
null. When omitted, the database can use profile language attributes or source-language detection according toDBMS_CLOUD_AI.TRANSLATEbehavior. For a complete runnable sample source, see TranslateProfileSample source.- Parameters:
text- source textsourceLanguage- source language/codetargetLanguage- target language/code- Returns:
- translated text
- Throws:
IllegalArgumentException- whentextis null or blankIllegalStateException- when this Profile instance is not bound to a profile name or is configured for creation but has not been created yetSelectAIException- when translation fails
-
getProfileName
Returns profile name.For a complete runnable sample source, see GetProfileNameSample source.
- Returns:
- profile name
-
getStatus
Returns profile status.For a configured profile that has not been created yet, returns the caller-supplied create status. For a profile bound to an existing database profile, refreshes metadata from the database before returning the status. For a complete runnable sample source, see GetProfileStatusSample source.
- Returns:
- profile status
- Throws:
SelectAIException- when current profile metadata cannot be fetched
-
getDescription
Returns profile description.For a complete runnable sample source, see GetProfileDescriptionSample source.
- Returns:
- profile description
-
getProfileAttributes
Returns profile attributes.For a configured profile that has not been created yet, returns the caller-supplied create attributes. For a profile bound to an existing database profile, refreshes attributes from the database before returning them. For a complete runnable sample source, see GetProfileAttributesSample source.
- Returns:
- profile attributes
- Throws:
IllegalStateException- when this Profile instance is not bound to a profile nameSelectAIException- when current profile attributes cannot be fetched
-