Select AI for Python
Select AI for
Python integrates generative AI capabilities into Autonomous Database workflows. Select AI for Python provides a client library,
select_ai
, that enables you to use DBMS_CLOUD_AI
capabilities in Autonomous Database from
Python.
What You Can Do
-
Connect to the database using synchronous or asynchronous connections
-
Create and manage AI profiles to enable using AI models from a wide range of AI providers
-
Use natural language to query your database through AI-based SQL generation
-
Describe query results in natural language
-
Create and manage conversations with prompt history
-
Create and update vector indexes easily for use with built-in and automated Retrieval Augmented Generation (RAG) workflows
-
Generate synthetic data for testing and analysis using generative AI
Supported Platforms
Select AI for Python is certified for Autonomous Database 19c and Autonomous Database 23ai. 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. -
delete()
: Remove the profile. -
generate()
: Use the profile to process a prompt as per the chosen action. -
generate_synthetic_data()
: Create synthetic data based on the supplied attributes. -
get_attributes()
: Return the current profile attributes. -
run_sql()
: generate and run SQL (default). -
show_sql()
: generate SQL without running it. -
explain_sql()
: provide explanation for generated SQL. -
narrate()
: describe query results in natural language. -
chat()
: engage in a freeform conversation. -
show_prompt()
: display the constructed prompt sent to the generative AI model.
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, and synthetic data. 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. -
VectorIndex
andVectorIndexAttributes
: create and manage vector indexes for RAG. -
SyntheticDataAttributes
: create synthetic datasets for testing and development.
Asynchronous equivalents exist for Profile
,
Conversation
, and VectorIndex
classes.
For complete API reference, see Select AI for Python guide.