Select AI for Python
select_ai, that enables you to use DBMS_CLOUD_AI
capabilities in Autonomous AI Database from
Python. Select AI for Python supports enhanced generative AI workflows, summarization,
feedback mechanisms, consistent metadata management, and agentic AI capabilities. It
also supports Python 3.14 and includes an updated HTML documentation site
(New)
What You Can Do
-
NL2SQL: Use natural language to query your database through AI-based SQL generation. This includes generating SQL queries, running the generated queries, explaining generated SQL, and narrating query results.
-
RAG: Create and update vector indexes for automated Retrieval Augmented Generation (RAG) workflows that retrieve relevant content and include it in generative AI responses.
You can monitor refresh cycles using
vector_index.get_next_refresh_timestamp()to retrieve the UTC timestamp of the next scheduled refresh. -
Chat: Create and manage conversations with prompt history to support chat-style interactions with generative AI models.
-
Synthetic Data Generation: Generate synthetic data for testing and analysis using generative AI
-
Summarize: Summarize text or query results
-
Feedback: Record and manage model feedback
-
Translate: Translate text between languages
-
AI Agents: Create autonomous and interaction AI agents. See Select AI Agent for Python for details.
-
Sync and Async connections: Connect to the database using synchronous or asynchronous connections
You can use
select_ai.create_pool()andselect_ai.create_pool_async()to create shared connection pools for improved concurrency and resource sharing. -
AI Profiles: Create and manage AI profiles to enable using AI models from a wide range of AI providers
Supported Platforms
Select AI for Python is certified for Autonomous AI Database 26ai and 19c. Select AI for Python may work on other platforms, however, it is not certified.
Click https://github.com/oracle/python-select-ai/issues to report issues.
Supported Functions for Select AI Profile (Synchronous and Asynchronous)
When you send prompts through a profile, you can choose among several functions defined for AI profile objects. Some are as follows:
-
create(): Create the AI profile in the database or replace if necessary. See create() GitHub documentation. -
delete(): Remove the profile. See delete() GitHub documentation. -
generate(): Use the profile to process a prompt as per the chosen action. See generete() GitHub documentation -
generate_synthetic_data(): Create synthetic data based on the supplied attributes. See generate_synthetic_data() GitHub documentation. -
get_attributes(): Return the current profile attributes. See get_attributes() GitHub documentation. -
run_sql(): Generate and run SQL (default). See run_sql() GitHub documentation. -
show_sql(): Generate SQL without running it. See show_sql() GitHub documentation. -
explain_sql(): Provide explanation for generated SQL. See explain_sql() GitHub documentation. -
narrate(): Describe query results in natural language. See narrate() on GitHub documentation. -
chat(): Engage in a free-form conversation. See chat() GitHub documentation. -
show_prompt(): Display the constructed prompt sent to the generative AI model. See show_prompt() GitHub documentation. -
summarize(): Produce a summary for provided content. See summarize() GitHub documentation. -
add_positive_feedback(),add_negative_feedback(),delete_feedback(): Manage user feedback associated with generated queries. See add_positive_feedback(), add_negative_feedback(), and delete_feedback() GitHub documentation translate(): Translate text from a specified source language to a target language. See translate() GitHub documentation.
For a complete list of functions, see Select AI for Python guide. See also Use AI Keyword to Enter Prompts for more information on the Select AI actions.
Supported Classes
The library includes classes to manage providers, profiles, conversations, vector indexes, synthetic data, and agentic workflows. Both synchronous and asynchronous versions are available.
-
Provider Classes: Define AI provider:
OpenAIProvider,AzureProvider,OCIGenAIProvider,AWSProvider,GoogleProvider,AnthropicProvider,CohereProvider,HuggingFaceProvider. -
Profile: defines the generative AI profile to process prompts (provider, credentials, metadata, options) and supports synthetic data generation. -
ProfileAttributes: profile configuration details such as provider, credential name, max tokens, temperature, object list, or vector index. -
ConversationAttributes: manage conversational context across prompts. -
VectorIndexandVectorIndexAttributes: create and manage vector indexes for RAG.The
create()API supports await_for_completionparameter. Use this parameter to control whether the call waits for completion before returning. For more information, see CREATE_VECTOR_INDEX Procedure for more details. -
SyntheticDataAttributes: create synthetic datasets for testing and development. -
Class-level delete methods: These class-level methods delete database objects directly without requiring initialization of a proxy object.
-
Profile.delete_profile(profile_name) -
VectorIndex.delete_index(index_name)
For Select AI Agent related class-level delete methods, see Select AI Agent for Python.
-
Asynchronous equivalents exist for Profile,
Conversation, and VectorIndex classes.
Async Select AI Support
Select AI for Python provides asynchronous APIs that enable interaction
with Autonomous AI Database. These APIs use Python’s async and
await constructs and support coroutine-based applications.
-
AsyncProfile -
AsyncConversation -
AsyncVectorIndex
Use select_ai.create_pool_async() to
manage connections in asynchronous workflows.
These classes provide functionality equivalent to their synchronous counterparts. Async APIs are useful in applications that require concurrent operations or event-driven workflows.
For complete API reference, see Select AI for Python guide.
API and Attribute Update Enhancements
The following enhancements are available:
-
All proxy objects support
fetch()to retrieve existing objects. -
All proxy objects provide
set_attribute()andset_attributes()for consistent updates -
All tool creation APIs support an
instructionparameter to define precise run behavior.
Privilege and HTTP Access
Privilege management is separate from HTTP access configuration.
Privilege APIs:
select_ai.grant_privilegesselect_ai.revoke_privileges
DBMS_CLOUDDBMS_CLOUD_AIDBMS_CLOUD_AI_AGENTDBMS_CLOUD_PIPELINE
HTTP access APIs:
select_ai.grant_http_accessselect_ai.revoke_http_access
Other Enhancements
-
Python 3.14 support
-
New HTML documentation site on GitHub using the Python docs theme: GitHub Select AI for Python Documentation
-
Installation for Release 1.2.2:
pip install select_ai