001/* 002 * Copyright (c) 2026, Oracle and/or its affiliates. 003 * 004 * Licensed under the Universal Permissive License Version 1.0 as shown at 005 * https://oss.oracle.com/licenses/upl/ 006 */ 007package com.oracle.database.selectai; 008 009import com.oracle.database.selectai.model.GenerateAction; 010import com.oracle.database.selectai.model.Feedback; 011import com.oracle.database.selectai.model.GenerateParams; 012import com.oracle.database.selectai.model.ProfileAttributes; 013import com.oracle.database.selectai.model.SelectAIException; 014import com.oracle.database.selectai.model.SummaryParams; 015import com.oracle.database.selectai.model.SyntheticDataBatchRequest; 016import com.oracle.database.selectai.model.SyntheticDataSingleRequest; 017 018/** 019 * Contract for Select AI profile lifecycle, prompt execution, and attribute 020 * management. 021 * <p> 022 * An AI profile is the database-side configuration that tells Select AI which 023 * provider and AI model to use, which credential authorizes provider calls, and which 024 * schema metadata or vector index should be used when answering natural 025 * language prompts. A {@code Profile} instance may represent a profile created 026 * by this Java SDK, PL/SQL, Python, SQL tools, or any other client, as long as 027 * that profile is visible in the current schema. 028 * <p> 029 * A {@code Profile} object can be configured for creation or database-backed. 030 * A configured profile has a profile name, attributes, description, and status 031 * in memory, but it is not persisted until {@link #create()} succeeds. A 032 * database-backed profile is opened from the database, listed from metadata, or 033 * successfully created through this SDK. 034 * <p> 035 * Metadata getters can return configured values before creation. Operations 036 * that execute against an existing database profile, such as prompt 037 * generation, attribute updates, enable, disable, drop, feedback, summarize, 038 * translate, and synthetic-data generation, require a database-backed profile. 039 * The SDK rejects those operations with {@link IllegalStateException} when the 040 * object is not bound to a profile name or is configured for creation but has 041 * not been created yet. 042 * 043 * @see <a href="https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/select-ai-manage-profiles.html"> 044 * Manage AI profiles</a> 045 * @see <a href="https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/select-ai-about.html"> 046 * About Select AI</a> 047 */ 048public interface Profile { 049 /** 050 * Creates this configured profile in the database. 051 * <p> 052 * For a complete runnable sample source, see 053 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/CreateProfileSample.html"> 054 * CreateProfileSample source</a>. 055 * 056 * @return {@code true} when create succeeds 057 * @throws IllegalStateException when this Profile instance is not configured for creation 058 * @throws SelectAIException when create fails 059 */ 060 boolean create() throws SelectAIException; 061 062 /** 063 * Drops this profile from the database. 064 * <p> 065 * Use this when the provider and AI model configuration is no longer needed. The 066 * operation affects the database profile object, not only the Java object. 067 * For a complete runnable sample source, see 068 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/DropProfileSample.html"> 069 * DropProfileSample source</a>. 070 * 071 * @param force when {@code true}, force drop is attempted 072 * @return {@code true} when drop succeeds 073 * @throws IllegalStateException when this Profile instance is not bound to a profile name 074 * or is configured for creation but has not been created yet 075 * @throws SelectAIException when drop fails 076 */ 077 boolean drop(boolean force) throws SelectAIException; 078 079 /** 080 * Enables this profile so it can be used for Select AI operations. 081 * <p> 082 * For a complete runnable sample source, see 083 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/EnableProfileSample.html"> 084 * EnableProfileSample source</a>. 085 * 086 * @return {@code true} when enable succeeds 087 * @throws IllegalStateException when this Profile instance is not bound to a profile name 088 * or is configured for creation but has not been created yet 089 * @throws SelectAIException when enable fails 090 */ 091 boolean enable() throws SelectAIException; 092 093 /** 094 * Disables this profile so callers cannot use it for Select AI operations 095 * until it is enabled again. 096 * <p> 097 * For a complete runnable sample source, see 098 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/DisableProfileSample.html"> 099 * DisableProfileSample source</a>. 100 * 101 * @return {@code true} when disable succeeds 102 * @throws IllegalStateException when this Profile instance is not bound to a profile name 103 * or is configured for creation but has not been created yet 104 * @throws SelectAIException when disable fails 105 */ 106 boolean disable() throws SelectAIException; 107 108 /** 109 * Sends a natural-language prompt to Select AI using this profile. 110 * <p> 111 * The selected action determines whether Select AI runs SQL, returns SQL, 112 * explains SQL, narrates query results, chats, generates embeddings, or 113 * shows the provider-facing prompt. 114 * For a complete runnable sample source, see 115 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/GenerateProfileSample.html"> 116 * GenerateProfileSample source</a>. 117 * 118 * @param prompt natural language prompt 119 * @param generateAction action type (runsql, showsql, chat, embedding, etc.) 120 * @return generated response text 121 * @throws IllegalArgumentException when {@code prompt} is null/blank or 122 * {@code generateAction} is null 123 * @throws IllegalStateException when this Profile instance is not bound to a profile name 124 * or is configured for creation but has not been created yet 125 * @throws SelectAIException when generation fails 126 */ 127 String generate(String prompt, GenerateAction generateAction) throws SelectAIException; 128 129 /** 130 * Sends a natural-language prompt to Select AI using this profile and 131 * request-level profile attributes. 132 * <p> 133 * The supplied {@code profileAttributes} are passed only for this generate 134 * request. They do not update the stored profile definition. 135 * For a complete runnable sample source, see 136 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/GenerateWithProfileAttributesSample.html"> 137 * GenerateWithProfileAttributesSample source</a>. 138 * 139 * @param prompt natural language prompt 140 * @param generateAction action type (runsql, showsql, chat, embedding, etc.) 141 * @param profileAttributes optional request-level profile attributes 142 * @return generated response text 143 * @throws IllegalArgumentException when {@code prompt} is null/blank or 144 * {@code generateAction} is null 145 * @throws IllegalStateException when this Profile instance is not bound to a profile name 146 * or is configured for creation but has not been created yet 147 * @throws SelectAIException when generation fails 148 */ 149 String generate(String prompt, GenerateAction generateAction, ProfileAttributes profileAttributes) throws SelectAIException; 150 151 /** 152 * Sends a natural-language prompt to Select AI using this profile and 153 * optional generate parameters. 154 * <p> 155 * Generate parameters are serialized to the {@code params} payload accepted 156 * by {@code DBMS_CLOUD_AI.GENERATE}. For example, callers can pass a 157 * conversation identifier for context-aware chat requests. 158 * For a complete runnable sample source, see 159 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/GenerateWithGenerateParamsSample.html"> 160 * GenerateWithGenerateParamsSample source</a>. 161 * 162 * @param prompt natural language prompt 163 * @param generateAction action type (runsql, showsql, chat, embedding, etc.) 164 * @param generateParams optional generate parameters 165 * @return generated response text 166 * @throws IllegalArgumentException when {@code prompt} is null/blank or 167 * {@code generateAction} is null 168 * @throws IllegalStateException when this Profile instance is not bound to a profile name 169 * or is configured for creation but has not been created yet 170 * @throws SelectAIException when generation fails 171 */ 172 String generate(String prompt, GenerateAction generateAction, GenerateParams generateParams) throws SelectAIException; 173 174 /** 175 * Sends a natural-language prompt to Select AI using this profile, 176 * request-level profile attributes, and optional generate parameters. 177 * <p> 178 * The supplied {@code profileAttributes} are passed only for this generate 179 * request and do not update the stored profile definition. 180 * {@code generateParams} are serialized to the {@code params} payload 181 * accepted by {@code DBMS_CLOUD_AI.GENERATE}. 182 * For a complete runnable sample source, see 183 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/GenerateWithProfileAttributesAndGenerateParamsSample.html"> 184 * GenerateWithProfileAttributesAndGenerateParamsSample source</a>. 185 * 186 * @param prompt natural language prompt 187 * @param generateAction action type (runsql, showsql, chat, embedding, etc.) 188 * @param profileAttributes optional request-level profile attributes 189 * @param generateParams optional generate parameters 190 * @return generated response text 191 * @throws IllegalArgumentException when {@code prompt} is null/blank or 192 * {@code generateAction} is null 193 * @throws IllegalStateException when this Profile instance is not bound to a profile name 194 * or is configured for creation but has not been created yet 195 * @throws SelectAIException when generation fails 196 */ 197 String generate(String prompt, GenerateAction generateAction, ProfileAttributes profileAttributes, 198 GenerateParams generateParams) throws SelectAIException; 199 200 /** 201 * Generates SQL from the prompt and runs it. 202 * <p> 203 * Use this for NL2SQL workflows where the application wants the database 204 * result rather than only the generated SQL text. 205 * For a complete runnable sample source, see 206 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/RunSqlProfileSample.html"> 207 * RunSqlProfileSample source</a>. 208 * 209 * @param prompt natural language prompt 210 * @return generated SQL execution result/content 211 * @throws IllegalArgumentException when {@code prompt} is null or blank 212 * @throws IllegalStateException when this Profile instance is not bound to a profile name 213 * or is configured for creation but has not been created yet 214 * @throws SelectAIException when generation fails 215 * @see #generate(String, GenerateAction) 216 */ 217 String runsql(String prompt) throws SelectAIException; 218 219 /** 220 * Generates SQL from the prompt and runs it using optional generate 221 * parameters. 222 * <p> 223 * For a complete runnable sample source, see 224 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/RunSqlWithGenerateParamsSample.html"> 225 * RunSqlWithGenerateParamsSample source</a>. 226 * 227 * @param prompt natural language prompt 228 * @param generateParams optional generate parameters, such as conversation ID 229 * @return generated SQL execution result/content 230 * @throws IllegalArgumentException when {@code prompt} is null or blank 231 * @throws IllegalStateException when this Profile instance is not bound to a profile name 232 * or is configured for creation but has not been created yet 233 * @throws SelectAIException when generation fails 234 * @see #generate(String, GenerateAction, GenerateParams) 235 */ 236 String runsql(String prompt, GenerateParams generateParams) throws SelectAIException; 237 238 /** 239 * Generates SQL from the prompt without running it. 240 * <p> 241 * Use this when the application wants to review, log, or approve SQL before 242 * execution. 243 * For a complete runnable sample source, see 244 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/ShowSqlProfileSample.html"> 245 * ShowSqlProfileSample source</a>. 246 * 247 * @param prompt natural language prompt 248 * @return generated SQL text 249 * @throws IllegalArgumentException when {@code prompt} is null or blank 250 * @throws IllegalStateException when this Profile instance is not bound to a profile name 251 * or is configured for creation but has not been created yet 252 * @throws SelectAIException when generation fails 253 * @see #generate(String, GenerateAction) 254 */ 255 String showsql(String prompt) throws SelectAIException; 256 257 /** 258 * Generates SQL from the prompt without running it using optional generate 259 * parameters. 260 * <p> 261 * For a complete runnable sample source, see 262 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/ShowSqlWithGenerateParamsSample.html"> 263 * ShowSqlWithGenerateParamsSample source</a>. 264 * 265 * @param prompt natural language prompt 266 * @param generateParams optional generate parameters, such as conversation ID 267 * @return generated SQL text 268 * @throws IllegalArgumentException when {@code prompt} is null or blank 269 * @throws IllegalStateException when this Profile instance is not bound to a profile name 270 * or is configured for creation but has not been created yet 271 * @throws SelectAIException when generation fails 272 * @see #generate(String, GenerateAction, GenerateParams) 273 */ 274 String showsql(String prompt, GenerateParams generateParams) throws SelectAIException; 275 276 /** 277 * Generates SQL and returns a natural-language explanation. 278 * <p> 279 * For a complete runnable sample source, see 280 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/ExplainSqlProfileSample.html"> 281 * ExplainSqlProfileSample source</a>. 282 * 283 * @param prompt natural language prompt 284 * @return explanation of generated SQL 285 * @throws IllegalArgumentException when {@code prompt} is null or blank 286 * @throws IllegalStateException when this Profile instance is not bound to a profile name 287 * or is configured for creation but has not been created yet 288 * @throws SelectAIException when generation fails 289 * @see #generate(String, GenerateAction) 290 */ 291 String explainsql(String prompt) throws SelectAIException; 292 293 /** 294 * Generates SQL and returns a natural-language explanation using optional 295 * generate parameters. 296 * <p> 297 * For a complete runnable sample source, see 298 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/ExplainSqlWithGenerateParamsSample.html"> 299 * ExplainSqlWithGenerateParamsSample source</a>. 300 * 301 * @param prompt natural language prompt 302 * @param generateParams optional generate parameters, such as conversation ID 303 * @return explanation of generated SQL 304 * @throws IllegalArgumentException when {@code prompt} is null or blank 305 * @throws IllegalStateException when this Profile instance is not bound to a profile name 306 * or is configured for creation but has not been created yet 307 * @throws SelectAIException when generation fails 308 * @see #generate(String, GenerateAction, GenerateParams) 309 */ 310 String explainsql(String prompt, GenerateParams generateParams) throws SelectAIException; 311 312 /** 313 * Generates and runs SQL, then asks the model to narrate the result. 314 * <p> 315 * This action can require data access because the model may receive query 316 * result values to produce the narrative response. 317 * For a complete runnable sample source, see 318 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/NarrateProfileSample.html"> 319 * NarrateProfileSample source</a>. 320 * 321 * @param prompt natural language prompt 322 * @return narrative response 323 * @throws IllegalArgumentException when {@code prompt} is null or blank 324 * @throws IllegalStateException when this Profile instance is not bound to a profile name 325 * or is configured for creation but has not been created yet 326 * @throws SelectAIException when generation fails 327 * @see #generate(String, GenerateAction) 328 */ 329 String narrate(String prompt) throws SelectAIException; 330 331 /** 332 * Generates and runs SQL, then asks the model to narrate the result using 333 * optional generate parameters. 334 * <p> 335 * For a complete runnable sample source, see 336 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/NarrateWithGenerateParamsSample.html"> 337 * NarrateWithGenerateParamsSample source</a>. 338 * 339 * @param prompt natural language prompt 340 * @param generateParams optional generate parameters, such as conversation ID 341 * @return narrative response 342 * @throws IllegalArgumentException when {@code prompt} is null or blank 343 * @throws IllegalStateException when this Profile instance is not bound to a profile name 344 * or is configured for creation but has not been created yet 345 * @throws SelectAIException when generation fails 346 * @see #generate(String, GenerateAction, GenerateParams) 347 */ 348 String narrate(String prompt, GenerateParams generateParams) throws SelectAIException; 349 350 /** 351 * Returns the augmented prompt that Select AI would send to the provider. 352 * <p> 353 * Use this for troubleshooting profile metadata, object selection, and 354 * prompt augmentation behavior. 355 * For a complete runnable sample source, see 356 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/ShowPromptProfileSample.html"> 357 * ShowPromptProfileSample source</a>. 358 * 359 * @param prompt natural language prompt 360 * @return rewritten/provider-facing prompt 361 * @throws IllegalArgumentException when {@code prompt} is null or blank 362 * @throws IllegalStateException when this Profile instance is not bound to a profile name 363 * or is configured for creation but has not been created yet 364 * @throws SelectAIException when generation fails 365 * @see #generate(String, GenerateAction) 366 */ 367 String showprompt(String prompt) throws SelectAIException; 368 369 /** 370 * Returns the augmented prompt that Select AI would send to the provider 371 * using optional generate parameters. 372 * <p> 373 * For a complete runnable sample source, see 374 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/ShowPromptWithGenerateParamsSample.html"> 375 * ShowPromptWithGenerateParamsSample source</a>. 376 * 377 * @param prompt natural language prompt 378 * @param generateParams optional generate parameters, such as conversation ID 379 * @return rewritten/provider-facing prompt 380 * @throws IllegalArgumentException when {@code prompt} is null or blank 381 * @throws IllegalStateException when this Profile instance is not bound to a profile name 382 * or is configured for creation but has not been created yet 383 * @throws SelectAIException when generation fails 384 * @see #generate(String, GenerateAction, GenerateParams) 385 */ 386 String showprompt(String prompt, GenerateParams generateParams) throws SelectAIException; 387 388 /** 389 * Sends the prompt as a chat-style request using this profile. 390 * <p> 391 * For a complete runnable sample source, see 392 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/ChatProfileSample.html"> 393 * ChatProfileSample source</a>. 394 * 395 * @param prompt natural language prompt 396 * @return chat response 397 * @throws IllegalArgumentException when {@code prompt} is null or blank 398 * @throws IllegalStateException when this Profile instance is not bound to a profile name 399 * or is configured for creation but has not been created yet 400 * @throws SelectAIException when generation fails 401 * @see #generate(String, GenerateAction) 402 */ 403 String chat(String prompt) throws SelectAIException; 404 405 /** 406 * Sends the prompt as a chat-style request using optional generate 407 * parameters. 408 * <p> 409 * For a complete runnable sample source, see 410 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/ChatWithGenerateParamsSample.html"> 411 * ChatWithGenerateParamsSample source</a>. 412 * 413 * @param prompt natural language prompt 414 * @param generateParams optional generate parameters, such as conversation ID 415 * @return chat response 416 * @throws IllegalArgumentException when {@code prompt} is null or blank 417 * @throws IllegalStateException when this Profile instance is not bound to a profile name 418 * or is configured for creation but has not been created yet 419 * @throws SelectAIException when generation fails 420 * @see #generate(String, GenerateAction, GenerateParams) 421 */ 422 String chat(String prompt, GenerateParams generateParams) throws SelectAIException; 423 424 /** 425 * Starts a Select AI chat session using the supplied conversation. 426 * <p> 427 * If the conversation does not yet have a conversation ID, this method 428 * calls {@link Conversation#create()} before creating the session. The 429 * resulting conversation ID is sent with each session generation request. 430 * For a complete runnable sample source, see 431 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/ChatSessionWithoutDeleteSample.html"> 432 * ChatSessionWithoutDeleteSample source</a>. 433 * 434 * @param conversation conversation to use for context-aware generation 435 * @return session bound to the conversation ID 436 * @throws IllegalArgumentException when {@code conversation} is null 437 * @throws IllegalStateException when this Profile instance is not bound to a profile name 438 * or is configured for creation but has not been created yet 439 * @throws SelectAIException when conversation creation or session initialization fails 440 */ 441 Session chatSession(Conversation conversation) throws SelectAIException; 442 443 /** 444 * Starts a Select AI chat session using the supplied conversation. 445 * <p> 446 * When {@code deleteOnClose} is true, {@link Session#close()} drops the 447 * conversation. Closing the session does not close this profile, the 448 * {@link SelectAI} client, or the underlying JDBC connection. 449 * For a complete runnable sample source, see 450 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/ChatSessionProfileSample.html"> 451 * ChatSessionProfileSample source</a>. 452 * 453 * @param conversation conversation to use for context-aware generation 454 * @param deleteOnClose whether to drop the conversation when the session closes 455 * @return session bound to the conversation ID 456 * @throws IllegalArgumentException when {@code conversation} is null 457 * @throws IllegalStateException when this Profile instance is not bound to a profile name 458 * or is configured for creation but has not been created yet 459 * @throws SelectAIException when conversation creation, drop, or session initialization fails 460 */ 461 Session chatSession(Conversation conversation, boolean deleteOnClose) throws SelectAIException; 462 463 /** 464 * Updates one profile attribute using a string value. 465 * <p> 466 * Profile attributes tune provider settings, object selection, AI model 467 * behavior, RAG configuration, and other Select AI behavior. 468 * For a complete runnable sample source, see 469 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/SetProfileStringAttributeSample.html"> 470 * SetProfileStringAttributeSample source</a>. 471 * 472 * @param attributeName attribute name 473 * @param attributeValue attribute value (null clears attribute where supported) 474 * @return {@code true} when update succeeds 475 * @throws IllegalStateException when this Profile instance is not bound to a profile name 476 * or is configured for creation but has not been created yet 477 * @throws SelectAIException when update fails 478 */ 479 boolean setAttribute(String attributeName, String attributeValue) throws SelectAIException; 480 481 /** 482 * Updates one profile attribute using a boolean value. 483 * <p> 484 * For a complete runnable sample source, see 485 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/SetProfileBooleanAttributeSample.html"> 486 * SetProfileBooleanAttributeSample source</a>. 487 * 488 * @param attributeName attribute name 489 * @param attributeValue boolean value 490 * @return {@code true} when update succeeds 491 * @throws IllegalStateException when this Profile instance is not bound to a profile name 492 * or is configured for creation but has not been created yet 493 * @throws SelectAIException when update fails 494 */ 495 boolean setAttribute(String attributeName, boolean attributeValue) throws SelectAIException; 496 497 /** 498 * Updates one profile attribute using an integer value. 499 * <p> 500 * For a complete runnable sample source, see 501 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/SetProfileIntegerAttributeSample.html"> 502 * SetProfileIntegerAttributeSample source</a>. 503 * 504 * @param attributeName attribute name 505 * @param attributeValue integer value 506 * @return {@code true} when update succeeds 507 * @throws IllegalStateException when this Profile instance is not bound to a profile name 508 * or is configured for creation but has not been created yet 509 * @throws SelectAIException when update fails 510 */ 511 boolean setAttribute(String attributeName, Integer attributeValue) throws SelectAIException; 512 513 /** 514 * Updates one profile attribute using a floating-point value. 515 * <p> 516 * For a complete runnable sample source, see 517 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/SetProfileFloatAttributeSample.html"> 518 * SetProfileFloatAttributeSample source</a>. 519 * 520 * @param attributeName attribute name 521 * @param attributeValue float value 522 * @return {@code true} when update succeeds 523 * @throws IllegalStateException when this Profile instance is not bound to a profile name 524 * or is configured for creation but has not been created yet 525 * @throws SelectAIException when update fails 526 */ 527 boolean setAttribute(String attributeName, Float attributeValue) throws SelectAIException; 528 529 /** 530 * Replaces or updates multiple profile attributes in one operation. 531 * <p> 532 * For a complete runnable sample source, see 533 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/SetProfileAttributesSample.html"> 534 * SetProfileAttributesSample source</a>. 535 * 536 * @param profileAttributes attributes payload 537 * @return {@code true} when update succeeds 538 * @throws IllegalStateException when this Profile instance is not bound to a profile name 539 * or is configured for creation but has not been created yet 540 * @throws SelectAIException when update fails 541 */ 542 boolean setAttributes(ProfileAttributes profileAttributes) throws SelectAIException; 543 544 /** 545 * Stores or removes feedback about generated SQL for this profile. 546 * <p> 547 * Feedback is profile-specific guidance for NL2SQL behavior, not a general 548 * rating for chat or RAG answers. Positive feedback confirms that generated 549 * SQL is useful; negative feedback can include the expected response and 550 * explanatory comments so future prompts can be guided toward a better SQL 551 * shape. The target profile is this {@code Profile} instance. 552 * For a complete runnable sample source, see 553 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/SubmitFeedbackProfileSample.html"> 554 * SubmitFeedbackProfileSample source</a>. 555 * 556 * @param feedbackRequest feedback payload 557 * @return {@code true} when feedback is successfully submitted 558 * @throws IllegalStateException when this Profile instance is not bound to a profile name 559 * or is configured for creation but has not been created yet 560 * @throws SelectAIException when submission fails 561 * @see <a href="https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/dbms-cloud-ai-package.html"> 562 * DBMS_CLOUD_AI feedback reference</a> 563 */ 564 boolean feedback(Feedback feedbackRequest) throws SelectAIException; 565 566 /** 567 * Generates synthetic data using this profile and a single-object request payload. 568 * <p> 569 * The target AI profile is this {@code Profile} instance. The request object 570 * keeps the object name, owner, row count, prompt guidance, and optional 571 * generation parameters together. 572 * For a complete runnable sample source, see 573 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/GenerateSyntheticDataSingleRequestSample.html"> 574 * GenerateSyntheticDataSingleRequestSample source</a>. 575 * 576 * @param request single request payload 577 * @return {@code true} when generation request is accepted/succeeds 578 * @throws IllegalStateException when this Profile instance is not bound to a profile name 579 * or is configured for creation but has not been created yet 580 * @throws SelectAIException when single-request synthetic data generation fails 581 * @see <a href="https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/dbms-cloud-ai-package.html"> 582 * DBMS_CLOUD_AI synthetic data reference</a> 583 */ 584 boolean generateSyntheticData(SyntheticDataSingleRequest request) throws SelectAIException; 585 586 /** 587 * Generates synthetic data using this profile for multiple objects in one request. 588 * <p> 589 * Batch generation is useful for related tables where referential or 590 * domain consistency across generated data matters. The target AI profile is 591 * this {@code Profile} instance. 592 * For a complete runnable sample source, see 593 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/GenerateSyntheticDataBatchRequestSample.html"> 594 * GenerateSyntheticDataBatchRequestSample source</a>. 595 * 596 * @param request batch request payload 597 * @return {@code true} when generation request is accepted/succeeds 598 * @throws IllegalStateException when this Profile instance is not bound to a profile name 599 * or is configured for creation but has not been created yet 600 * @throws SelectAIException when batch synthetic data generation fails 601 * @see <a href="https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/dbms-cloud-ai-package.html"> 602 * DBMS_CLOUD_AI synthetic data reference</a> 603 */ 604 boolean generateSyntheticData(SyntheticDataBatchRequest request) throws SelectAIException; 605 606 /** 607 * Summarizes inline text or content read from an external location. 608 * <p> 609 * Use this operation when the application wants a concise natural-language 610 * summary rather than generated SQL. The request may provide text directly 611 * or reference content through a location and credential. 612 * For a complete runnable sample source, see 613 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/SummarizeProfileSample.html"> 614 * SummarizeProfileSample source</a>. 615 * 616 * @param content inline content 617 * @param credential_name credential name for external source access 618 * @param location_uri source URI 619 * @param userPrompt summarization prompt/instructions 620 * @param params typed summarization parameters 621 * @return summary text 622 * @throws IllegalArgumentException when neither or both of {@code content} and {@code location_uri} are provided 623 * @throws IllegalStateException when this Profile instance is not bound to a profile name 624 * or is configured for creation but has not been created yet 625 * @throws SelectAIException when the database summarization call fails 626 * @see <a href="https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/dbms-cloud-ai-package.html"> 627 DBMS_CLOUD_AI summarization reference</a> 628 */ 629 String summarize(String content, 630 String credential_name, 631 String location_uri, 632 String userPrompt, 633 SummaryParams params) throws SelectAIException; 634 635 /** 636 * Translates text using the provider configured by this profile. 637 * <p> 638 * Source and target languages are omitted. The database can use profile 639 * language attributes or source-language detection according to 640 * {@code DBMS_CLOUD_AI.TRANSLATE} behavior. 641 * For a complete runnable sample source, see 642 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/TranslateProfileSample.html"> 643 * TranslateProfileSample source</a>. 644 * 645 * @param text source text 646 * @return translated text 647 * @throws IllegalArgumentException when {@code text} is null or blank 648 * @throws IllegalStateException when this Profile instance is not bound to a profile name 649 * or is configured for creation but has not been created yet 650 * @throws SelectAIException when translation fails 651 */ 652 String translate(String text) throws SelectAIException; 653 654 /** 655 * Translates text using the provider configured by this profile and an 656 * explicit target language. 657 * <p> 658 * The source language is omitted. The database can use profile language 659 * attributes or source-language detection according to 660 * {@code DBMS_CLOUD_AI.TRANSLATE} behavior. 661 * For a complete runnable sample source, see 662 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/TranslateProfileSample.html"> 663 * TranslateProfileSample source</a>. 664 * 665 * @param text source text 666 * @param targetLanguage target language/code 667 * @return translated text 668 * @throws IllegalArgumentException when {@code text} is null or blank 669 * @throws IllegalStateException when this Profile instance is not bound to a profile name 670 * or is configured for creation but has not been created yet 671 * @throws SelectAIException when translation fails 672 */ 673 String translate(String text, 674 String targetLanguage) throws SelectAIException; 675 676 /** 677 * Translates text using the provider configured by this profile. 678 * <p> 679 * Source and target language values are optional and may be {@code null}. 680 * When omitted, the database can use profile language attributes or 681 * source-language detection according to {@code DBMS_CLOUD_AI.TRANSLATE} 682 * behavior. 683 * For a complete runnable sample source, see 684 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/TranslateProfileSample.html"> 685 * TranslateProfileSample source</a>. 686 * 687 * @param text source text 688 * @param sourceLanguage source language/code 689 * @param targetLanguage target language/code 690 * @return translated text 691 * @throws IllegalArgumentException when {@code text} is null or blank 692 * @throws IllegalStateException when this Profile instance is not bound to a profile name 693 * or is configured for creation but has not been created yet 694 * @throws SelectAIException when translation fails 695 */ 696 String translate(String text, 697 String sourceLanguage, 698 String targetLanguage) throws SelectAIException; 699 700 /** 701 * Returns profile name. 702 * <p> 703 * For a complete runnable sample source, see 704 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/GetProfileNameSample.html"> 705 * GetProfileNameSample source</a>. 706 * 707 * @return profile name 708 */ 709 String getProfileName(); 710 711 /** 712 * Returns profile status. 713 * <p> 714 * For a configured profile that has not been created yet, returns the 715 * caller-supplied create status. For a profile bound to an existing 716 * database profile, refreshes metadata from the database before returning 717 * the status. 718 * For a complete runnable sample source, see 719 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/GetProfileStatusSample.html"> 720 * GetProfileStatusSample source</a>. 721 * 722 * @return profile status 723 * @throws SelectAIException when current profile metadata cannot be fetched 724 */ 725 String getStatus() throws SelectAIException; 726 727 /** 728 * Returns profile description. 729 * <p> 730 * For a complete runnable sample source, see 731 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/GetProfileDescriptionSample.html"> 732 * GetProfileDescriptionSample source</a>. 733 * 734 * @return profile description 735 */ 736 String getDescription(); 737 738 /** 739 * Returns profile attributes. 740 * <p> 741 * For a configured profile that has not been created yet, returns the 742 * caller-supplied create attributes. For a profile bound to an existing 743 * database profile, refreshes attributes from the database before returning 744 * them. 745 * For a complete runnable sample source, see 746 * <a href="{@docRoot}/src-html/com/oracle/database/selectai/samples/profile/GetProfileAttributesSample.html"> 747 * GetProfileAttributesSample source</a>. 748 * 749 * @return profile attributes 750 * @throws IllegalStateException when this Profile instance is not bound to a profile name 751 * @throws SelectAIException when current profile attributes cannot be fetched 752 */ 753 ProfileAttributes getProfileAttributes() throws SelectAIException; 754}