Skip to main content

Select AI for Python

Project description

Select AI for Python

Select AI for Python enables you to ask questions of your database data using natural language (text-to-SQL), get generative AI responses using your trusted content (retrieval augmented generation), generate synthetic data using large language models, and other features – all from Python. With the general availability of Select AI Python, Python developers have access to the functionality of Select AI on Oracle Autonomous Database.

Select AI for Python enables you to leverage the broader Python ecosystem in combination with generative AI and database functionality - bridging the gap between the DBMS_CLOUD_AI PL/SQL package and Python's rich ecosystem. It provides intuitive objects and methods for AI model interaction.

Installation

Install the Python package:

python3 -m pip install select_ai

Install the optional command line interface:

python3 -m pip install 'select_ai[cli]'

Documentation

See Select AI for Python documentation

Samples

Examples can be found in the /samples directory

Command Line Interface

The optional select-ai command provides an interactive chat REPL for Select AI profiles:

select-ai chat --profile OCI_AI_PROFILE

Select AI CLI demo

Basic Example

import select_ai

user = "<your_select_ai_user>"
password = "<your_select_ai_password>"
dsn = "<your_select_ai_db_connect_string>"

select_ai.connect(user=user, password=password, dsn=dsn)
profile = select_ai.Profile(profile_name="oci_ai_profile")
# run_sql returns a pandas dataframe
df = profile.run_sql(prompt="How many promotions?")
print(df.columns)
print(df)

Async Example

import asyncio

import select_ai

user = "<your_select_ai_user>"
password = "<your_select_ai_password>"
dsn = "<your_select_ai_db_connect_string>"

# This example shows how to asynchronously run sql
async def main():
    await select_ai.async_connect(user=user, password=password, dsn=dsn)
    async_profile = await select_ai.AsyncProfile(
        profile_name="async_oci_ai_profile",
    )
    # run_sql returns a pandas df
    df = await async_profile.run_sql("How many promotions?")
    print(df)

asyncio.run(main())

Help

Questions can be asked in GitHub Discussions.

Problem reports can be raised in GitHub Issues.

Contributing

This project welcomes contributions from the community. Before submitting a pull request, please review our contribution guide

Security

Please consult the security guide for our responsible security vulnerability disclosure process

License

Copyright (c) 2025 Oracle and/or its affiliates.

Released under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

select_ai-1.4.0rc1.tar.gz (118.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

select_ai-1.4.0rc1-py3-none-any.whl (62.9 kB view details)

Uploaded Python 3

File details

Details for the file select_ai-1.4.0rc1.tar.gz.

File metadata

  • Download URL: select_ai-1.4.0rc1.tar.gz
  • Upload date:
  • Size: 118.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for select_ai-1.4.0rc1.tar.gz
Algorithm Hash digest
SHA256 fd5b1563e49cbbb00a1c07d8648d1493f4fc075b0f71d689b4ba0b7effb080f5
MD5 2ac39e4b22f36e899aee0c99ba7cd015
BLAKE2b-256 b1621dd389a023b14455e644ea897053764c129c864782de83ea2b326e7f2b89

See more details on using hashes here.

File details

Details for the file select_ai-1.4.0rc1-py3-none-any.whl.

File metadata

  • Download URL: select_ai-1.4.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 62.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for select_ai-1.4.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 aa67befe4e8ec9e8143944d7b39c953e276806b09e8d0f76ad56845b29e6de4f
MD5 fc9d4876798a4ad5c967bdee67946dbb
BLAKE2b-256 7c616b1938c8c64eec93438df5a6886fa5aee7ad8cc48d10946c24fdb50c00de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page