Select AI for Python

Select AI for Python integrates generative AI capabilities into Autonomous AI Database workflows. Select AI for Python provides a client library, 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.

  • 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

  • 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.

  • 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 free-form conversation.

  • show_prompt(): Display the constructed prompt sent to the generative AI model.

  • summarize(): Produce a summary for provided content.

  • add_positive_feedback(), add_negative_feedback(), delete_feedback(): Manage user feedback associated with generated queries.

  • translate(): Translate text from a specified source language to a target language.

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.

  • VectorIndex and VectorIndexAttributes: create and manage vector indexes for RAG.

  • 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.

Async APIs are available for the following key objects in the library:
  • AsyncProfile

  • AsyncConversation

  • AsyncVectorIndex

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() and set_attributes() for consistent updates

Privilege and HTTP Access

Privilege management is separate from HTTP access configuration.

Privilege APIs:

  • select_ai.grant_privileges
  • select_ai.revoke_privileges
Privileges are updated to include:
  • DBMS_CLOUD
  • DBMS_CLOUD_AI
  • DBMS_CLOUD_AI_AGENT
  • DBMS_CLOUD_PIPELINE

HTTP access APIs:

  • select_ai.grant_http_access
  • select_ai.revoke_http_access

Other Enhancements