1. Provider

An AI Provider in Select AI refers to the service provider of the LLM, transformer or both for processing and generating responses to natural language prompts. These providers offer models that can interpret and convert natural language for the use cases highlighted under the LLM concept.

See Select your AI Provider for the supported providers.

A provider object describes the AI service that a Select AI profile, vector index, or agent tool should call. The provider object is separate from the credential object: the provider selects the service, model, endpoint, region, and provider-specific options, while the credential stores authentication details.

Most applications should instantiate one of the concrete provider classes instead of using Provider directly. Use the base Provider class when you need to call a compatible provider endpoint that does not have a dedicated class in this library.

Provider classes

Provider class

Provider name

Default endpoint behavior

AnthropicProvider

anthropic

Uses api.anthropic.com.

AWSProvider

aws

Builds bedrock-runtime.<region>.amazonaws.com from region.

AzureProvider

azure

Builds <azure_resource_name>.openai.azure.com.

CohereProvider

cohere

Uses api.cohere.ai.

GoogleProvider

google

Uses generativelanguage.googleapis.com.

HuggingFaceProvider

huggingface

Uses api-inference.huggingface.co.

OCIGenAIProvider

oci

Uses OCI region and OCI Gen AI attributes.

OpenAIProvider

openai

Keeps api.openai.com for network ACL setup; omits the default endpoint from database profiles so Select AI selects its native URL.

1.1. Examples

OCI Gen AI provider:

provider = select_ai.OCIGenAIProvider(
    region="us-chicago-1",
    oci_apiformat="GENERIC",
    model="cohere.command-r-plus",
)

OpenAI provider:

provider = select_ai.OpenAIProvider(
    model="gpt-4.1",
)

For the public OpenAI service, leave provider_endpoint at its default. The SDK sends provider="openai" and the model name, without an endpoint override. OpenAIProvider omits provider_endpoint from database profile payloads. Use the base Provider class for a custom OpenAI-compatible endpoint, as shown below. Do not append /v1/chat/completions; the database constructs the request path.

Azure OpenAI provider:

provider = select_ai.AzureProvider(
    azure_resource_name="my-azure-openai-resource",
    azure_deployment_name="gpt-4o-deployment",
    azure_embedding_deployment_name="text-embedding-deployment",
)

AWS Bedrock provider:

provider = select_ai.AWSProvider(
    region="us-east-1",
    aws_apiformat="ANTHROPIC",
    model="anthropic.claude-3-5-sonnet-20240620-v1:0",
)

Custom provider endpoint:

select_ai.create_credential(
    credential={
        "credential_name": "xai_credential",
        "username": "xai",
        "password": "<xai_api_key>",
    },
    replace=True,
)

xai_profile = select_ai.Profile(
    profile_name="xai",
    attributes=select_ai.ProfileAttributes(
        provider=select_ai.Provider(
            provider_endpoint="https://api.x.ai",
            model="grok-4-1-fast-reasoning",
        ),
        credential_name="xai_credential",
        object_list=[
            {"owner": "SH", "name": "CUSTOMERS"},
            {"owner": "SH", "name": "SALES"},
            {"owner": "SH", "name": "PRODUCTS"},
            {"owner": "SH", "name": "COUNTRIES"},
        ],
    ),
    replace=True,
)

sql = xai_profile.show_sql(
    prompt="How many customers do I have?",
)

1.2. Provider

class select_ai.Provider(embedding_model: str | None = None, model: str | None = None, provider_name: str | None = None, provider_endpoint: str | None = None, region: str | None = None)

Base class for AI Provider

To create an object of Provider class, use any one of the concrete AI provider implementations

Parameters:
  • embedding_model (str) – The embedding model, also known as a transformer. Depending on the AI provider, the supported embedding models vary

  • model (str) – The name of the LLM being used to generate responses

  • provider_name (str) – The name of the provider being used

  • provider_endpoint (str) – Endpoint URL of the AI provider being used

  • region (str) – The cloud region of the Gen AI cluster

classmethod create(*, provider_name: str | None = None, **kwargs)
dict(exclude_null=True)
embedding_model: str | None = None
json(exclude_null=True)
classmethod key_alias(k)
classmethod keys()
model: str | None = None
profile_dict(exclude_null=True)

Return provider attributes suitable for a DBMS_CLOUD_AI profile.

The result contains only values held by this provider instance. In particular, native provider endpoints remain available for network access configuration but are omitted from database profile payloads. Endpoint-only custom providers retain provider_endpoint.

provider_endpoint: str | None = None
provider_name: str | None = None
region: str | None = None
should_include_provider_endpoint() → bool

Whether to include provider_endpoint in a DBMS_CLOUD_AI profile.

1.3. AnthropicProvider

class select_ai.AnthropicProvider(embedding_model: str | None = None, model: str | None = None, provider_name: str = 'anthropic', provider_endpoint: str | None = 'api.anthropic.com', region: str | None = None)

Anthropic specific attributes

classmethod create(*, provider_name: str | None = None, **kwargs)
dict(exclude_null=True)
embedding_model: str | None = None
json(exclude_null=True)
classmethod key_alias(k)
classmethod keys()
model: str | None = None
profile_dict(exclude_null=True)

Return provider attributes suitable for a DBMS_CLOUD_AI profile.

The result contains only values held by this provider instance. In particular, native provider endpoints remain available for network access configuration but are omitted from database profile payloads. Endpoint-only custom providers retain provider_endpoint.

provider_endpoint: str | None = 'api.anthropic.com'
provider_name: str = 'anthropic'
region: str | None = None
should_include_provider_endpoint() → bool

Whether to include provider_endpoint in a DBMS_CLOUD_AI profile.

1.4. AzureProvider

class select_ai.AzureProvider(embedding_model: str | None = None, model: str | None = None, provider_name: str = 'azure', provider_endpoint: str | None = None, region: str | None = None, azure_deployment_name: str | None = None, azure_embedding_deployment_name: str | None = None, azure_resource_name: str | None = None)

Azure specific attributes

Parameters:
  • azure_deployment_name (str) – Name of the Azure OpenAI Service deployed model.

  • azure_embedding_deployment_name (str) – Name of the Azure OpenAI deployed embedding model.

  • azure_resource_name (str) – Name of the Azure OpenAI Service resource

azure_deployment_name: str | None = None
azure_embedding_deployment_name: str | None = None
azure_resource_name: str | None = None
classmethod create(*, provider_name: str | None = None, **kwargs)
dict(exclude_null=True)
embedding_model: str | None = None
json(exclude_null=True)
classmethod key_alias(k)
classmethod keys()
model: str | None = None
profile_dict(exclude_null=True)

Return provider attributes suitable for a DBMS_CLOUD_AI profile.

The result contains only values held by this provider instance. In particular, native provider endpoints remain available for network access configuration but are omitted from database profile payloads. Endpoint-only custom providers retain provider_endpoint.

provider_endpoint: str | None = None
provider_name: str = 'azure'
region: str | None = None
should_include_provider_endpoint() → bool

Whether to include provider_endpoint in a DBMS_CLOUD_AI profile.

1.5. AWSProvider

class select_ai.AWSProvider(embedding_model: str | None = None, model: str | None = None, provider_name: str = 'aws', provider_endpoint: str | None = None, region: str | None = None, aws_apiformat: str | None = None)

AWS specific attributes

aws_apiformat: str | None = None
classmethod create(*, provider_name: str | None = None, **kwargs)
dict(exclude_null=True)
embedding_model: str | None = None
json(exclude_null=True)
classmethod key_alias(k)
classmethod keys()
model: str | None = None
profile_dict(exclude_null=True)

Return provider attributes suitable for a DBMS_CLOUD_AI profile.

The result contains only values held by this provider instance. In particular, native provider endpoints remain available for network access configuration but are omitted from database profile payloads. Endpoint-only custom providers retain provider_endpoint.

provider_endpoint: str | None = None
provider_name: str = 'aws'
region: str | None = None
should_include_provider_endpoint() → bool

Whether to include provider_endpoint in a DBMS_CLOUD_AI profile.

1.6. CohereProvider

class select_ai.CohereProvider(embedding_model: str | None = None, model: str | None = None, provider_name: str = 'cohere', provider_endpoint: str | None = 'api.cohere.ai', region: str | None = None)

Cohere AI specific attributes

classmethod create(*, provider_name: str | None = None, **kwargs)
dict(exclude_null=True)
embedding_model: str | None = None
json(exclude_null=True)
classmethod key_alias(k)
classmethod keys()
model: str | None = None
profile_dict(exclude_null=True)

Return provider attributes suitable for a DBMS_CLOUD_AI profile.

The result contains only values held by this provider instance. In particular, native provider endpoints remain available for network access configuration but are omitted from database profile payloads. Endpoint-only custom providers retain provider_endpoint.

provider_endpoint: str | None = 'api.cohere.ai'
provider_name: str = 'cohere'
region: str | None = None
should_include_provider_endpoint() → bool

Whether to include provider_endpoint in a DBMS_CLOUD_AI profile.

1.7. OpenAIProvider

class select_ai.OpenAIProvider(embedding_model: str | None = None, model: str | None = None, provider_name: str = 'openai', provider_endpoint: str | None = 'api.openai.com', region: str | None = None)

OpenAI specific attributes.

The default hostname is retained for network ACL configuration and omitted from database profiles so DBMS_CLOUD_AI selects its native public endpoint. Use Provider for a custom OpenAI-compatible endpoint.

classmethod create(*, provider_name: str | None = None, **kwargs)
dict(exclude_null=True)
embedding_model: str | None = None
json(exclude_null=True)
classmethod key_alias(k)
classmethod keys()
model: str | None = None
profile_dict(exclude_null=True)

Return provider attributes suitable for a DBMS_CLOUD_AI profile.

The result contains only values held by this provider instance. In particular, native provider endpoints remain available for network access configuration but are omitted from database profile payloads. Endpoint-only custom providers retain provider_endpoint.

provider_endpoint: str | None = 'api.openai.com'
provider_name: str = 'openai'
region: str | None = None
should_include_provider_endpoint() → bool

Whether to include provider_endpoint in a DBMS_CLOUD_AI profile.

1.8. OCIGenAIProvider

class select_ai.OCIGenAIProvider(embedding_model: str | None = None, model: str | None = None, provider_name: str = 'oci', provider_endpoint: str | None = None, region: str | None = None, oci_apiformat: str | None = None, oci_compartment_id: str | None = None, oci_endpoint_id: str | None = None, oci_runtimetype: str | None = None)

OCI Gen AI specific attributes

Parameters:
  • oci_apiformat (str) – Specifies the format in which the API expects data to be sent and received. Supported values are ‘COHERE’ and ‘GENERIC’

  • oci_compartment_id (str) – Specifies the OCID of the compartment you are permitted to access when calling the OCI Generative AI service

  • oci_endpoint_id (str) – This attributes indicates the endpoint OCID of the Oracle dedicated AI hosting cluster

  • oci_runtimetype (str) – This attribute indicates the runtime type of the provided model. The supported values are ‘COHERE’ and ‘LLAMA’

classmethod create(*, provider_name: str | None = None, **kwargs)
dict(exclude_null=True)
embedding_model: str | None = None
json(exclude_null=True)
classmethod key_alias(k)
classmethod keys()
model: str | None = None
oci_apiformat: str | None = None
oci_compartment_id: str | None = None
oci_endpoint_id: str | None = None
oci_runtimetype: str | None = None
profile_dict(exclude_null=True)

Return provider attributes suitable for a DBMS_CLOUD_AI profile.

The result contains only values held by this provider instance. In particular, native provider endpoints remain available for network access configuration but are omitted from database profile payloads. Endpoint-only custom providers retain provider_endpoint.

provider_endpoint: str | None = None
provider_name: str = 'oci'
region: str | None = None
should_include_provider_endpoint() → bool

Whether to include provider_endpoint in a DBMS_CLOUD_AI profile.

1.9. GoogleProvider

class select_ai.GoogleProvider(embedding_model: str | None = None, model: str | None = None, provider_name: str = 'google', provider_endpoint: str | None = 'generativelanguage.googleapis.com', region: str | None = None)

Google AI specific attributes

classmethod create(*, provider_name: str | None = None, **kwargs)
dict(exclude_null=True)
embedding_model: str | None = None
json(exclude_null=True)
classmethod key_alias(k)
classmethod keys()
model: str | None = None
profile_dict(exclude_null=True)

Return provider attributes suitable for a DBMS_CLOUD_AI profile.

The result contains only values held by this provider instance. In particular, native provider endpoints remain available for network access configuration but are omitted from database profile payloads. Endpoint-only custom providers retain provider_endpoint.

provider_endpoint: str | None = 'generativelanguage.googleapis.com'
provider_name: str = 'google'
region: str | None = None
should_include_provider_endpoint() → bool

Whether to include provider_endpoint in a DBMS_CLOUD_AI profile.

1.10. HuggingFaceProvider

class select_ai.HuggingFaceProvider(embedding_model: str | None = None, model: str | None = None, provider_name: str = 'huggingface', provider_endpoint: str | None = 'api-inference.huggingface.co', region: str | None = None)

HuggingFace specific attributes

classmethod create(*, provider_name: str | None = None, **kwargs)
dict(exclude_null=True)
embedding_model: str | None = None
json(exclude_null=True)
classmethod key_alias(k)
classmethod keys()
model: str | None = None
profile_dict(exclude_null=True)

Return provider attributes suitable for a DBMS_CLOUD_AI profile.

The result contains only values held by this provider instance. In particular, native provider endpoints remain available for network access configuration but are omitted from database profile payloads. Endpoint-only custom providers retain provider_endpoint.

provider_endpoint: str | None = 'api-inference.huggingface.co'
provider_name: str = 'huggingface'
region: str | None = None
should_include_provider_endpoint() → bool

Whether to include provider_endpoint in a DBMS_CLOUD_AI profile.

1.11. Enable AI service provider

1.11.1. Enable using Sync API

This method adds ACL allowing database users to invoke AI provider’s HTTP endpoint. For non-HTTP or port-specific network access, use the network ACL helpers described in Privileges.

import os

import select_ai

admin_user = os.getenv("SELECT_AI_ADMIN_USER")
password = os.getenv("SELECT_AI_ADMIN_PASSWORD")
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
select_ai_user = os.getenv("SELECT_AI_USER")

select_ai.connect(user=admin_user, password=password, dsn=dsn)
select_ai.grant_http_access(
    users=select_ai_user, provider_endpoint="api.OPENAI.com"
)
print("Enabled AI provider for user: ", select_ai_user)

output:

Enabled AI provider for user: <select_ai_db_user>

1.11.2. Enable using Async API

import asyncio
import os

import select_ai

admin_user = os.getenv("SELECT_AI_ADMIN_USER")
password = os.getenv("SELECT_AI_ADMIN_PASSWORD")
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
select_ai_user = os.getenv("SELECT_AI_USER")


async def main():
    await select_ai.async_connect(user=admin_user, password=password, dsn=dsn)
    await select_ai.async_grant_http_access(
        users=select_ai_user, provider_endpoint="*.openai.azure.com"
    )
    print("Enabled AI provider for user: ", select_ai_user)


asyncio.run(main())

output:

Enabled AI provider for user: <select_ai_db_user>

1.12. Cloud provider profile samples

The repository includes complete profile-creation samples for AWS Bedrock, Azure OpenAI, and Google Gemini. Each sample:

  • grants the Select AI database user HTTP access to the provider endpoint;

  • creates or replaces a provider credential; and

  • creates or replaces a profile, then sends a test chat request.

Run the samples from the repository root after setting the common database variables:

  • SELECT_AI_ADMIN_USER and SELECT_AI_ADMIN_PASSWORD;

  • SELECT_AI_USER and SELECT_AI_PASSWORD;

  • SELECT_AI_DB_CONNECT_STRING; and

  • the provider-specific API key or access-key variables described below.

Do not store production secrets in source files or commit them to the repository. Adjust the sample region, model, resource, deployment, and object names for the provider account and database used by your application.

1.12.1. AWS Bedrock

The AWS Bedrock profile sample uses AWSProvider with the following provider settings:

  • region: AWS Bedrock region;

  • model: text-generation model identifier; and

  • embedding_model: embedding model identifier.

Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY before running it:

python samples/profile_create_aws.py

First, load the configuration and grant network access as the administrator:

import os
from pprint import pformat

import select_ai

AWS_HOST = "bedrock-runtime.us-east-1.amazonaws.com"
CREDENTIAL_NAME = "AWS_CRED"
PROFILE_NAME = "aws_bedrock_meta_prf"

admin_user = os.environ["SELECT_AI_ADMIN_USER"]
admin_password = os.environ["SELECT_AI_ADMIN_PASSWORD"]
app_user = os.environ["SELECT_AI_USER"]
app_password = os.environ["SELECT_AI_PASSWORD"]
dsn = os.environ["SELECT_AI_DB_CONNECT_STRING"]

# Equivalent to DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(..., 'http').
select_ai.connect(user=admin_user, password=admin_password, dsn=dsn)
try:
    select_ai.grant_network_access(
        users=app_user,
        host=AWS_HOST,
        privileges="http",
    )
finally:
    select_ai.disconnect()

Then connect as the application user to create the credential and profile. Append this code to the setup above:

select_ai.connect(user=app_user, password=app_password, dsn=dsn)
try:
    select_ai.create_credential(
        {
            "credential_name": CREDENTIAL_NAME,
            "username": os.environ["AWS_ACCESS_KEY_ID"],
            "password": os.environ["AWS_SECRET_ACCESS_KEY"],
        },
        replace=True,
    )

    profile = select_ai.Profile(
        profile_name=PROFILE_NAME,
        attributes=select_ai.ProfileAttributes(
            credential_name=CREDENTIAL_NAME,
            provider=select_ai.AWSProvider(
                region="us-east-1",
                model="meta.llama3-70b-instruct-v1:0",
                embedding_model="amazon.titan-embed-text-v1",
            ),
            object_list=[{"owner": app_user, "name": "CUSTOMERS"}],
            conversation=True,
            temperature=1,
            max_tokens=1500,
        ),
        replace=True,
    )

    print("Created profile:", profile.profile_name)
    print(pformat(profile.get_attributes().dict(exclude_null=False)))
    print("Chat response:", profile.chat("Reply with: AWS chat succeeded."))
finally:
    select_ai.disconnect()

The sample creates aws_bedrock_meta_prf and prints the saved attributes and a test response:

output:

Created profile: aws_bedrock_meta_prf
{'credential_name': 'AWS_CRED', 'provider': AWSProvider(...), ...}
Chat response: AWS chat succeeded.

1.12.2. Azure OpenAI

The Azure OpenAI profile sample uses AzureProvider with the following provider settings:

  • azure_resource_name: Azure OpenAI resource name;

  • azure_deployment_name: text-generation deployment name; and

  • azure_embedding_deployment_name: embedding deployment name.

Set AZURE_API_KEY before running it:

python samples/profile_create_azure.py

First, load the configuration and grant network access as the administrator:

import os
from pprint import pformat

import select_ai

AZURE_HOST = "adbst-ai-resource-japan-east.openai.azure.com"
AZURE_RESOURCE = "ADBST-AI-RESOURCE-JAPAN-EAST"
AZURE_DEPLOYMENT = "ADBST-AI-RESOURCE-JAPAN-EAST-DEPLOYMENT"
AZURE_EMBEDDING_DEPLOYMENT = (
    "ADBST-AI-RESOURCE-JAPAN-EAST-text-embedding-3-large"
)
CREDENTIAL_NAME = "AZUREAI_CRED"
PROFILE_NAME = "azureai_prf"

admin_user = os.environ["SELECT_AI_ADMIN_USER"]
admin_password = os.environ["SELECT_AI_ADMIN_PASSWORD"]
app_user = os.environ["SELECT_AI_USER"]
app_password = os.environ["SELECT_AI_PASSWORD"]
dsn = os.environ["SELECT_AI_DB_CONNECT_STRING"]

# Equivalent to DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(..., 'http').
select_ai.connect(user=admin_user, password=admin_password, dsn=dsn)
try:
    select_ai.grant_network_access(
        users=app_user,
        host=AZURE_HOST,
        privileges="http",
    )
finally:
    select_ai.disconnect()

Then connect as the application user to create the credential and profile. Append this code to the setup above:

select_ai.connect(user=app_user, password=app_password, dsn=dsn)
try:
    select_ai.create_credential(
        {
            "credential_name": CREDENTIAL_NAME,
            "username": "azure",
            "password": os.environ["AZURE_API_KEY"],
        },
        replace=True,
    )

    profile = select_ai.Profile(
        profile_name=PROFILE_NAME,
        attributes=select_ai.ProfileAttributes(
            credential_name=CREDENTIAL_NAME,
            provider=select_ai.AzureProvider(
                azure_resource_name=AZURE_RESOURCE,
                azure_deployment_name=AZURE_DEPLOYMENT,
                azure_embedding_deployment_name=AZURE_EMBEDDING_DEPLOYMENT,
            ),
            object_list=[{"owner": app_user, "name": "CUSTOMERS"}],
            conversation=True,
            temperature=1,
            max_tokens=1500,
            seed=20,
        ),
        replace=True,
    )
    p = select_ai.Profile.fetch(profile_name=PROFILE_NAME)
    print(p)
    print("Created profile:", profile.profile_name)
    print(pformat(profile.get_attributes().dict(exclude_null=False)))
    print("Chat response:", profile.chat("Reply with: Azure chat succeeded."))
finally:
    select_ai.disconnect()

The sample creates azureai_prf, fetches it to verify the saved profile, and prints a test response:

output:

Profile(profile_name=azureai_prf, ...)
Created profile: azureai_prf
{'credential_name': 'AZUREAI_CRED', 'provider': AzureProvider(...), ...}
Chat response: Azure chat succeeded.

1.12.3. Google Gemini (GCP)

The Google Gemini profile sample uses GoogleProvider with the following provider settings:

  • model: Gemini text-generation model identifier; and

  • embedding_model: Gemini embedding model identifier.

Set GOOGLE_API_KEY before running it:

python samples/profile_create_gcp.py

First, load the configuration and grant network access as the administrator:

import os
from pprint import pformat

import select_ai

GCP_HOST = "generativelanguage.googleapis.com"
CREDENTIAL_NAME = "GOOGLE_CRED"
PROFILE_NAME = "google_gemini_3_6_flash"

admin_user = os.environ["SELECT_AI_ADMIN_USER"]
admin_password = os.environ["SELECT_AI_ADMIN_PASSWORD"]
app_user = os.environ["SELECT_AI_USER"]
app_password = os.environ["SELECT_AI_PASSWORD"]
dsn = os.environ["SELECT_AI_DB_CONNECT_STRING"]

# Equivalent to DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(..., 'http').
select_ai.connect(user=admin_user, password=admin_password, dsn=dsn)
try:
    select_ai.grant_network_access(
        users=app_user,
        host=GCP_HOST,
        privileges="http",
    )
finally:
    select_ai.disconnect()

Then connect as the application user to create the credential and profile. Append this code to the setup above:

select_ai.connect(user=app_user, password=app_password, dsn=dsn)
try:
    select_ai.create_credential(
        {
            "credential_name": CREDENTIAL_NAME,
            "username": "GOOGLE",
            "password": os.environ["GOOGLE_API_KEY"],
        },
        replace=True,
    )

    profile = select_ai.Profile(
        profile_name=PROFILE_NAME,
        attributes=select_ai.ProfileAttributes(
            credential_name=CREDENTIAL_NAME,
            provider=select_ai.GoogleProvider(
                embedding_model="gemini-embedding-001",
                model="gemini-3.6-flash",
            ),
            temperature=1,
            max_tokens=1500,
            seed=20,
        ),
        replace=True,
    )

    print("Created profile:", profile.profile_name)
    print(pformat(profile.get_attributes().dict(exclude_null=False)))
    print("Chat response:", profile.chat("Reply with: GCP chat succeeded."))
finally:
    select_ai.disconnect()

The sample creates google_gemini_3_6_flash and prints the saved attributes and a test response:

output:

Created profile: google_gemini_3_6_flash
{'credential_name': 'GOOGLE_CRED', 'provider': GoogleProvider(...), ...}
Chat response: GCP chat succeeded.

1.13. Disable AI service provider

This method removes the ACL entry that allows database users to invoke an AI provider’s HTTP endpoint.

1.13.1. Disable using Sync API

import os

import select_ai

admin_user = os.getenv("SELECT_AI_ADMIN_USER")
password = os.getenv("SELECT_AI_ADMIN_PASSWORD")
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
select_ai_user = os.getenv("SELECT_AI_USER")

select_ai.connect(user=admin_user, password=password, dsn=dsn)
select_ai.revoke_http_access(
    users=select_ai_user, provider_endpoint="*.openai.azure.com"
)
print("Disabled AI provider for user: ", select_ai_user)

output:

Disabled AI provider for user:  <select_ai_db_user>

1.13.2. Disable using Async API

import asyncio
import os

import select_ai

admin_user = os.getenv("SELECT_AI_ADMIN_USER")
password = os.getenv("SELECT_AI_ADMIN_PASSWORD")
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
select_ai_user = os.getenv("SELECT_AI_USER")


async def main():
    await select_ai.async_connect(user=admin_user, password=password, dsn=dsn)
    await select_ai.async_revoke_http_access(
        users=select_ai_user, provider_endpoint="*.openai.azure.com"
    )
    print("Disabled AI provider for user: ", select_ai_user)


asyncio.run(main())

output:

Disabled AI provider for user:  <select_ai_db_user>