1. ProfileAttributes¶
This class defines attributes that manage and configure the behavior of an AI
profile. ProfileAttributes objects are created with
select_ai.ProfileAttributes() and passed to select_ai.Profile or
select_ai.AsyncProfile when creating or updating a profile.
Profile attributes describe what the profile can access, which AI provider it
uses, how much metadata is sent to the model, and how generation should behave.
Provider-specific settings, such as OCI region or Azure deployment name, are
configured on the provider object and assigned to the provider attribute.
1.1. Common required attributes¶
Most profiles need these attributes:
provider: Aselect_ai.Providerobject, such asselect_ai.OCIGenAIProviderorselect_ai.OpenAIProvider.credential_name: The database credential used to authenticate with the AI provider.object_list: The schemas, tables, or views that Select AI can use when generating SQL from natural language prompts.
For example:
attributes = select_ai.ProfileAttributes(
provider=select_ai.OCIGenAIProvider(
region="us-chicago-1",
oci_apiformat="GENERIC",
),
credential_name="my_oci_ai_profile_key",
object_list=[
{"owner": "SH", "name": "CUSTOMERS"},
{"owner": "SH", "name": "SALES"},
],
)
1.2. Attribute groups¶
Attribute |
Purpose |
|---|---|
|
Selects the AI provider, model, endpoint, and provider-specific options. |
|
Names the database credential used to authenticate with the AI provider. |
|
Defines which schemas, tables, or views are eligible for natural language to SQL generation. |
|
Controls whether Select AI sends metadata for the most relevant objects or for all eligible objects. |
|
Restricts generated SQL to objects in |
|
Controls whether additional database metadata is included in the prompt sent to the model. |
|
Helps prompts that depend on case-sensitive database values. |
|
Tunes model generation behavior. |
|
Enables conversation history for context-aware chat workflows. |
|
Provides persistent guidance, business rules, or response constraints for requests that use the profile. |
|
Set default languages for |
|
Configures retrieval-augmented generation and source reporting for vector index workflows. |
1.3. Object list examples¶
Include supported objects from a schema in the profile’s metadata scope:
object_list = [{"owner": "SH"}]
Include selected tables:
object_list = [
{"owner": "SH", "name": "CUSTOMERS"},
{"owner": "SH", "name": "SALES"},
{"owner": "SH", "name": "PRODUCTS"},
]
The object list does not grant database privileges. The connected user must already have the privileges needed to access the underlying objects.
Restrict generated SQL to the selected objects:
attributes = select_ai.ProfileAttributes(
provider=provider,
credential_name="my_oci_ai_profile_key",
object_list=[
{"owner": "SH", "name": "CUSTOMERS"},
{"owner": "SH", "name": "SALES"},
],
enforce_object_list=True,
)
1.4. Generation controls¶
Use generation controls when you need more predictable or constrained model responses:
attributes = select_ai.ProfileAttributes(
provider=provider,
credential_name="my_oci_ai_profile_key",
object_list=[{"owner": "SH"}],
max_tokens=1024,
temperature=0.1,
stop_tokens='[";"]',
)
1.5. Additional instructions¶
Use additional_instructions for guidance that should apply to every
request made with a profile:
attributes = select_ai.ProfileAttributes(
provider=provider,
credential_name="my_oci_ai_profile_key",
additional_instructions="Return concise, executable Python code.",
)
For guidance that applies to only one request, pass an attributes mapping
to an action method instead of changing the saved profile.
- class select_ai.ProfileAttributes(additional_instructions: str | None = None, annotations: bool | None = None, case_sensitive_values: bool | None = None, comments: bool | None = None, constraints: bool | None = None, conversation: bool | None = None, credential_name: str | None = None, enable_custom_source_uri: bool | None = None, enable_sources: bool | None = None, enable_source_offsets: bool | None = None, enforce_object_list: bool | None = None, max_tokens: int | None = 1024, object_list: List[Mapping] | None = None, object_list_mode: str | None = None, provider: Provider | None = None, seed: int | None = None, source_language: str | None = None, stop_tokens: str | None = None, streaming: str | None = None, temperature: float | None = None, target_language: str | None = None, vector_index_name: str | None = None)¶
Use this class to define attributes to manage and configure the behavior of an AI profile
- Parameters:
comments (bool) – True to include column comments in the metadata used for generating SQL queries from natural language prompts.
constraints (bool) – True to include referential integrity constraints such as primary and foreign keys in the metadata sent to the LLM.
conversation (bool) – Indicates if conversation history is enabled for a profile.
credential_name (str) – The name of the credential to access the AI provider APIs.
enforce_object_list (bool) – Specifies whether to restrict the LLM to generate SQL that uses only tables covered by the object list.
additional_instructions (str) – Persistent guidance that Select AI applies to requests that use the profile.
max_tokens (int) – Denotes the number of tokens to return per generation. Default is 1024.
object_list (List[Mapping]) – Array of JSON objects specifying the owner and object names that are eligible for natural language translation to SQL.
object_list_mode (str) – Specifies whether to send metadata for the most relevant tables or all tables to the LLM. Supported values are - ‘automated’ and ‘all’
provider (select_ai.Provider) – AI Provider
seed (int) – Signed 64-bit integer used to make model output more reproducible when the provider supports it.
source_language (str) – Default language of text passed to the translate operation. If omitted, the translation provider can detect the source language.
stop_tokens (str) – The generated text will be terminated at the beginning of the earliest stop sequence. Sequence will be incorporated into the text. The attribute value must be a valid array of string values in JSON format
temperature (float) – Temperature is a non-negative float number used to tune the degree of randomness. Lower temperatures mean less random generations.
target_language (str) – Default language into which text is translated. This is required by the database when no target language is supplied to the translate operation.
vector_index_name (str) – Name of the vector index
- async classmethod async_create(**kwargs)¶
- classmethod create(**kwargs)¶
- dict(exclude_null=True)¶
- json(exclude_null=True)¶
- classmethod keys()¶
- set_attribute(key, value)¶