This notebook prepares your Autonomous Database instance to use Oracle Select AI for Python.<\/p>\n
This setup must be completed before using NL2SQL, RAG, Synthetic Data Generation, and other Select AI features.<\/p>\n
Select AI enables SQL, PL/SQL, and Python access to Large Language Models (LLMs) and transformers from a range of AI providers from your database.\nIt supports SQL query generation from natural language prompts against your database data (NL2SQL), retrieval augmented generation (RAG), and synthetic data generation (SDG), among other features.<\/p>\n
See this video<\/a> for an introduction to Select AI.<\/p>\n To configure Select AI, both the ADMIN and a non-ADMIN users are required. You will need to specify access credentials to the AI provider(s) you want to use and, for RAG, cloud storage.\nNote that you can also use private endpoints to host your LLMs.<\/p>\n ADMIN Tasks:<\/strong><\/p>\n Select AI User Tasks:<\/strong><\/p>\n Note:<\/strong> This notebook includes examples based on OCI Generative AI Service. However multiple other AI providers are supported.\nUsers must have an account with a compatible AI provider API and provide access to Autonomous Database via database credentials.\nConsult the Select AI documentation<\/a> for details.<\/p>\n<\/blockquote>\n Copyright (c) 2025 Oracle Corporation<\/p>\n Select AI for Python documentation<\/a><\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### ADMIN: Grant 'EXECUTE' on DBMS_CLOUD packages","","The `ADMIN` user must grant execute privileges on `DBMS_CLOUD`, `DBMS_CLOUD_AI`, and `DBMS_CLOUD_PIPELINE` packages to the Select AI user. In SelectAI4Py, use ","`select_ai.enable_provider` to grant these privileges to a single user or list of users. Replace `SELECT_AI_USER` with your username.","","`select_ai.enable_provider` also enables users to invoke the AI (LLM) endpoint by adding them to the Access Control List (ACL).","","**Note:** This privilege is not required for OCI GenAI."],"enabled":true,"result":{"startTime":1760327451722,"interpreter":"md.low","endTime":1760327452062,"results":[{"message":" The Note:<\/strong> This privilege is not required for OCI GenAI.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":null,"message":["%python","","import select_ai","","# This grants EXECUTE on DBMS_CLOUD, DBMS_CLOUD_AI, and DBMS_CLOUD_PIPELINE","select_ai.enable_provider(users = [\"SELECT_AI_USER\"])"],"enabled":false,"result":{"startTime":1759775045287,"interpreter":"python.low","endTime":1759775048082,"results":null,"taskStatus":null,"forms":null,"status":null},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### Select AI User: Create cloud authentication credential","","The Select AI user must establish authentication credentials to their AI provider. Here, we are using Oracle Cloud Infrastructure (OCI) services. To enable","Select AI to use other AI providers, see the Select AI documentation<\/a>.","","The `select_ai.create_credential()` function securely stores your OCI identity information (user OCID, tenancy OCID, private key, and API key fingerprint). ","","The parameters include:","- `credential_name`: A unique identifier for this set of credentials (\"OCI_CRED2\" in this example)","- `user_ocid`: Your OCI user's unique identifier","- `tenancy_ocid`: Your OCI tenancy's unique identifier ","- `private_key`: Your RSA private key (in PEM format) that authenticates API requests","- `fingerprint`: The fingerprint of the public key uploaded to your OCI user account","","This credential can be referenced in subsequent operations that require OCI authentication, such as when accessing Cloud Object Storage buckets for data loading, ","external tables, or data movement operations. For Select AI, this enables secure access to your data stored in OCI Cloud Storage via a built-in automated pipeline.","","This is a standard pattern for setting up secure API access to Oracle Cloud services from within an Oracle Database. The credentials are stored securely within the ","database and can be managed using various `select_ai` functions.","",">Note: Replace all placeholder values with your specific values."],"enabled":true,"result":{"startTime":1760327452480,"interpreter":"md.low","endTime":1760327452816,"results":[{"message":" The Select AI user must establish authentication credentials to their AI provider. Here, we are using Oracle Cloud Infrastructure (OCI) services. To enable\nSelect AI to use other AI providers, see the Select AI documentation<\/a>.<\/p>\n The The parameters include:<\/p>\n This credential can be referenced in subsequent operations that require OCI authentication, such as when accessing Cloud Object Storage buckets for data loading,\nexternal tables, or data movement operations. For Select AI, this enables secure access to your data stored in OCI Cloud Storage via a built-in automated pipeline.<\/p>\n This is a standard pattern for setting up secure API access to Oracle Cloud services from within an Oracle Database. The credentials are stored securely within the\ndatabase and can be managed using various Note: Replace all placeholder values with your specific values.<\/p>\n<\/blockquote>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":null,"title":"Create a cloud authentication credential for OCI GenAI Services - template example","message":["%python","","import select_ai","","credential = {"," \"credential_name\": \"OCI_CRED2\","," \"user_ocid\": \"ocid1.user.oc1...\", # Replace with your user OCID"," \"tenancy_ocid\": \"ocid1.tenancy.oc1...\", # Replace with your tenancy OCID"," \"private_key\": \"MIIEogIBAAK...\", # Replace with your private key"," \"fingerprint\": \"12:34:56:78:9a:bc:...\" # Replace with your fingerprint","}","","# Create the credential, replacing it if it exists","select_ai.create_credential(credential = credential, replace = True)"],"enabled":false,"result":null,"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":null,"row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":null},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Verify the cloud credential is defined","message":["%sql","","SELECT OWNER, CREDENTIAL_NAME, ENABLED ","FROM ALL_CREDENTIALS ","WHERE CREDENTIAL_NAME = 'OCI_CRED2';"],"enabled":true,"result":{"startTime":1760327453191,"interpreter":"sql.low","endTime":1760327455056,"results":[{"message":"OWNER\tCREDENTIAL_NAME\tENABLED\nSELECT_AI_USER\tOCI_CRED2\tTRUE\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","","### AI Profile Overview","","Users can create different profiles for various Select AI scenarios, such as using different credentials, AI providers, transformers, or configuration parameters.","","Here, we create three profile objects:","","1. **OCI_GENAI_PY_DEMO:** A primary profile for chat, NL2SQL, and SDG","2. **OCI_GENAI_RAG_PY_DEMO:** A profile for RAG ","3. **IN_DB_TRANSFORMER_RAG_DEMO:** A profile for RAG using an in-database transformer for embeddings","","These profile objects allow you to invoke Select AI operations using their specific configurations. You'll need to create a proxy object to leverage these profiles in the chat, NL2SQL, SDG, and RAG notebooks, as those will be separate database sessions.","","> Note: The annotations feature referenced in each profile requires Autonomous Database 23ai. Select AI RAG also requires 23ai."],"enabled":true,"result":{"startTime":1760327455425,"interpreter":"md.low","endTime":1760327455774,"results":[{"message":" Users can create different profiles for various Select AI scenarios, such as using different credentials, AI providers, transformers, or configuration parameters.<\/p>\n Here, we create three profile objects:<\/p>\n These profile objects allow you to invoke Select AI operations using their specific configurations. You'll need to create a proxy object to leverage these profiles in the chat, NL2SQL, SDG, and RAG notebooks, as those will be separate database sessions.<\/p>\n Note: The annotations feature referenced in each profile requires Autonomous Database 23ai. Select AI RAG also requires 23ai.<\/p>\n<\/blockquote>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### Create an AI profile for chat, NL2SQL, and SDG","","We'll create an AI profile named `OCI_GENAI_PY_DEMO` to support chat interactions, querying the database using natural language, and generating synthetic data.","","This profile uses OCI Generative AI Service as the AI provider and the `meta.llama-3.1-70b-instruct` LLM.","","In this profile, we enable Select AI features including conversation support, comments, constraints, and annotations.","","The object_list in the profile can be specified to determine which database tables the AI features can access. It highlights the owner field (e.g., SH) to specify","the schema. You can optionally list individual tables, as shown here with `CUSTOMERS`, `SALES`, `PRODUCTS`, and `COUNTRIES`.","","With this profile, you'll be able to:","","* Run natural language queries like 'Show me the top 3 baby boomer big spending customers' and have it generate the corresponding SQL query (NL2SQL)","* Engage in interactive chat conversations with the LLM (Chat)","* Generate realistic synthetic data based on your existing table structures and data patterns (SDG)","","> Note, Select AI also enables automated selection of schema metadata for augmented NL2SQL prompts, supporting schemas with a large number of tables and views, ","simplifying AI profile specification, and can reduce the metadata volume sent to the LLM. Specify `\"object_list_mode\": \"automated\"` in the `DBMS_CLOUD_AI.CREATE_PROFILE` attributes list to enable this feature. See \"Automatically Detect Relevant Table Metadata\" in Example: Improve SQL Query Generation for details<\/a>."],"enabled":true,"result":{"startTime":1760327456133,"interpreter":"md.low","endTime":1760327456455,"results":[{"message":" We'll create an AI profile named This profile uses OCI Generative AI Service as the AI provider and the In this profile, we enable Select AI features including conversation support, comments, constraints, and annotations.<\/p>\n The object_list in the profile can be specified to determine which database tables the AI features can access. It highlights the owner field (e.g., SH) to specify\nthe schema. You can optionally list individual tables, as shown here with With this profile, you'll be able to:<\/p>\n Note, Select AI also enables automated selection of schema metadata for augmented NL2SQL prompts, supporting schemas with a large number of tables and views,\nsimplifying AI profile specification, and can reduce the metadata volume sent to the LLM. Specify We'll create an AI profile named Additionally, we'll specify a vector index named Note, we haven't created In this profile, we enable conversations and set it as the current profile after creation.<\/p>\n The RAG profile will allow you to ask questions about customer documentation in your vector store, such as 'What are our service level agreements for high-value customers\nin the Asia Pacific region?' and receive answers enhanced with information derived from your object storage documents.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Select AI user: OCI_GENAI_RAG_PY_DEMO profile definition","message":["%python","","provider = select_ai.OCIGenAIProvider("," model = \"meta.llama-4-maverick-17b-128e-instruct-fp8\","," embedding_model = \"cohere.embed-english-v3.0\")","","profile_attributes = select_ai.ProfileAttributes("," provider = provider,"," credential_name = \"OCI_CRED2\","," vector_index_name = \"MY_VECTOR_INDEX2\","," enable_source_offsets = True,"," conversation = True)","","profile = select_ai.Profile("," profile_name = \"OCI_GENAI_RAG_PY_DEMO\","," attributes = profile_attributes,"," description = \"Supports RAG with semantic search to augment prompts using a vector store\","," replace = True)","","print(profile.profile_name + \" profile has been successfully created\")"],"enabled":true,"result":{"startTime":1760327461267,"interpreter":"python.low","endTime":1760327462524,"results":[{"message":"OCI_GENAI_RAG_PY_DEMO profile has been successfully created\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","","#### Transformer model selection ","The `embedding_model` parameter allows you to choose between different text embedding models and deployment approaches. You can use third-party hosted transformer ","models from providers like OpenAI or Cohere, or use in-database transformers as described below.","","Oracle provides pre-built ONNX transformer models that have been augmented through a specialized pipeline to generate embeddings directly within the database. The following models are available for download.","[Right-click link ? Save As to download]<\/span>:","","- ALL_MINILM_L12_V2<\/a> (384 dimensions) - Optimized for English content. ","- MULTILINGUAL_E5_SMALL<\/a> (384 dimensions) - Supports 100+ languages. ","- CLIP_VIT_BASE_PATCH32_IMG<\/a> (512 dimensions) - CLIP model for image embeddings. ","- CLIP_VIT_BASE_PATCH32_TXT<\/a> (512 dimensions) - CLIP model for text embeddings. ","","Each model offers different capabilities and embedding dimensions. Third-party hosted models may provide specialized capabilities or larger embedding dimensions, while ","in-database models provide efficient embedding generation without external API calls. You can switch the active embedding model at any time by updating the profile with `profile.set_attribute()`, as demonstrated below in this section.","","In the following steps, we'll load these embedding models into the database. For additional information on these models, refer to these blogs:","","Prebuilt ONNX Models for Embedding Generation<\/a>"," The Oracle provides pre-built ONNX transformer models that have been augmented through a specialized pipeline to generate embeddings directly within the database. The following models are available for download.\n[Right-click link ? Save As to download]<\/span>:<\/p>\n Each model offers different capabilities and embedding dimensions. Third-party hosted models may provide specialized capabilities or larger embedding dimensions, while\nin-database models provide efficient embedding generation without external API calls. You can switch the active embedding model at any time by updating the profile with In the following steps, we'll load these embedding models into the database. For additional information on these models, refer to these blogs:<\/p>\n Prebuilt ONNX Models for Embedding Generation<\/a>\n Once the profiles are defined, we can list and review their configurations. The following paragraph prints each profile's name and description, providing a\nsummary of the defined profiles. The second retrieves and displays all profile attributes,such as model type, schema handling options, and object list settings.<\/p>\n Together, these steps verify that each profile is correctly configured before being used in Select AI queries.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":0,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"View the profile listings","message":["%python","","for profile_name in [\"OCI_GENAI_PY_DEMO\", \"OCI_GENAI_RAG_PY_DEMO\", \"IN_DB_TRANSFORMER_RAG_DEMO\"]:"," profile = select_ai.Profile(profile_name = profile_name)"," print(\"Profile: \" + profile.profile_name)"," print(\"Description: \" + (profile.description or \"\"))"," print(\"-\" * 10)"],"enabled":true,"result":{"startTime":1760327545214,"interpreter":"python.low","endTime":1760327545606,"results":[{"message":"Profile: OCI_GENAI_PY_DEMO\nDescription: Profile for chat, NL2SQL, and SDG\n----------\nProfile: OCI_GENAI_RAG_PY_DEMO\nDescription: Supports RAG with semantic search to augment prompts using a vector store\n----------\nProfile: IN_DB_TRANSFORMER_RAG_DEMO\nDescription: Supports RAG with semantic search to augment prompts using a vector store using in-database transformer\n----------\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"View profile attributes","message":["%python","","from pprint import pprint","","profile_names = [\"OCI_GENAI_PY_DEMO\", \"OCI_GENAI_RAG_PY_DEMO\", \"IN_DB_TRANSFORMER_RAG_DEMO\"]","","for i, profile_name in enumerate(profile_names):"," try:"," profile = select_ai.Profile(profile_name = profile_name)"," attributes = profile.get_attributes()"," print(\"\\nProfile: \" + profile_name)"," pprint(attributes.dict(exclude_null=False))"," "," # Add dashes between profiles (not after the last one)"," if i < len(profile_names) - 1:"," print(\"-\" * 50)"," except:"," pass"],"enabled":true,"result":{"startTime":1760327545974,"interpreter":"python.low","endTime":1760327546508,"results":[{"message":"\nProfile: OCI_GENAI_PY_DEMO\n{'annotations': 'true',\n 'case_sensitive_values': None,\n 'comments': 'true',\n 'constraints': 'true',\n 'conversation': 'true',\n 'credential_name': 'OCI_CRED2',\n 'enable_source_offsets': None,\n 'enable_sources': None,\n 'enforce_object_list': None,\n 'max_tokens': '1024',\n 'object_list': '[{\"owner\":\"SH\",\"name\":\"CUSTOMERS\"},{\"owner\":\"SH\",\"name\":\"SALES\"},{\"owner\":\"SH\",\"name\":\"PRODUCTS\"},{\"owner\":\"SH\",\"name\":\"COUNTRIES\"}]',\n 'object_list_mode': None,\n 'provider': OCIGenAIProvider(embedding_model=None,\n model=None,\n provider_name='oci',\n provider_endpoint=None,\n region=None,\n oci_apiformat=None,\n oci_compartment_id=None,\n oci_endpoint_id=None,\n oci_runtimetype=None),\n 'seed': None,\n 'stop_tokens': None,\n 'streaming': None,\n 'temperature': None,\n 'vector_index_name': None}\n--------------------------------------------------\n\nProfile: OCI_GENAI_RAG_PY_DEMO\n{'annotations': None,\n 'case_sensitive_values': None,\n 'comments': None,\n 'constraints': None,\n 'conversation': 'true',\n 'credential_name': 'OCI_CRED2',\n 'enable_source_offsets': 'true',\n 'enable_sources': None,\n 'enforce_object_list': None,\n 'max_tokens': '1024',\n 'object_list': None,\n 'object_list_mode': None,\n 'provider': OCIGenAIProvider(embedding_model='cohere.embed-english-v3.0',\n model='meta.llama-4-maverick-17b-128e-instruct-fp8',\n provider_name='oci',\n provider_endpoint=None,\n region=None,\n oci_apiformat=None,\n oci_compartment_id=None,\n oci_endpoint_id=None,\n oci_runtimetype=None),\n 'seed': None,\n 'stop_tokens': None,\n 'streaming': None,\n 'temperature': None,\n 'vector_index_name': 'MY_VECTOR_INDEX2'}\n--------------------------------------------------\n\nProfile: IN_DB_TRANSFORMER_RAG_DEMO\n{'annotations': None,\n 'case_sensitive_values': None,\n 'comments': None,\n 'constraints': None,\n 'conversation': 'true',\n 'credential_name': 'OCI_CRED2',\n 'enable_source_offsets': 'true',\n 'enable_sources': None,\n 'enforce_object_list': None,\n 'max_tokens': '1024',\n 'object_list': None,\n 'object_list_mode': None,\n 'provider': OCIGenAIProvider(embedding_model='database:MULTILINGUAL_E5_SMALL',\n model=None,\n provider_name='oci',\n provider_endpoint=None,\n region=None,\n oci_apiformat=None,\n oci_compartment_id=None,\n oci_endpoint_id=None,\n oci_runtimetype=None),\n 'seed': None,\n 'stop_tokens': None,\n 'streaming': None,\n 'temperature': None,\n 'vector_index_name': 'MY_VECTOR_INDEX3'}\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### Next Steps","","After completing this setup, you're ready to use Select AI's features through the following companion notebooks:","","- **SelectAI4Py -1- Chat**","- **SelectAI4Py -2- Natural Language to SQL (NL2SQL)** ","- **SelectAI4Py -3- Retrieval Augmented Generation (RAG)** ","- **SelectAI4Py -4- Synthetic Data Generation (SDG)** ","","These notebooks provide step-by-step instructions for using each feature with the profiles you've configured."],"enabled":true,"result":{"startTime":1760327546868,"interpreter":"md.low","endTime":1760327547201,"results":[{"message":" After completing this setup, you're ready to use Select AI's features through the following companion notebooks:<\/p>\n These notebooks provide step-by-step instructions for using each feature with the profiles you've configured.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","# End of Script"],"enabled":true,"result":{"startTime":1760327547557,"interpreter":"md.low","endTime":1760327547886,"results":[{"message":" Select AI enables you to interact with large language models (LLMs) directly from your database through natural language prompts.\nThe The You can apply manual prompt engineering techniques to customize results.<\/p>\n Copyright (c) 2025 Oracle Corporation<\/p>\n Select AI for Python documentation<\/a><\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","## Prerequisites","","Before proceeding, you must complete the required setup steps in the **SelectAI4Py -0- Prerequisites and Setup** notebook:","","* ADMIN: grants and network access","* Select AI user: OCI_GENAI_PY_DEMO profile definition","","These steps are required for the chat commands in this notebook to run correctly."],"enabled":true,"result":{"startTime":1760327942634,"interpreter":"md.low","endTime":1760327942960,"results":[{"message":" Before proceeding, you must complete the required setup steps in the SelectAI4Py -0- Prerequisites and Setup<\/strong> notebook:<\/p>\n These steps are required for the chat commands in this notebook to run correctly.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Create a profile proxy object for the current session","message":["%python","","import select_ai","","profile = select_ai.Profile(profile_name = \"OCI_GENAI_PY_DEMO\")"],"enabled":true,"result":{"startTime":1760327943346,"interpreter":"python.low","endTime":1760327943716,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Use 'chat' to learn about Autonomous Database","message":["%python","","response = profile.chat(prompt = \"What is Oracle Autonomous Database?\")","print(response)"],"enabled":true,"result":{"startTime":1760327944101,"interpreter":"python.low","endTime":1760327960999,"results":[{"message":"Oracle Autonomous Database is a cloud-based database service that uses artificial intelligence (AI) and machine learning (ML) to automate many of the tasks associated with managing a database. It is a self-driving, self-securing, and self-repairing database that eliminates the need for manual database administration, allowing users to focus on higher-level tasks.\n\nKey features of Oracle Autonomous Database include:\n\n1. **Autonomous Operations**: The database automatically performs tasks such as provisioning, patching, upgrading, and tuning, without human intervention.\n2. **Self-Driving**: The database can automatically optimize its own performance, adjust to changing workloads, and detect and respond to security threats.\n3. **Self-Securing**: The database includes advanced security features, such as encryption, access control, and auditing, to protect sensitive data.\n4. **Self-Repairing**: The database can automatically detect and repair errors, reducing downtime and improving overall availability.\n5. **Machine Learning**: The database uses machine learning algorithms to analyze usage patterns, predict performance, and optimize resource allocation.\n6. **Cloud-Native**: The database is designed to run on Oracle Cloud Infrastructure (OCI), providing a scalable, on-demand, and pay-as-you-go pricing model.\n\nOracle Autonomous Database offers several benefits, including:\n\n1. **Reduced Administration**: Automated database management reduces the need for manual intervention, freeing up DBAs to focus on higher-level tasks.\n2. **Improved Performance**: The database's self-optimizing capabilities ensure optimal performance, even in complex and dynamic environments.\n3. **Enhanced Security**: Advanced security features and automated patching reduce the risk of security breaches and data loss.\n4. **Increased Availability**: Self-repairing capabilities minimize downtime, ensuring high availability and reliability.\n5. **Lower Costs**: Automated management and optimized resource allocation reduce operational costs and improve ROI.\n\nOracle Autonomous Database is available in several editions, including:\n\n1. **Autonomous Transaction Processing (ATP)**: Optimized for transactional workloads, such as OLTP and real-time analytics.\n2. **Autonomous Data Warehouse (ADW)**: Optimized for data warehousing and analytics workloads.\n3. **Autonomous JSON Database**: Optimized for JSON data storage and processing.\n\nOverall, Oracle Autonomous Database represents a significant shift in the way databases are managed and operated, enabling organizations to focus on innovation and growth, rather than manual database administration.\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Use conversation history to find out when \"it\" was released","message":["%python","","# Adds previous prompt to this prompt in a \"conversation\", which is provided to the LLM","response = profile.chat(prompt = \"when was it first released?\")","print(response)"],"enabled":true,"result":{"startTime":1760327961379,"interpreter":"python.low","endTime":1760327967454,"results":[{"message":"Oracle Autonomous Database was first released in March 2018, as part of Oracle Cloud Infrastructure (OCI). It was initially announced by Oracle CEO Mark Hurd at the Oracle OpenWorld conference in October 2017, and was made generally available to customers in March 2018.\n\nAt the time of its release, Oracle Autonomous Database was available in two main services:\n\n1. **Autonomous Data Warehouse (ADW)**: Released in March 2018, ADW was the first autonomous database service to be made available, and was designed to support data warehousing and analytics workloads.\n2. **Autonomous Transaction Processing (ATP)**: Released in August 2018, ATP was the second autonomous database service to be made available, and was designed to support transactional workloads, such as OLTP and real-time analytics.\n\nSince its initial release, Oracle Autonomous Database has undergone several updates and enhancements, with new features and services being added regularly.\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Use conversation history to learn how \"it\" integrates with Oracle Cloud services","message":["%python","","response = profile.chat(prompt = \"How does it integrate with other Oracle Cloud services?\")","print(response)"],"enabled":true,"result":{"startTime":1760327967839,"interpreter":"python.low","endTime":1760327985832,"results":[{"message":"Oracle Autonomous Database integrates seamlessly with other Oracle Cloud services, enabling a wide range of use cases and applications. Here are some examples of how it integrates with other Oracle Cloud services:\n\n1. **Oracle Cloud Infrastructure (OCI)**: Autonomous Database is built on top of OCI, which provides a scalable, secure, and high-performance infrastructure for the database.\n2. **Oracle Cloud Applications**: Autonomous Database can be used as a database service for Oracle Cloud Applications, such as Oracle ERP Cloud, Oracle HCM Cloud, and Oracle CX Cloud.\n3. **Oracle Analytics Cloud**: Autonomous Database can be used as a data source for Oracle Analytics Cloud, which provides a comprehensive analytics platform for data visualization, reporting, and machine learning.\n4. **Oracle Machine Learning**: Autonomous Database can be used with Oracle Machine Learning, which provides a platform for building, deploying, and managing machine learning models.\n5. **Oracle Data Integration**: Autonomous Database can be used with Oracle Data Integration, which provides a platform for integrating data from multiple sources, transforming data, and loading data into the database.\n6. **Oracle GoldenGate**: Autonomous Database can be used with Oracle GoldenGate, which provides a platform for real-time data integration and replication.\n7. **Oracle API Gateway**: Autonomous Database can be used with Oracle API Gateway, which provides a platform for creating, managing, and securing APIs.\n8. **Oracle Identity Cloud Service**: Autonomous Database can be used with Oracle Identity Cloud Service, which provides a platform for identity and access management.\n\nSome of the key integration benefits include:\n\n1. **Simplified Data Management**: Autonomous Database can be used to manage data from multiple Oracle Cloud services, providing a single source of truth for data.\n2. **Improved Analytics**: Autonomous Database can be used to provide real-time analytics and insights to Oracle Cloud Applications and other services.\n3. **Enhanced Security**: Autonomous Database can be used to provide advanced security features, such as encryption and access control, to Oracle Cloud services.\n4. **Increased Agility**: Autonomous Database can be used to provide rapid provisioning and deployment of databases, enabling faster time-to-market for Oracle Cloud services.\n5. **Better Decision-Making**: Autonomous Database can be used to provide real-time data and insights to Oracle Cloud services, enabling better decision-making and improved business outcomes.\n\nSome of the key use cases for Autonomous Database integration with other Oracle Cloud services include:\n\n1. **Real-time Analytics**: Using Autonomous Database with Oracle Analytics Cloud to provide real-time analytics and insights to Oracle Cloud Applications.\n2. **Data Warehousing**: Using Autonomous Database with Oracle Data Integration to integrate data from multiple sources and load it into a data warehouse.\n3. **Machine Learning**: Using Autonomous Database with Oracle Machine Learning to build, deploy, and manage machine learning models.\n4. **API-First Development**: Using Autonomous Database with Oracle API Gateway to create, manage, and secure APIs for Oracle Cloud services.\n5. **Cloud-Native Applications**: Using Autonomous Database with Oracle Cloud Infrastructure to build cloud-native applications that are scalable, secure, and high-performance.\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","","#### Use GENERATE for dynamic action selection","","The `generate()` method handles different Select AI actions specified as an argument. Additional parameters like conversation IDs can be passed for context-aware ","conversations. ","","The example below uses the 'chat' action to generate a promotional email from structured prompts."],"enabled":true,"result":{"startTime":1760327986218,"interpreter":"md.low","endTime":1760327986560,"results":[{"message":" The The example below uses the 'chat' action to generate a promotional email from structured prompts.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Generate a promotional email using 'chat'","message":["%python","","prompt = \"\"\"Create a promotional email with a catchy subject line and convincing email text. Follow the task rules:","{"," \"task\": \"Draft a promotional message for a new eco-friendly travel mug\","," \"task_rules\": \"1. Highlight its reusable and sustainable features."," 2. Use a friendly and engaging tone."," 3. Suggest a limited-time discount to encourage quick action.,"," 4. Include friendly, uplifting emoticons\","," \"audience\": \"General consumers interested in sustainable living\"","}\"\"\"","","response = profile.generate("," prompt = prompt,"," action = select_ai.Action.CHAT",")","","print(response)"],"enabled":true,"result":{"startTime":1760327986926,"interpreter":"python.low","endTime":1760328001104,"results":[{"message":"Here's a promotional email that meets the task rules:\n\n**Subject: ?? Sip Sustainably with Our New Eco-Friendly Travel Mug! ?**\n\nDear Fellow Eco-Warriors! ?\n\nAre you tired of using disposable coffee cups that harm our planet? ?? We've got the perfect solution for you! Introducing our brand new, eco-friendly travel mug that's not only stylish but also reusable and sustainable! ?\n\nOur travel mug is made from high-quality, BPA-free materials that are designed to last. With its double-walled insulation, your drinks will stay hot or cold for hours, and the leak-proof lid ensures that you can take it on-the-go without any spills. ? Plus, it's dishwasher safe, making it easy to clean and maintain.\n\nBy switching to our eco-friendly travel mug, you'll be reducing your carbon footprint and helping to minimize waste. ? Every small change counts, and we're proud to be a part of the sustainable living movement! ?\n\nTo celebrate the launch of our new travel mug, we're offering a limited-time discount of 15% off your first purchase! ? Just use the code ECO15 at checkout to redeem your discount. Don't miss out on this amazing opportunity to upgrade your daily coffee routine while doing your part for the planet. ?\n\nHurry! This offer is only valid for the next two weeks, so be sure to order your eco-friendly travel mug today and start sipping sustainably! ?\n\n**Get Your Eco-Friendly Travel Mug Now and Join the Sustainable Living Movement! ?**\n\nBest,\nThe [Your Company Name] Team ?\n\nP.S. Don't forget to share your eco-friendly travel mug with your friends and family on social media and tag us! ? We'd love to see how you're using your new mug and living sustainably. ?\n\nThis promotional email meets the task rules by:\n\n1. Highlighting the reusable and sustainable features of the travel mug.\n2. Using a friendly and engaging tone to connect with the audience.\n3. Suggesting a limited-time discount to encourage quick action.\n4. Including friendly, uplifting emoticons to add a touch of personality to the email. ?\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Generate a customer email response about a return policy using 'chat'","message":["%python","","prompt = \"\"\"Respond to a customer query with succinct and clear instructions about the return policy of a company. Follow the task rules:","{"," \"task\": \"Provide a customer-friendly response to a query about the company return policy\","," \"task_rules\": \"1. The return policy allows for returns within 30 days of purchase with the original receipt. "," 2. Products must be in new, unused condition with original packaging. "," 3. The response should be concise, professional, and helpful, aimed at educating the customer about the return process. "," 4. Ensure the response is polite and assures the customer that their concerns are understood and valued.\","," \"audience\": \"Customer support agents\"","}\"\"\"","","response = profile.generate("," prompt = prompt,"," action = select_ai.Action.CHAT",")","","print(response)"],"enabled":true,"result":{"startTime":1760328001475,"interpreter":"python.low","endTime":1760328011173,"results":[{"message":"Dear valued customer,\n\nThank you for reaching out to us about our return policy. We understand that you may have questions or concerns about returning a product, and we're here to help.\n\nTo initiate a return, please note the following guidelines:\n\n* Returns are accepted within 30 days of purchase with the original receipt.\n* Products must be in new, unused condition with original packaging.\n\nIf your return meets these criteria, you can start the process by contacting our customer support team. We'll be happy to guide you through the next steps and provide a return merchandise authorization (RMA) number.\n\nPlease have your order number and reason for return ready when you contact us. We'll do our best to process your return quickly and efficiently.\n\nYour satisfaction is our top priority, and we appreciate your business. If you have any further questions or concerns, please don't hesitate to reach out. We're here to help and value your feedback.\n\nThank you for choosing our company, and we look forward to assisting you with your return.\n\nBest regards,\n[Your Company Name] Customer Support Team\n\nThis response follows the task rules by:\n\n1. Clearly stating the return policy, including the 30-day return window and the requirement for the original receipt.\n2. Specifying the condition of the products that can be returned, including new and unused condition with original packaging.\n3. Providing concise and professional instructions on how to initiate a return.\n4. Being polite and assuring the customer that their concerns are understood and valued, while also educating them about the return process.\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Generate a customized email promoting vacation ideas using 'chat'","message":["%python","","prompt = \"\"\"Generate email using the JSON specification ","{\"task\": \"Pick 5 great things to do at the location\","," \"task_rules\": \"1. Encourage the customer to do these things. Really sell them as to why it would be right for them "," 2. Consider all the information about the customer that's provided, including family and dog situation, whether they have a car and income"," 3. Format the result with emojis and make it fun\","," \"last_name\": \"Mouly\","," \"first_name\": \"Jennine\","," \"location\": \"Paris, ?le-De-France\","," \"age\": 37,"," \"gender\": \"Female\","," \"has_kids\": \"NO\","," \"num_cars\": 2,"," \"income_level\": \"F: Above 110,000\","," \"dog_owner\": \"NO\"}\"\"\"","","response = profile.generate("," prompt = prompt,"," action = select_ai.Action.CHAT",")","","print(response)"],"enabled":true,"result":{"startTime":1760328011547,"interpreter":"python.low","endTime":1760328027627,"results":[{"message":"Subject: ? 5 Amazing Things to Do in Paris, Jennine! ??\n\nDear Jennine Mouly,\n\nBonjour! ?? We're thrilled to share with you the top 5 things to do in the City of Love, Paris! ? As a high-income earner with a love for luxury, we've curated a list of experiences that will make your stay in Paris truly unforgettable. ?\n\n1. **Seine River Cruise** ?\u200d??: Imagine gliding along the Seine, taking in the stunning views of the city's landmarks while sipping champagne. ? With your high income, you can afford to indulge in a luxurious cruise experience that will leave you feeling like royalty. ?\n2. **Visit the Louvre Museum** ?: As a sophisticated traveler, you'll appreciate the world-class art and history that the Louvre has to offer. ? With over 550,000 works of art, you'll be spoiled for choice. Take your time to explore the museum, and don't forget to snap a photo in front of the iconic glass pyramid! ?\n3. **Explore the Champs-?lys?es** ??: This famous avenue is a shopper's paradise, with high-end boutiques and designer flagships. ?\u200d?? With your income level, you can treat yourself to a luxury shopping spree, and enjoy the finer things in life. ??\n4. **Dine at a Michelin-Starred Restaurant** ?: Paris is renowned for its culinary scene, and with your refined taste, you'll appreciate the exquisite cuisine at a Michelin-starred restaurant. ? From foie gras to escargots, you'll be treated to a gastronomic experience that will leave you wanting more. ?\n5. **Take a Day Trip to the Palace of Versailles** ?: With two cars at your disposal, you can easily take a day trip to the stunning Palace of Versailles. ? Explore the opulent halls, gardens, and fountain shows, and experience the grandeur of French history. ?\n\nThese experiences are tailored to your lifestyle, Jennine, and we're confident that you'll have an unforgettable time in Paris. ? With your love of luxury and high income, you deserve to indulge in the best that the city has to offer. ?\n\nBon voyage, and we hope you have a fantastic time in Paris! ??\n\nBest regards,\n[Your Name] ?\u200d??\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Load travel recommendations and customer feedback data sets","message":["%python\r","\r","# hide for demo\r","\r","import oml\r","\r","# Drop tables if they exist\r","try:\r"," oml.drop(table=\"TRAVEL_RECOMMENDATIONS\")\r","except:\r"," pass\r","\r","try:\r"," oml.drop(table=\"CUSTOMER_FEEDBACK\")\r","except:\r"," pass\r","\r","# Create and load travel_recommendations table\r","travel_data = [\r"," (1, 'Pick 5 great things to do at the location', '1. Encourage the customer to do these things. Really sell them as to why it would be right for them 2. Take into account all the information about the customer that''s provided, including family and dog situation, whether they have a car and income 3. Format the result with emojis and make it fun', 'Mouly', 'Jennine', 'Paris, ?le-De-France', 37, 'Female', 'NO', 2, 'F: Above 110,000', 'NO'),\r"," (2, 'Pick 5 great things to do at the location', '1. Encourage the customer to do these things. Really sell them as to why it would be right for them 2. Take into account all the information about the customer that''s provided, including family and dog situation, whether they have a car and income 3. Format the result with emojis and make it fun', 'Kwon', 'Min-Jae', 'Seoul, South Korea', 45, 'Male', 'YES', 1, 'E: 80,000\u2013110,000', 'YES'),\r"," (3, 'Pick 5 great things to do at the location', '1. Encourage the customer to do these things. Really sell them as to why it would be right for them 2. Take into account all the information about the customer that''s provided, including family and dog situation, whether they have a car and income 3. Format the result with emojis and make it fun', 'Nguyen', 'Linh', 'Hoi An, Vietnam', 29, 'Female', 'NO', 0, 'C: 30,000\u201350,000', 'NO'),\r"," (4, 'Pick 5 great things to do at the location', '1. Encourage the customer to do these things. Really sell them as to why it would be right for them 2. Take into account all the information about the customer that''s provided, including family and dog situation, whether they have a car and income 3. Format the result with emojis and make it fun', 'Gonzalez', 'Carlos', 'Barcelona, Spain', 34, 'Male', 'YES', 2, 'D: 50,000\u201380,000', 'YES'),\r"," (5, 'Pick 5 great things to do at the location', '1. Encourage the customer to do these things. Really sell them as to why it would be right for them 2. Take into account all the information about the customer that''s provided, including family and dog situation, whether they have a car and income 3. Format the result with emojis and make it fun', 'Smith', 'Angela', 'New York City, USA', 41, 'Female', 'NO', 1, 'F: Above 110,000', 'NO')\r","]\r","\r","import pandas as pd\r","travel_df = pd.DataFrame(travel_data, columns=['ID', 'TASK', 'TASK_RULES', 'LAST_NAME', 'FIRST_NAME', 'LOCATION', 'AGE', 'GENDER', 'HAS_KIDS', 'NUM_CARS', 'INCOME_LEVEL', 'DOG_OWNER'])\r","oml.create(travel_df, table=\"TRAVEL_RECOMMENDATIONS\")\r","\r","# Create and load customer_feedback table\r","feedback_data = [\r"," (1, 'Morgan', 'Smith', 'Pixel 8', 'Absolutely love this phone! The battery lasts forever and the camera is top-notch.'),\r"," (2, 'Morgan', 'Smith', 'OnePlus 12', 'Incredible value for the price. Exceeded my expectations!'),\r"," (3, 'Reese', 'Martinez', 'Xperia 1 V', 'Best smartphone I have ever used. Highly recommend!'),\r"," (4, 'Jordan', 'Anderson', 'Galaxy S24', 'Absolutely love this phone! The battery lasts forever and the camera is top-notch.'),\r"," (5, 'Taylor', 'Nguyen', 'Pixel 8', 'Absolutely love this phone! The battery lasts forever and the camera is top-notch.')\r","]\r","\r","feedback_df = pd.DataFrame(feedback_data, columns=['ID', 'FIRST_NAME', 'LAST_NAME', 'PRODUCT', 'PRODUCT_FEEDBACK'])\r","oml_df = oml.create(feedback_df, table=\"CUSTOMER_FEEDBACK\")\r","oml_df.head()"],"enabled":true,"result":{"startTime":1760328028006,"interpreter":"python.low","endTime":1760328028605,"results":[{"message":" ID FIRST_NAME ... PRODUCT PRODUCT_FEEDBACK\n0 1 Morgan ... Pixel 8 Absolutely love this phone! The battery lasts ...\n1 2 Morgan ... OnePlus 12 Incredible value for the price. Exceeded my ex...\n2 3 Reese ... Xperia 1 V Best smartphone I have ever used. Highly recom...\n3 4 Jordan ... Galaxy S24 Absolutely love this phone! The battery lasts ...\n4 5 Taylor ... Pixel 8 Absolutely love this phone! The battery lasts ...\n\n[5 rows x 5 columns]\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":true,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Identify sentiment of customer product feedback","message":["%python","","import oml","import pandas as pd","","feedback = oml.sync(table=\"CUSTOMER_FEEDBACK\")","df = feedback.pull()","","results = []","for _, row in df.iterrows():"," sentiment = profile.generate("," prompt = \"Return the sentiment of the following text using only the values positive, neutral, or negative, nothing else: \" + row['PRODUCT_FEEDBACK'],"," action = select_ai.Action.CHAT"," )"," results.append({\"id\": row['ID'], \"product\": row['PRODUCT'], \"sentiment\": sentiment.strip()})","","results_df = pd.DataFrame(results)","print(results_df)"],"enabled":true,"result":{"startTime":1760328062467,"interpreter":"python.low","endTime":1760328064731,"results":[{"message":" id product sentiment\n0 1 Pixel 8 Positive\n1 2 OnePlus 12 Positive\n2 3 Xperia 1 V Positive\n3 4 Galaxy S24 Positive\n4 5 Pixel 8 Positive\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Augment the query above to aggregate the counts of the sentiment","message":["%python","","feedback = oml.sync(table=\"CUSTOMER_FEEDBACK\")","df = feedback.pull()","","results = []","for _, row in df.iterrows():"," sentiment = profile.generate("," prompt = \"Return the sentiment of the following text using only the values positive, neutral, or negative, nothing else: \" + row['PRODUCT_FEEDBACK'],"," action = select_ai.Action.CHAT"," )"," results.append({\"product\": row['PRODUCT'], \"sentiment\": sentiment.strip()})","","results_df = pd.DataFrame(results)","sentiment_counts = results_df.groupby([\"product\", \"sentiment\"]).size().reset_index(name=\"count\")","sentiment_counts = sentiment_counts.sort_values([\"sentiment\", \"product\"], ascending=[False, True])","print(sentiment_counts)"],"enabled":true,"result":{"startTime":1760328071838,"interpreter":"python.low","endTime":1760328073897,"results":[{"message":" product sentiment count\n0 Galaxy S24 Positive 1\n1 OnePlus 12 Positive 1\n2 Pixel 8 Positive 2\n3 Xperia 1 V Positive 1\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Filter for product reviews with positive feedback","message":["%python","","feedback = oml.sync(table = \"CUSTOMER_FEEDBACK\")","df = feedback.pull()","","results = []","for _, row in df.iterrows():"," sentiment = profile.generate("," prompt = \"Return the sentiment of the following text using only the values positive, neutral, or negative, nothing else: \" + row['PRODUCT_FEEDBACK'],"," action = select_ai.Action.CHAT"," )"," if sentiment.strip().lower() == \"positive\":"," results.append({\"id\": row['ID'], \"product\": row['PRODUCT']})","","results_df = pd.DataFrame(results)","print(results_df)"],"enabled":true,"result":{"startTime":1760328040260,"interpreter":"python.low","endTime":1760328042824,"results":[{"message":" id product\n0 1 Pixel 8\n1 2 OnePlus 12\n2 3 Xperia 1 V\n3 4 Galaxy S24\n4 5 Pixel 8\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Summarize feedback grouped by product","message":["%python","","import json","","feedback = oml.sync(table = \"CUSTOMER_FEEDBACK\")","df = feedback.pull()","","product_feedback = {}","for _, row in df.iterrows():"," product = row['PRODUCT']"," feedback_text = row['PRODUCT_FEEDBACK']"," if product not in product_feedback:"," product_feedback[product] = []"," product_feedback[product].append({\"feedback_text\": feedback_text})","","results = []","for product, feedbacks in product_feedback.items():"," all_feedback = json.dumps(feedbacks)"," review_summary = profile.generate("," prompt = all_feedback,"," action = select_ai.Action.CHAT"," )"," results.append({\"product\": product, \"review_summary\": review_summary})","","results_df = pd.DataFrame(results)","results_df['review_summary'] = results_df['review_summary'].str.extract(r'(Positive|Negative)', expand=False)","results_df"],"enabled":true,"result":{"startTime":1760328415640,"interpreter":"python.low","endTime":1760328422918,"results":[{"message":" product review_summary\n0 Pixel 8 Positive\n1 OnePlus 12 Positive\n2 Xperia 1 V Positive\n3 Galaxy S24 Positive\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","## End of Script"],"enabled":true,"result":{"startTime":1760328045444,"interpreter":"md.low","endTime":1760328045762,"results":[{"message":" One of the features of Select AI enables you to ask questions of your database data using natural language.\nSelect AI augments your user-provided prompt with metadata from tables and views in your database schema before sending it to LLMs.\nThe generated SQL query is then processed according the 'action' specified.<\/p>\n Select AI provides multiple actions<\/strong>. These are related to NL2SQL:<\/p>\n Note that the full Select AI functionality is available in Oracle Autonomous Database 23ai. NL2SQL is also available with Oracle Database 23.7+ instances and Autonomous Database 19c instances.<\/p>\n<\/blockquote>\n Copyright (c) 2025 Oracle Corporation<\/p>\n Select AI for Python documentation<\/a><\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","## Prerequisites","","Before proceeding, you must complete steps in the **SelectAI4Py -0- Prerequisites and Setup** notebook:","","* ADMIN: grants and network access","* Select AI user: OCI_GENAI_PY_DEMO profile definition","","These steps are required for the NL2SQL commands in this notebook to run correctly."],"enabled":true,"result":{"startTime":1760325687115,"interpreter":"md.low","endTime":1760325687462,"results":[{"message":" Before proceeding, you must complete steps in the SelectAI4Py -0- Prerequisites and Setup<\/strong> notebook:<\/p>\n These steps are required for the NL2SQL commands in this notebook to run correctly.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### Working with NL2SQL Actions","","In the following examples, you'll see how to use each Select AI NL2SQL action. ","","Use `showsql` to display SQL generated from natural language without running the query. This is followed by `runsql` to both generate and run the SQL query. Use ","`showprompt` to reveal the augmented prompt that includes your schema metadata. ","","You'll learn how to build on previous queries by asking follow-up questions leveraging the original conversation capability, ","followed by the customizable converation management API for greater control over conversations. ","You'll then examine a more complex example that interprets business terms like \"baby boomer.\" ","","Lastly, you'll use `show_sql` to view the generated SQL query, `run_sql` to run the generated SQL query, `narrate` to get natural language text from the structured ","results, `explainsql` to understand the generated SQL, and the `generate` method."],"enabled":true,"result":{"startTime":1760325687822,"interpreter":"md.low","endTime":1760325688162,"results":[{"message":" In the following examples, you'll see how to use each Select AI NL2SQL action.<\/p>\n Use You'll learn how to build on previous queries by asking follow-up questions leveraging the original conversation capability,\nfollowed by the customizable converation management API for greater control over conversations. Lastly, you'll use The The examples demonstrate using generate with different actions: Select AI supports retreival augmented generation (RAG) to enhance LLM responses by augmenting the user prompt with your specific content retrieved using semantic similarity search.\nRAG is supported in Oracle Autonomous Database 23ai and uses the AI Vector Search feature.\nRAG enables more accurate and contextually relevant responses while reducing hallucinations. RAG bridges the gap between the general\nknowledge of the LLM and your proprietary information, without LLM fine-tuning.<\/p>\n Select AI RAG can also provide document sources and text chunk offsets within those documents that contribute to responses. The document sources enhances explainability.\nYou can also view the specific text chunks that are provided to the LLM for a given prompt.<\/p>\n Select AI RAG provides the following capabilities:<\/p>\n Select AI RAG simplifies and automates retrieval augmentation generation.<\/p>\n Copyright (c) 2025 Oracle Corporation<\/p>\n Select AI for Python documentation<\/a><\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### Prerequisites"," ","Before proceeding, you must complete the required setup steps in the **SelectAI4Py -0- Prerequisites and Setup** notebook:","","###### ADMIN:","* Grants and network access","* Access to Object Storage with data for vector embedding","","###### Select AI user:","* OCI_GENAI_RAG_PY_DEMO profile definition with vector store configuration","* Optional: Load the augmented Hugging Face transformer models to the database","","The admin and user requirements (excluding optional steps) must be completed to run the RAG commands in this notebook."],"enabled":true,"result":{"startTime":1760326826611,"interpreter":"md.low","endTime":1760326826978,"results":[{"message":" Before proceeding, you must complete the required setup steps in the SelectAI4Py -0- Prerequisites and Setup<\/strong> notebook:<\/p>\n The admin and user requirements (excluding optional steps) must be completed to run the RAG commands in this notebook.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### Use Select AI to create a vector index on OML blogs","","Use the blog content derived from https://blogs.oracle.com/machinelearning that has been saved as individual text files in Oracle Object Storage.","","Create a vector index named `MY_VECTOR_INDEX2` that will store vector embeddings, which are semantic representations of your content from object storage. ","","For each document in object storage, Select AI:","1. Breaks it into chunks (configured via `chunk_size` and `chunk_overlap` parameters)","2. Converts each chunk into a numerical vector using a transformer (also known as an embedding model)","3. Stores these vectors with their source information for retrieval via semantic similarity search","4. Creates a vector index for optimized retrieval performance","","When users supply their prompt, Select AI vectorizes the prompt and searches for semantically similar content in the vector index. ","","> **Note:** The same transformer must be used for creating the vector index and vectorizing the user prompt. ","","This content is used to augment the user prompt before sending it to the LLM. The quality of retrieval can be tuned ","through parameters like chunk size, overlap, and distance metric based on your specific content."],"enabled":true,"result":{"startTime":1760326827357,"interpreter":"md.low","endTime":1760326827714,"results":[{"message":" Use the blog content derived from https://blogs.oracle.com/machinelearning<\/a> that has been saved as individual text files in Oracle Object Storage.<\/p>\n Create a vector index named For each document in object storage, Select AI:<\/p>\n When users supply their prompt, Select AI vectorizes the prompt and searches for semantically similar content in the vector index.<\/p>\n Note:<\/strong> The same transformer must be used for creating the vector index and vectorizing the user prompt.<\/p>\n<\/blockquote>\n This content is used to augment the user prompt before sending it to the LLM. The quality of retrieval can be tuned\nthrough parameters like chunk size, overlap, and distance metric based on your specific content.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":"[{\"raw\":{\"height\":300,\"lastColumns\":[],\"version\":1}}]","hideInIFrame":false,"selectedVisualization":"table","title":"View the content of our Object Storage bucket","message":["%python","","import oml","","result = oml.sync(query = \"\"\""," SELECT * FROM"," DBMS_CLOUD.LIST_OBJECTS("," credential_name => 'OCI_CRED2',"," location_uri => 'https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o')","\"\"\")","","z.show(result)"],"enabled":true,"result":{"startTime":1760326828096,"interpreter":"python.low","endTime":1760326832369,"results":[{"message":"OBJECT_NAME\tBYTES\tCHECKSUM\tCREATED\tLAST_MODIFIED\n6 Simple Tips for Better Text-to-SQL Generation.txt\t17246\t+wPVq6vnjvigElw5AyptmQ==\t2025-08-14 17:37:48.207000+00:00\t2025-08-14 17:37:48.207000+00:00\nADB-Select-AI-Accelerate-innovation-with-enterprise-data-OCI-GenerativeAIand-enhanced-security.txt\t4965\twZxP8/mV7N0mirUCItL1Jw==\t2024-08-09 15:19:41.083000+00:00\t2024-08-11 22:29:10.920000+00:00\nAnnouncing Additional AI Providers for Oracle Autonomous Database Select AI.txt\t10356\tAUN48wAPPFXodYdCno7OVw==\t2025-08-14 17:37:48.223000+00:00\t2025-08-14 17:37:48.223000+00:00\nAnnouncing Oracle Machine Learning for Python 2.1.txt\t26897\tP4voJHYNVjeIn8UEio9BBw==\t2025-08-14 17:37:48.204000+00:00\t2025-08-14 17:37:48.204000+00:00\nAnnouncing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt\t15810\tg5OWlR0ewWSvURB+AgSNjg==\t2025-08-27 22:39:21.055000+00:00\t2025-08-27 22:40:16.310000+00:00\nAnnouncing-New-Oracle-Machine-Learning-Features-in-Oracle-Databas-23ai.txt\t7595\tx46HR+vDglB0H1ejECY8Qw==\t2024-08-09 15:19:40.946000+00:00\t2024-08-11 21:42:35.716000+00:00\nAnnouncing-OML-Data-Monitoring-User-Interface-on-Autonomous-Database.txt\t7380\t2mCebWetUyXsNjsU5h7sdg==\t2024-08-09 15:19:40.959000+00:00\t2024-08-11 21:43:26.635000+00:00\nAnnouncing-OML-Monitoring-on-Autonomous-Database.txt\t6229\t069xCGhbNga2ahIaI5syRg==\t2024-08-09 15:19:40.967000+00:00\t2024-08-11 21:43:56.557000+00:00\nAnnouncing-OML-Services-Batch-Scoring-on-Autonomous-Database.txt\t7240\tJiK6FgM9iQyzO+lzJLlbJQ==\t2024-08-09 15:19:40.899000+00:00\t2024-08-11 21:44:26.252000+00:00\nAnnouncing-Select-AI-with-Azure-OpenAI-Service-on-Oracle-Autonomous-Database.txt\t6150\tAvb3j2EAVs7loNb8aJCtnw==\t2024-08-09 15:19:40.908000+00:00\t2024-08-11 21:45:21.122000+00:00\nAnnouncing-custom-third-party-Python-and-R-packages-for-use-on-Autonomous-Database.txt\t4185\tG+yvHQkNeWSsO4axUQRJ0w==\t2024-08-09 15:19:41.149000+00:00\t2024-08-11 21:45:58.063000+00:00\nAnnouncing-next-generation-OML-Notebooks-on-Oracle-Autonomous-Database.txt\t3908\tpIPZK7/tVpjFZEEIMNqIeA==\t2024-08-09 15:19:41+00:00\t2024-08-11 21:46:32.203000+00:00\nAnnouncing-the-release-of-Oracle-Machine-Learning-for-Python-2.0-on-Autonomous-Database.txt\t4350\t0GAX5vO8zNYchpGY/aQdSA==\t2024-08-09 15:19:41.179000+00:00\t2024-08-11 22:17:02.432000+00:00\nApproaches-to-detect-potential-fraud.txt\t8924\tDetu0pLV5UcSl7/dp6ZzCg==\t2024-08-09 15:19:40.787000+00:00\t2024-08-11 21:47:39.055000+00:00\nBoost-your-R-to-database-connectivity-using-ROracle.txt\t5765\tp+x9loBd8veO9qRrc0/DXA==\t2024-08-09 15:19:40.767000+00:00\t2024-08-11 21:48:13.054000+00:00\nData-Driven-Decision-making-for-Debt-Collection.txt\t8619\tJna1Gyj/XMD6y5Oh8nraSQ==\t2024-08-09 15:19:40.735000+00:00\t2024-08-11 21:49:53.243000+00:00\nData-Monitoring-with-Oracle-Machine-Learning-Services.txt\t12587\tAsgOB3kGh1PC9eaLAdhx4A==\t2024-08-09 15:19:40.759000+00:00\t2024-08-11 21:48:46.218000+00:00\nDevelop-and-deploy-machine-learning-models-using-Oracle-Autonomous-Database-Machine-Learning-and-APEX.txt\t16029\tDKKdNysX7CSUWOI5FxoEpw==\t2024-08-09 15:19:40.719000+00:00\t2024-08-11 22:17:33.526000+00:00\nExploit-Data-Parallelism-for-R-Scalability-using-Oracle-Machine-Learning-for-R.txt\t5693\ty7OUOE1wwKhO3SkF/akF8Q==\t2024-08-09 15:19:40.600000+00:00\t2024-08-11 21:51:45.006000+00:00\nHow-to-perform-in-database-text-analytics-using-a-pre-built-ML-model.txt\t11773\tsRrXNA8ySE2ZTFWBSBZjZA==\t2024-08-09 15:19:40.558000+00:00\t2024-08-11 21:52:47.054000+00:00\nICYMI-Embedding-AI-ML-in-your-application-using-Oracle-Machine-Learning.txt\t2039\t4ULR8yFZ3MwD+KcRLL6uGw==\t2024-08-09 15:19:40.637000+00:00\t2024-08-11 21:49:27.458000+00:00\nICYMI-Learn-How-to-Invoke-Your-Python-Functions-from-SQL-with-OML4Py.txt\t4230\teJEQ7niAVz4LaR7KN2QxYw==\t2024-08-09 15:19:40.797000+00:00\t2024-08-11 21:53:23.367000+00:00\nIntroducing-Select-AI-Natural-Language-to-SQL-Generation-on-Autonomous-Database.txt\t11329\tohavv/ITnO25nxsDMr435Q==\t2024-08-09 15:19:40.444000+00:00\t2024-08-11 21:53:58.979000+00:00\nManage-your-models-with-Oracle-Machine-Learning-on-Autonomous-Database.txt\t23075\tJwVCchJkdPWN066BrMIaOg==\t2024-08-09 15:19:40.605000+00:00\t2024-08-11 21:56:35.632000+00:00\nModel-Monitoring-with-Oracle-Machine-Learning-Services.txt\t14649\t7NCeitsJUEkK2CvuLpsDfw==\t2024-08-09 15:19:40.451000+00:00\t2024-08-11 21:57:06.963000+00:00\nNow-Available-Pre-built-Embedding-Generation-model-for-Oracle-Database-23ai.txt\t7720\tn4KJIqZlOjtdirldiDN3Zw==\t2024-08-09 15:19:40.396000+00:00\t2024-08-11 21:58:09.344000+00:00\nOML-AutoML-UI-click-your-way-to-an-ML-model.txt\t9003\tscG+R8dj/Eo2JsfibkOqGg==\t2024-08-09 15:19:40.331000+00:00\t2024-08-11 21:58:37.365000+00:00\nOML4Py-Leveraging-ONNX-and-Hugging-Face-for-AI-Vector-Search.txt\t16210\tfLGisymS7RS8R/0AirOlig==\t2024-08-09 15:19:40.353000+00:00\t2024-08-11 22:18:19.418000+00:00\nOracleMachine-Learning-for-R-2.0-now-available-for-Oracle-Database.txt\t5522\tSpNCKwA1j9bgMvEZFEusXw==\t2024-08-09 15:19:40.572000+00:00\t2024-08-11 22:16:45.747000+00:00\nSelect AI Enhances Text-to-SQL Support.txt\t8646\tpAVa7+v+lJtfvNRXN+x9KQ==\t2025-08-14 17:37:48.215000+00:00\t2025-08-14 17:37:48.215000+00:00\nSelect AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt\t8158\tdFBIbNpuYpi6HDSgNfaA4A==\t2025-08-14 17:37:48.194000+00:00\t2025-08-14 17:37:48.194000+00:00\nSimplify-your-model-monitoring-and-MLOps-with-OML-Model-Monitoring-UI.txt\t10343\tUSHUbN7vCgVEakwwwDWyhw==\t2024-08-09 15:19:40.342000+00:00\t2024-08-11 21:57:36.401000+00:00\nStoring-Named-R-and-Python-Functions-in-the-Oracle-Machine-Learning-Script-Repository.txt\t10984\tVLrAloZ0REEUQO7Dm7jh4g==\t2024-08-09 15:19:40.261000+00:00\t2024-08-11 21:59:15.775000+00:00\nSupercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt\t14107\t0RKhVQWBgyYDAiKSH/k9+w==\t2025-08-14 17:37:48.218000+00:00\t2025-08-14 17:37:48.218000+00:00\nTop-10-Reasons-to-use-Machine-Learning-in-Oracle-Database.txt\t13688\tEm1zI6C0GC6cSivNiB+eZQ==\t2024-08-09 15:19:40.253000+00:00\t2024-08-11 22:01:37.367000+00:00\nUsing-Machine-Learning-for-Smart-Investment.txt\t4394\tHy0E1RzuscHMJrpIGQd0Iw==\t2024-08-09 15:19:40.225000+00:00\t2024-08-11 22:02:09.193000+00:00\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Create a vector index on Oracle Machine Learning and Select AI blogs in Object Storage","message":["%python","","import select_ai","","profile = select_ai.Profile(profile_name = \"OCI_GENAI_RAG_PY_DEMO\")","","vector_index_attributes = select_ai.OracleVectorIndexAttributes("," location = \"https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/\","," object_storage_credential_name = \"OCI_CRED2\","," vector_distance_metric = select_ai.VectorDistanceMetric.COSINE,"," chunk_overlap = 50,"," chunk_size = 450",")","","vector_index = select_ai.VectorIndex("," index_name = \"MY_VECTOR_INDEX2\","," attributes = vector_index_attributes,"," description = \"Vector index for Oracle Machine Learning blogs\","," profile = profile",")","","try:"," vector_index.delete(include_data = True, force = True)","except:"," pass","","vector_index.create()","print(\"Vector index created: \" + vector_index.index_name)"],"enabled":true,"result":{"startTime":1760326832779,"interpreter":"python.low","endTime":1760326835059,"results":[{"message":"Vector index created: MY_VECTOR_INDEX2\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### Understanding chunk size and chunk overlap","","When creating your vector index, two important parameters affect retrieval quality:","","**Chunk Size:** Controls the size of document segments (450 in our example).","- Smaller chunks help find specific information but may lose context","- Larger chunks preserve more context but might include irrelevant information","","**Chunk Overlap:** Determines shared text between chunks (50 in our example).","- Helps maintain contextual connections between adjacent chunks","- Prevents important information from being split across chunk boundaries","","For most documentation like blogs, the settings used here (450 chunk size, 50 overlap) provide a reasonable balance. ","You can adjust these values based on your specific content and query needs."],"enabled":true,"result":{"startTime":1760326835449,"interpreter":"md.low","endTime":1760326835769,"results":[{"message":" When creating your vector index, two important parameters affect retrieval quality:<\/p>\n Chunk Size:<\/strong> Controls the size of document segments (450 in our example).<\/p>\n Chunk Overlap:<\/strong> Determines shared text between chunks (50 in our example).<\/p>\n For most documentation like blogs, the settings used here (450 chunk size, 50 overlap) provide a reasonable balance.\nYou can adjust these values based on your specific content and query needs.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Pause for 10 seconds for pipeline job to start","message":["%python","","import time","time.sleep(10)"],"enabled":true,"result":{"startTime":1760326836210,"interpreter":"python.low","endTime":1760326846586,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Check on running pipeline","message":["%python","","result = oml.sync(query = \"\"\""," SELECT job_name, job_style, session_id, elapsed_time, log_id"," FROM USER_SCHEDULER_RUNNING_JOBS","\"\"\")","","if result.shape[0] == 0:"," print(\"Pipeline has completed - no running jobs found.\")","else:"," z.show(result)"],"enabled":true,"result":{"startTime":1760326846961,"interpreter":"python.low","endTime":1760326847552,"results":[{"message":"JOB_NAME\tJOB_STYLE\tSESSION_ID\tELAPSED_TIME\tLOG_ID\nPIPELINE$29\tREGULAR\t14085\t0 days 00:00:07.512167\t92128\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Pause for 5 seconds for vector index table creation","message":["%python","","import time","time.sleep(5)"],"enabled":true,"result":{"startTime":1760326847928,"interpreter":"python.low","endTime":1760326853307,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Create pipeline status view","message":["%python","","cursor = oml.cursor()","","index_name = 'MY_VECTOR_INDEX2' ","","cursor.execute(\"\"\""," SELECT pipeline_name, status_table"," FROM user_cloud_pipelines"," WHERE pipeline_name = :1","\"\"\", [index_name + '$VECPIPELINE'])","","result = cursor.fetchone()","if result:"," pipeline_name = result[0]"," table_name = result[1]"," "," print(\"Pipeline Name: \" + pipeline_name)"," print(\"Status Table: \" + table_name)"," "," cursor.execute(f\"CREATE OR REPLACE VIEW MY_VECTOR_INDEX_STATUS_VIEW AS SELECT name, status, error_message FROM {table_name}\")"," print(\"View created\")","","cursor.execute('commit')"],"enabled":true,"result":{"startTime":1760326853689,"interpreter":"python.low","endTime":1760326854047,"results":[{"message":"Pipeline Name: MY_VECTOR_INDEX2$VECPIPELINE\nStatus Table: PIPELINE$29$256_STATUS\nView created\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### Track and view document processing status for vector indexing","","Tracking document processing status gives you visibility into your vector index creation. Create a dedicated table to monitor which files have been successfully ","processed, which ones have failed, and capture any associated error messages. This monitoring approach allows you to identify and resolve issues with specific ","documents, helping you to verify proper ingestion of your data into the vector index. By maintaining this processing history, you can verify that your documents have ","been process successfully before using it for RAG operations."],"enabled":true,"result":{"startTime":1760326854445,"interpreter":"md.low","endTime":1760326854793,"results":[{"message":" Tracking document processing status gives you visibility into your vector index creation. Create a dedicated table to monitor which files have been successfully\nprocessed, which ones have failed, and capture any associated error messages. This monitoring approach allows you to identify and resolve issues with specific\ndocuments, helping you to verify proper ingestion of your data into the vector index. By maintaining this processing history, you can verify that your documents have\nbeen process successfully before using it for RAG operations.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":"[{\"raw\":{\"height\":300,\"lastColumns\":[],\"version\":1}}]","hideInIFrame":false,"selectedVisualization":"table","title":"View the status of processed files for vector indexing","message":["%python","","result = oml.sync(query = \"SELECT * FROM MY_VECTOR_INDEX_STATUS_VIEW\")","","z.show(result)"],"enabled":true,"result":{"startTime":1760326855182,"interpreter":"python.low","endTime":1760326855603,"results":[{"message":"NAME\tSTATUS\tERROR_MESSAGE\n6 Simple Tips for Better Text-to-SQL Generation.txt\tCOMPLETED\tNone\nADB-Select-AI-Accelerate-innovation-with-enterprise-data-OCI-GenerativeAIand-enhanced-security.txt\tCOMPLETED\tNone\nAnnouncing Additional AI Providers for Oracle Autonomous Database Select AI.txt\tCOMPLETED\tNone\nAnnouncing Oracle Machine Learning for Python 2.1.txt\tCOMPLETED\tNone\nAnnouncing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt\tCOMPLETED\tNone\nAnnouncing-New-Oracle-Machine-Learning-Features-in-Oracle-Databas-23ai.txt\tCOMPLETED\tNone\nAnnouncing-OML-Data-Monitoring-User-Interface-on-Autonomous-Database.txt\tCOMPLETED\tNone\nAnnouncing-OML-Monitoring-on-Autonomous-Database.txt\tCOMPLETED\tNone\nAnnouncing-OML-Services-Batch-Scoring-on-Autonomous-Database.txt\tCOMPLETED\tNone\nAnnouncing-Select-AI-with-Azure-OpenAI-Service-on-Oracle-Autonomous-Database.txt\tCOMPLETED\tNone\nAnnouncing-custom-third-party-Python-and-R-packages-for-use-on-Autonomous-Database.txt\tCOMPLETED\tNone\nAnnouncing-next-generation-OML-Notebooks-on-Oracle-Autonomous-Database.txt\tCOMPLETED\tNone\nAnnouncing-the-release-of-Oracle-Machine-Learning-for-Python-2.0-on-Autonomous-Database.txt\tCOMPLETED\tNone\nApproaches-to-detect-potential-fraud.txt\tCOMPLETED\tNone\nBoost-your-R-to-database-connectivity-using-ROracle.txt\tCOMPLETED\tNone\nData-Driven-Decision-making-for-Debt-Collection.txt\tCOMPLETED\tNone\nData-Monitoring-with-Oracle-Machine-Learning-Services.txt\tCOMPLETED\tNone\nDevelop-and-deploy-machine-learning-models-using-Oracle-Autonomous-Database-Machine-Learning-and-APEX.txt\tCOMPLETED\tNone\nExploit-Data-Parallelism-for-R-Scalability-using-Oracle-Machine-Learning-for-R.txt\tCOMPLETED\tNone\nHow-to-perform-in-database-text-analytics-using-a-pre-built-ML-model.txt\tCOMPLETED\tNone\nICYMI-Embedding-AI-ML-in-your-application-using-Oracle-Machine-Learning.txt\tCOMPLETED\tNone\nICYMI-Learn-How-to-Invoke-Your-Python-Functions-from-SQL-with-OML4Py.txt\tCOMPLETED\tNone\nIntroducing-Select-AI-Natural-Language-to-SQL-Generation-on-Autonomous-Database.txt\tCOMPLETED\tNone\nManage-your-models-with-Oracle-Machine-Learning-on-Autonomous-Database.txt\tCOMPLETED\tNone\nModel-Monitoring-with-Oracle-Machine-Learning-Services.txt\tCOMPLETED\tNone\nNow-Available-Pre-built-Embedding-Generation-model-for-Oracle-Database-23ai.txt\tCOMPLETED\tNone\nOML-AutoML-UI-click-your-way-to-an-ML-model.txt\tCOMPLETED\tNone\nOML4Py-Leveraging-ONNX-and-Hugging-Face-for-AI-Vector-Search.txt\tCOMPLETED\tNone\nOracleMachine-Learning-for-R-2.0-now-available-for-Oracle-Database.txt\tCOMPLETED\tNone\nSelect AI Enhances Text-to-SQL Support.txt\tCOMPLETED\tNone\nSelect AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt\tCOMPLETED\tNone\nSimplify-your-model-monitoring-and-MLOps-with-OML-Model-Monitoring-UI.txt\tCOMPLETED\tNone\nStoring-Named-R-and-Python-Functions-in-the-Oracle-Machine-Learning-Script-Repository.txt\tCOMPLETED\tNone\nSupercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt\tCOMPLETED\tNone\nTop-10-Reasons-to-use-Machine-Learning-in-Oracle-Database.txt\tCOMPLETED\tNone\nUsing-Machine-Learning-for-Smart-Investment.txt\tCOMPLETED\tNone\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### Vector index inspection","","The following queries allow you to examine the metadata and configuration of your vector index, which is helpful for verifying and troubleshooting the index ","creation process. By reviewing objects in the vector index processing steps, you can verify your vector index was created successfully. ","","This inspection may help diagnose document processing issues and make parameter adjustments."],"enabled":true,"result":{"startTime":1760326855979,"interpreter":"md.low","endTime":1760326856304,"results":[{"message":" The following queries allow you to examine the metadata and configuration of your vector index, which is helpful for verifying and troubleshooting the index\ncreation process. By reviewing objects in the vector index processing steps, you can verify your vector index was created successfully.<\/p>\n This inspection may help diagnose document processing issues and make parameter adjustments.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"View attributes for MY_VECTOR_INDEX2","message":["%python","","from pprint import pprint","","vector_index = select_ai.VectorIndex(index_name = \"MY_VECTOR_INDEX2\")","attributes = vector_index.get_attributes()","pprint(attributes)"],"enabled":true,"result":{"startTime":1760326856685,"interpreter":"python.low","endTime":1760326857111,"results":[{"message":"OracleVectorIndexAttributes(chunk_size=450,\n chunk_overlap=50,\n location='https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/',\n match_limit=5,\n object_storage_credential_name='OCI_CRED2',\n profile_name='OCI_GENAI_RAG_PY_DEMO',\n refresh_rate=1440,\n similarity_threshold=0.0,\n vector_distance_metric='COSINE',\n vector_db_endpoint=None,\n vector_db_credential_name=None,\n vector_db_provider= Create a profile proxy object that contains configuration settings for connecting to the LLM service and using your vector index.\nThe profile determines which AI provider and AI Models are used, authentication details, vector store configuration, and other parameters.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Create a profile proxy object for the current session","message":["%python","","profile = select_ai.Profile(profile_name = \"OCI_GENAI_RAG_PY_DEMO\")"],"enabled":true,"result":{"startTime":1760326861389,"interpreter":"python.low","endTime":1760326861755,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### Query data using Select AI RAG ","","These examples demonstrate how to get LLM responses enhanced by your documents using Select AI RAG. ","","The \"narrate\" action provides a text response based on data retrieved using your vector index.","","The \"runsql\" action lists the individul text chunks, documents file names, URLs, relevance scores, and start and end offsets."],"enabled":true,"result":{"startTime":1760326862134,"interpreter":"md.low","endTime":1760326862459,"results":[{"message":" These examples demonstrate how to get LLM responses enhanced by your documents using Select AI RAG.<\/p>\n The "narrate" action provides a text response based on data retrieved using your vector index.<\/p>\n The "runsql" action lists the individul text chunks, documents file names, URLs, relevance scores, and start and end offsets.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"What type of monitoring is enabled in Oracle Machine Learning","message":["%python","","response = profile.narrate(prompt = \"What type of monitoring is enabled in Oracle Machine Learning\")","","formatted = response.replace('\\\\n', '\\n')","print(formatted)"],"enabled":true,"result":{"startTime":1760326862844,"interpreter":"python.low","endTime":1760326867822,"results":[{"message":"Oracle Machine Learning (OML) provides several types of monitoring, including data monitoring and model monitoring. Data monitoring is a feature that allows users to track changes in their data over time, detecting issues such as data drift. Model monitoring, on the other hand, provides information on the quality of machine learning models, alerting users to potential performance degradation. Both data and model monitoring are available on Oracle Autonomous Database, with user interfaces available for ease of use.\n\nSources:\n - Announcing-OML-Monitoring-on-Autonomous-Database.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Announcing-OML-Monitoring-on-Autonomous-Database.txt, offsets [1:450])\n - Announcing-OML-Data-Monitoring-User-Interface-on-Autonomous-Database.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Announcing-OML-Data-Monitoring-User-Interface-on-Autonomous-Database.txt, offsets [1:450])\n - Simplify-your-model-monitoring-and-MLOps-with-OML-Model-Monitoring-UI.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Simplify-your-model-monitoring-and-MLOps-with-OML-Model-Monitoring-UI.txt, offsets [1:450])\n - Data-Monitoring-with-Oracle-Machine-Learning-Services.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Data-Monitoring-with-Oracle-Machine-Learning-Services.txt, offsets [1601:2050])\n - Model-Monitoring-with-Oracle-Machine-Learning-Services.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Model-Monitoring-with-Oracle-Machine-Learning-Services.txt, offsets [1:450])\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Use 'runsql' for the same prompt","message":["%python","","result = profile.run_sql(prompt = \"What type of monitoring is enabled in Oracle Machine Learning\")","z.show(result)"],"enabled":true,"result":{"startTime":1760326868198,"interpreter":"python.low","endTime":1760326868696,"results":[{"message":"data\tsource\turl\tscore\tstart_offset\tend_offset\nAnnouncing OML Monitoring on Autonomous Database February 26, 2023 | 4 minute read Mark Hornick Senior Director, Data Science and Machine Learning We are pleased to announce the availability of Oracle Machine Learning (OML) Monitoring as part of OML Services on Oracle Autonomous Database. With OML Monitoring, you can be alerted to issues in both data and native in-database model quality. In data-driven enterprises, you need to know if there\tAnnouncing-OML-Monitoring-on-Autonomous-Database.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Announcing-OML-Monitoring-on-Autonomous-Database.txt\t0.74\t1\t450\nAnnouncing OML Data Monitoring User Interface on Autonomous Database August 7, 2023 | 6 minute read Mark Hornick Senior Director, Data Science and Machine Learning We are pleased to announce the availability of Oracle Machine Learning Data Monitoring User Interface on Oracle Autonomous Database. OML Data Monitoring UI is a no-code user interface that provides insight into how your enterprise data evolves over time. Data monitoring is a powe\tAnnouncing-OML-Data-Monitoring-User-Interface-on-Autonomous-Database.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Announcing-OML-Data-Monitoring-User-Interface-on-Autonomous-Database.txt\t0.71\t1\t450\nSimplify your model monitoring and MLOps with OML Model Monitoring UI February 13, 2024 | 8 minute read Mark Hornick Senior Director, Data Science and Machine Learning Announcing Oracle Machine Learning Model Monitoring UI\u2014an easy-to-use no-code user interface on Oracle Autonomous Database that helps you maintain the accuracy of your models and the effectiveness of your applications. OML Model Monitoring UI makes getting started simple so y\tSimplify-your-model-monitoring-and-MLOps-with-OML-Model-Monitoring-UI.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Simplify-your-model-monitoring-and-MLOps-with-OML-Model-Monitoring-UI.txt\t0.7\t1\t450\n Graph How does OML Services record data drift? Luckily for Oracle Machine Learning users, data monitoring is a new feature available through Oracle Machine Learning Services. So how exactly does this new feature calculate data drift? It does so by comparing a baseline dataset to new data. The data monitoring algorithm creates a machine learning model to try and identify differences between the baseline and new data. The amount of drift that \tData-Monitoring-with-Oracle-Machine-Learning-Services.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Data-Monitoring-with-Oracle-Machine-Learning-Services.txt\t0.69\t1601\t2050\nd is the definition of an attractive borrower, so concept drift has occurred in this case. How does Oracle Machine Learning Services record model drift? Fortunately, users of Oracle Machine Learning (OML) can now access model monitoring via the OML Services REST interface, specifically for classification and regression models. So how does this new feature track a model for potential degradation? It does so by comparing the quality of pr\tModel-Monitoring-with-Oracle-Machine-Learning-Services.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Model-Monitoring-with-Oracle-Machine-Learning-Services.txt\t0.68\t3201\t3650\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","","#### Use GENERATE for dynamic action selection","","The `generate()` method handles different Select AI actions specified as an argument. Additional parameters like conversation IDs can be passed for context-aware ","conversations. ","","The examples demonstrate using generate with different actions: 'showsql' to get SQL statements, 'runsql' to run queries, ","'explainsql' to obtain query explanations, and 'narrate' to provide a natural language interpretation of the query result."],"enabled":true,"result":{"startTime":1760326869068,"interpreter":"md.low","endTime":1760326869398,"results":[{"message":" The The examples demonstrate using generate with different actions: 'showsql' to get SQL statements, 'runsql' to run queries,\n'explainsql' to obtain query explanations, and 'narrate' to provide a natural language interpretation of the query result.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":" Use 'narrate' to create a learning path for Select AI","message":["%python","","learning_prompt = \"\"\"Create a 5 step learning path for a customer who wants to "," leverage Select AI in their Autonomous Database environment. "," The learning path should:"," Start with fundamental concepts and prerequisites for Select AI"," Focus on natural language to SQL, chat, RAG, and synthetic data generation"," Recommend specific blog posts, documentation, or training for each topic\"\"\"","","response = profile.narrate(prompt = learning_prompt)","print(response)"],"enabled":true,"result":{"startTime":1760326869778,"interpreter":"python.low","endTime":1760326875957,"results":[{"message":"To create a 5-step learning path for leveraging Select AI in an Autonomous Database environment, follow these steps:\n\n1. **Introduction to Select AI and Prerequisites**: Start by understanding the fundamental concepts of Select AI and its prerequisites. The blog post \"Introducing Select AI - Natural Language to SQL Generation on Autonomous Database\" provides an excellent introduction to the capabilities and benefits of using Select AI. This step lays the groundwork for further learning.\n\n2. **Natural Language to SQL Generation**: Dive deeper into how Select AI enables natural language to SQL generation. The documentation \"Use Select AI for Natural Language Interaction with your Database\" is a valuable resource for understanding the technical aspects and implementation details. Additionally, the video \"Getting Started with Oracle Select AI\" offers a practical guide to getting started.\n\n3. **Chat and Retrieval Augmented Generation (RAG)**: Explore the chat and RAG features of Select AI. The blog post \"Select AI Enhances Text-to-SQL Support\" discusses the enhancements and capabilities in these areas. Furthermore, \"Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers\" provides insights into the advanced features of RAG.\n\n4. **Synthetic Data Generation and Other Use Cases**: Learn about synthetic data generation and other use cases supported by Select AI. The LiveLab \"Chat with Your Data in Autonomous Database Using Generative AI\" offers hands-on experience with using Select AI for various applications. Additionally, \"Supercharge SQL: Unleashing AI Queries with Oracle Autonomous Database Select AI\" discusses building AI-enabled applications, including those involving synthetic data generation.\n\n5. **Practical Implementation and Development**: Finally, focus on practical implementation and development using Select AI. The LiveLab \"Develop apps using GenAI, Autonomous\" provides a hands-on environment to develop applications leveraging Select AI. The \"DBMS_CLOUD_AI package\" documentation is also essential for understanding the technical details required for implementation.\n\nSources:\n - Introducing-Select-AI-Natural-Language-to-SQL-Generation-on-Autonomous-Database.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Introducing-Select-AI-Natural-Language-to-SQL-Generation-on-Autonomous-Database.txt, offsets [1:450])\n - Select AI Enhances Text-to-SQL Support.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Select AI Enhances Text-to-SQL Support.txt, offsets [1:450])\n - Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt, offsets [7601:8050])\n - Supercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Supercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt, offsets [401:850])\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":"[{\"raw\":{\"height\":300,\"lastColumns\":[],\"version\":1}}]","hideInIFrame":false,"selectedVisualization":"table","title":"Use 'runsql' for the same prompt","message":["%python","","learning_prompt = \"\"\"Create a 5 step learning path for a customer who wants to "," leverage Select AI in their Autonomous Database environment. "," The learning path should:"," Start with fundamental concepts and prerequisites for Select AI"," Focus on natural language to SQL, chat, RAG, and synthetic data generation"," Recommend specific blog posts, documentation, or training for each topic\"\"\"","","result = profile.run_sql(prompt = learning_prompt)","z.show(result)"],"enabled":true,"result":{"startTime":1760326876337,"interpreter":"python.low","endTime":1760326876839,"results":[{"message":"data\tsource\turl\tscore\tstart_offset\tend_offset\n Documentation: Use Select AI for Natural Language Interaction with your Database Documentation: DBMS_CLOUD_AI package Video: Getting Started with Oracle Select AI Blog: Now Available! Pre-built Embedding Generation model for Oracle Database 23ai Blog: Enhance your AI/ML applications with flexible Bring Your Own Model options LiveLab: Chat with Your Data in Autonomous Database Using Generative AI LiveLab: Develop apps using GenAI, Autonomo\tSelect AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt\t0.65\t7601\t8050\nIntroducing Select AI - Natural Language to SQL Generation on Autonomous Database September 19, 2023 | 9 minute read Mark Hornick Senior Director, Data Science and Machine Learning Introducing Autonomous Database Select AI - enabling you to query your data using natural language. Combining generative AI large language models (LLMs) with Oracle SQL empowers you to describe what you want - declarative intent - and let the database generate th\tIntroducing-Select-AI-Natural-Language-to-SQL-Generation-on-Autonomous-Database.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Introducing-Select-AI-Natural-Language-to-SQL-Generation-on-Autonomous-Database.txt\t0.64\t1\t450\nSelect AI Enhances Text-to-SQL Support May 20, 2025 | 5 minute read Mark Hornick Senior Director, Machine Learning and AI Product Management Oracle Autonomous Database Select AI simplifies and automates the use of generative AI enabling generating, running, and explaining SQL from a natural language prompt and chatting with your LLM. Select AI also automates vector index creation, simplifies the retrieval-augmented generation (RAG) workflow\tSelect AI Enhances Text-to-SQL Support.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Select AI Enhances Text-to-SQL Support.txt\t0.62\t1\t450\ns Select AI Enhances Text-to-SQL Support 6 Simple Tips for Better Text-to-SQL Generation using Oracle Autonomous Database Select AI Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers Documentation Use Select AI for Natural Language Interaction with your Database DBMS_CLOUD_AI package LiveLabs Chat with Your Data in Autonomous Database Using Generative AI Develop apps using GenAI, Autonomous \tSupercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Supercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt\t0.61\t13601\t14050\n build AI-enabled applications supporting many use cases involving natural language-to-SQL query generation, retrieval augmented generation (RAG), synthetic data generation, sentiment analysis, text summarization, or content generation, among others. Select AI automates the orchestration of various specialized tools \u2013 whether from Oracle or third parties. One of the lesser-known use cases, however, is using Select AI right within your SQL que\tSupercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Supercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt\t0.61\t401\t850\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","","### Using an in-database transformer","","So far, we've been using the cloud-based transformer (embedding model) through OCI GenAI Services. ","Oracle Autonomous Database also offers the ability to use in-database transformers for generating vector embeddings in the database.","","In the following section, we'll explore how to use an in-database transformer.","","The `profile.set_attribute()` method's `embedding_model` parameter allows you to specify your desired text embedding model. Oracle provides several pre-built ONNX transformer models that have been augmented through a specialized pipeline:","","**Text Embedding Models:**","- `ALL_MINILM_L12_V2` - Optimized for English language content with faster processing and compact 384-dimensional embeddings","- `MULTILINGUAL_E5_SMALL` - Supports over 100 languages with 384-dimensional embeddings, ideal for multilingual applications","","**Multimodal CLIP Models:**","- `CLIP_VIT_BASE_PATCH32_IMG` - CLIP model for image embeddings (512 dimensions)","- `CLIP_VIT_BASE_PATCH32_TXT` - CLIP model for text embeddings (512 dimensions)","","Each transformer offers different capabilities and vector dimensions. You can switch the active embedding model by updating the profile with `profile.set_attribute()`, as demonstrated below. In this example, we use the `MULTILINGUAL_E5_SMALL` model to leverage its multilingual capabilities. The same embedding model must be used consistently when creating the vector index and vectorizing the user prompt.","","> Note: Refer to the Select AI Prerequisites and Setup notebook to load these transformer models to the database.","","For additional information on these models, refer to these blogs:","","Prebuilt ONNX Models for Embedding Generation<\/a>"," So far, we've been using the cloud-based transformer (embedding model) through OCI GenAI Services.\nOracle Autonomous Database also offers the ability to use in-database transformers for generating vector embeddings in the database.<\/p>\n In the following section, we'll explore how to use an in-database transformer.<\/p>\n The Text Embedding Models:<\/strong><\/p>\n Multimodal CLIP Models:<\/strong><\/p>\n Each transformer offers different capabilities and vector dimensions. You can switch the active embedding model by updating the profile with Note: Refer to the Select AI Prerequisites and Setup notebook to load these transformer models to the database.<\/p>\n<\/blockquote>\n For additional information on these models, refer to these blogs:<\/p>\n Prebuilt ONNX Models for Embedding Generation<\/a>\n Having configured our AI profile This new vector index will use the same source data and chunking parameters as before, but will generate embeddings using the in-database transformer model.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Create the vector index on the same blogs using the in-database transformer","message":["%python","","vector_index_attributes2 = select_ai.OracleVectorIndexAttributes("," location = \"https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/\","," object_storage_credential_name = \"OCI_CRED2\","," vector_distance_metric = select_ai.VectorDistanceMetric.COSINE,"," chunk_overlap = 50,"," chunk_size = 450)","","vector_index2 = select_ai.VectorIndex("," index_name = \"MY_VECTOR_INDEX3\","," attributes = vector_index_attributes2,"," description = \"Vector index for Oracle Machine Learning and Select AI blogs\","," profile = profile)","","try:"," vector_index2.delete(include_data = True, force = True)","except:"," pass","","vector_index2.create()","print(\"Vector index created: \" + vector_index2.index_name)"],"enabled":true,"result":{"startTime":1760326878714,"interpreter":"python.low","endTime":1760326880986,"results":[{"message":"Vector index created: MY_VECTOR_INDEX3\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Pause for 5 seconds for pipeline job to start","message":["%python","","time.sleep(5)"],"enabled":true,"result":{"startTime":1760326881362,"interpreter":"python.low","endTime":1760326886730,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Check on running pipeline","message":["%python","","result = oml.sync(query = \"\"\""," SELECT job_name, job_style, session_id, elapsed_time, log_id"," FROM USER_SCHEDULER_RUNNING_JOBS","\"\"\")","","if result.shape[0] == 0:"," print(\"Pipeline has completed - no running jobs found.\")","else:"," z.show(result)"],"enabled":true,"result":{"startTime":1760326887098,"interpreter":"python.low","endTime":1760326887740,"results":[{"message":"JOB_NAME\tJOB_STYLE\tSESSION_ID\tELAPSED_TIME\tLOG_ID\nPIPELINE$30\tREGULAR\t40134\t0 days 00:00:01.871444\t92164\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Pause for 5 seconds for vector index table creation","message":["%python","","time.sleep(5)"],"enabled":true,"result":{"startTime":1760326888115,"interpreter":"python.low","endTime":1760326893490,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Create a view MY_VECTOR_INDEX_STATUS_VIEW2 with the status results","message":["%python","","index_name = 'MY_VECTOR_INDEX3'","","# Use oml.sync for the query","result = oml.sync(query = f\"\"\""," SELECT pipeline_name, status_table"," FROM user_cloud_pipelines"," WHERE pipeline_name = '{index_name}$VECPIPELINE'","\"\"\")","","if result.shape[0] > 0:"," # Get first row from DataFrame"," row = result.pull().iloc[0]"," pipeline_name = row['PIPELINE_NAME']"," table_name = row['STATUS_TABLE']"," "," print(\"Pipeline Name: \" + pipeline_name)"," print(\"Status Table: \" + table_name)"," "," # Still need cursor for DDL"," cursor = oml.cursor()"," cursor.execute(f\"CREATE OR REPLACE VIEW MY_VECTOR_INDEX_STATUS_VIEW2 AS SELECT name, status, error_message FROM {table_name}\")"," cursor.execute('commit')"," print(\"View created\")"],"enabled":true,"result":{"startTime":1760326893864,"interpreter":"python.low","endTime":1760326894243,"results":[{"message":"Pipeline Name: MY_VECTOR_INDEX3$VECPIPELINE\nStatus Table: PIPELINE$30$257_STATUS\nView created\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":"[{\"raw\":{\"height\":300,\"lastColumns\":[],\"version\":1}}]","hideInIFrame":false,"selectedVisualization":"table","title":"View the status of processed files for vector indexing","message":["%python","","result = oml.sync(query = \"SELECT * FROM MY_VECTOR_INDEX_STATUS_VIEW2\")","","z.show(result)"],"enabled":true,"result":{"startTime":1760326894631,"interpreter":"python.low","endTime":1760326895048,"results":[{"message":"NAME\tSTATUS\tERROR_MESSAGE\n6 Simple Tips for Better Text-to-SQL Generation.txt\tCOMPLETED\tNone\nADB-Select-AI-Accelerate-innovation-with-enterprise-data-OCI-GenerativeAIand-enhanced-security.txt\tCOMPLETED\tNone\nAnnouncing Additional AI Providers for Oracle Autonomous Database Select AI.txt\tCOMPLETED\tNone\nAnnouncing Oracle Machine Learning for Python 2.1.txt\tCOMPLETED\tNone\nAnnouncing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt\tCOMPLETED\tNone\nAnnouncing-New-Oracle-Machine-Learning-Features-in-Oracle-Databas-23ai.txt\t2\tNone\nAnnouncing-OML-Data-Monitoring-User-Interface-on-Autonomous-Database.txt\tPENDING\tNone\nAnnouncing-OML-Monitoring-on-Autonomous-Database.txt\tPENDING\tNone\nAnnouncing-OML-Services-Batch-Scoring-on-Autonomous-Database.txt\tPENDING\tNone\nAnnouncing-Select-AI-with-Azure-OpenAI-Service-on-Oracle-Autonomous-Database.txt\tCOMPLETED\tNone\nAnnouncing-custom-third-party-Python-and-R-packages-for-use-on-Autonomous-Database.txt\tCOMPLETED\tNone\nAnnouncing-next-generation-OML-Notebooks-on-Oracle-Autonomous-Database.txt\tCOMPLETED\tNone\nAnnouncing-the-release-of-Oracle-Machine-Learning-for-Python-2.0-on-Autonomous-Database.txt\tCOMPLETED\tNone\nApproaches-to-detect-potential-fraud.txt\tCOMPLETED\tNone\nBoost-your-R-to-database-connectivity-using-ROracle.txt\t2\tNone\nData-Driven-Decision-making-for-Debt-Collection.txt\tPENDING\tNone\nData-Monitoring-with-Oracle-Machine-Learning-Services.txt\tPENDING\tNone\nDevelop-and-deploy-machine-learning-models-using-Oracle-Autonomous-Database-Machine-Learning-and-APEX.txt\tPENDING\tNone\nExploit-Data-Parallelism-for-R-Scalability-using-Oracle-Machine-Learning-for-R.txt\tCOMPLETED\tNone\nHow-to-perform-in-database-text-analytics-using-a-pre-built-ML-model.txt\tCOMPLETED\tNone\nICYMI-Embedding-AI-ML-in-your-application-using-Oracle-Machine-Learning.txt\tCOMPLETED\tNone\nICYMI-Learn-How-to-Invoke-Your-Python-Functions-from-SQL-with-OML4Py.txt\tCOMPLETED\tNone\nIntroducing-Select-AI-Natural-Language-to-SQL-Generation-on-Autonomous-Database.txt\tCOMPLETED\tNone\nManage-your-models-with-Oracle-Machine-Learning-on-Autonomous-Database.txt\t2\tNone\nModel-Monitoring-with-Oracle-Machine-Learning-Services.txt\tPENDING\tNone\nNow-Available-Pre-built-Embedding-Generation-model-for-Oracle-Database-23ai.txt\tPENDING\tNone\nOML-AutoML-UI-click-your-way-to-an-ML-model.txt\tPENDING\tNone\nOML4Py-Leveraging-ONNX-and-Hugging-Face-for-AI-Vector-Search.txt\tCOMPLETED\tNone\nOracleMachine-Learning-for-R-2.0-now-available-for-Oracle-Database.txt\tCOMPLETED\tNone\nSelect AI Enhances Text-to-SQL Support.txt\tCOMPLETED\tNone\nSelect AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt\tCOMPLETED\tNone\nSimplify-your-model-monitoring-and-MLOps-with-OML-Model-Monitoring-UI.txt\tCOMPLETED\tNone\nStoring-Named-R-and-Python-Functions-in-the-Oracle-Machine-Learning-Script-Repository.txt\t2\tNone\nSupercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt\tPENDING\tNone\nTop-10-Reasons-to-use-Machine-Learning-in-Oracle-Database.txt\tPENDING\tNone\nUsing-Machine-Learning-for-Smart-Investment.txt\tPENDING\tNone\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Create a profile proxy object for the current session","message":["%python","","profile2 = select_ai.Profile(profile_name = \"IN_DB_TRANSFORMER_RAG_DEMO\")"],"enabled":true,"result":{"startTime":1760326895434,"interpreter":"python.low","endTime":1760326895801,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Verify the profile is using the in-database transformer","message":["%python","","attributes = profile2.get_attributes()","print(\"Profile:\", profile2.profile_name)","print(\"Transformer:\", attributes.provider.embedding_model)","print(\"Vector Index:\", attributes.vector_index_name)"],"enabled":true,"result":{"startTime":1760326896169,"interpreter":"python.low","endTime":1760326896529,"results":[{"message":"Profile: IN_DB_TRANSFORMER_RAG_DEMO\nTransformer: database:MULTILINGUAL_E5_SMALL\nVector Index: MY_VECTOR_INDEX3\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"What are the benefits of using Select AI","message":["%python","","response = profile2.narrate(prompt = \"what are the benefits of using Select AI\")","","formatted = response.replace('\\\\n', '\\n')","print(formatted)"],"enabled":true,"result":{"startTime":1760326896917,"interpreter":"python.low","endTime":1760326911898,"results":[{"message":"The benefits of using Select AI include democratizing data access, removing barriers to using enterprise data, and providing more relevant results. Select AI allows users to access and query corporate data stores using natural language, rather than relying on SQL experts. This helps to produce more accurate and relevant responses when provided with sufficient context from enterprise data. Additionally, Select AI with Retrieval Augmented Generation (RAG) makes it easy to use LLMs with semantic similarity search to generate responses based on private data using natural language prompts, while helping to reduce the risk of hallucination.\n\nSources:\n - Announcing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Announcing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt, offsets [12401:12850])\n - Announcing-Select-AI-with-Azure-OpenAI-Service-on-Oracle-Autonomous-Database.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Announcing-Select-AI-with-Azure-OpenAI-Service-on-Oracle-Autonomous-Database.txt, offsets [401:850])\n - Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt, offsets [6001:6450])\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Use runsql for the same prompt","message":["%python","","result = profile2.run_sql(prompt = \"what are the benefits of using Select AI\")","z.show(result)"],"enabled":true,"result":{"startTime":1760326912303,"interpreter":"python.low","endTime":1760326912849,"results":[{"message":"data\tsource\turl\tscore\tstart_offset\tend_offset\name. Key benefits Select AI RAG offers the following benefits: Democratize data access: Remove barriers to using enterprise data. Instead of relying on SQL experts to access and query corporate data stores, simply provide questions in natural language and leverage powerful vector search. More relevant results: LLMs can produce more accurate and relevant responses when provided with sufficient context from enterprise data. This helps to re\tAnnouncing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Announcing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt\t0.71\t12401\t12850\ng Oracle CloudWorld \u201923, Select AI makes it easy to query your data using natural language. Check out the blog Autonomous Database speaks \"human\" to see how it's done. Select AI with Azure OpenAI Service We're excited to announce that you can now use Select AI with Azure OpenAI Service. Not only do you get access to the latest OpenAI models hosted on Azure, but this new integration is a great step toward improving data governance. Through ou\tAnnouncing-Select-AI-with-Azure-OpenAI-Service-on-Oracle-Autonomous-Database.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Announcing-Select-AI-with-Azure-OpenAI-Service-on-Oracle-Autonomous-Database.txt\t0.67\t401\t850\n Select AI is natively integrated into the Oracle Database engine, giving unparalleled access to database metadata, object definitions, and user privileges, allowing for more accurate, secure, and context-aware SQL generation. Security that is built-In, not bolted on: Unlike external solutions, Select AI fully leverages Oracle Database\u2019s security model and natively supports auditing, privilege enforcement, rate limiting, and row-level security\tSupercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Supercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt\t0.66\t12001\t12450\nin Oracle Cloud Storage. Why use Select AI RAG? Select AI RAG makes it easy to use LLMs with semantic similarity search to generate responses based on your private data using natural language prompts. With Select AI RAG, you can get more relevant responses based on up-to-date information, while helping to reduce the risk of hallucination. By leveraging Select AI with RAG to augment your prompt with your enterprise data, you can bridge the\tSelect AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt\t0.63\t6001\t6450\nAnnouncing Select AI with Azure OpenAI Service on Oracle Autonomous Database November 10, 2023 | 6 minute read Mark Hornick Senior Director, Data Science and Machine Learning With the constantly evolving AI landscape, how are you keeping pace with advances in AI? Addressing that problem was one of the key requirements when we designed Select AI for Autonomous Database. As introduced during Oracle CloudWorld \u201923, Select AI makes it easy t\tAnnouncing-Select-AI-with-Azure-OpenAI-Service-on-Oracle-Autonomous-Database.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Announcing-Select-AI-with-Azure-OpenAI-Service-on-Oracle-Autonomous-Database.txt\t0.63\t1\t450\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Use 'narrate' for the same prompt in Italian","message":["%python","","response = profile2.narrate(prompt = \"quali sono i vantaggi dell utilizzo Select AI\")","","formatted = response.replace('\\\\n', '\\n')","print(formatted)"],"enabled":true,"result":{"startTime":1760326913231,"interpreter":"python.low","endTime":1760326929619,"results":[{"message":"I vantaggi dell'utilizzo di Select AI includono la possibilit? di utilizzare l'intelligenza artificiale generativa da una vasta gamma di provider di AI di terze parti direttamente dal database, la gestione della sicurezza e della conformit? grazie all'integrazione nativa con il motore del database Oracle, e la possibilit? di costruire applicazioni abilitate all'AI in modo rapido e semplice. Inoltre, Select AI consente di accedere e interrogare i dati aziendali utilizzando il linguaggio naturale, rimuovendo le barriere all'uso dei dati aziendali e producendo risultati pi? pertinenti. \n\nSources:\n - Select AI Enhances Text-to-SQL Support.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Select AI Enhances Text-to-SQL Support.txt, offsets [6001:6450])\n - Announcing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Announcing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt, offsets [4001:4450])\n - Supercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Supercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt, offsets [12401:12850])\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"table","title":"Use 'runsql' for the same prompt in Italian","message":["%python","","response = profile2.run_sql(prompt = \"quali sono i vantaggi dell utilizzo Select AI\")","","z.show(response)"],"enabled":true,"result":{"startTime":1760326930002,"interpreter":"python.low","endTime":1760326930558,"results":[{"message":"data\tsource\turl\tscore\tstart_offset\tend_offset\nmetadata. Select AI automatically builds and maintains a vector index in the background using the metadata for all the applicable objects in your schema. Using semantic similarity search, Select AI is designed to choose the most relevant objects based on the user prompt. You can enable this using the following profile attributes, where the object list can specify one or more schemas as well as specific tables. \"object_list_mode\": \"automate\tSelect AI Enhances Text-to-SQL Support.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Select AI Enhances Text-to-SQL Support.txt\t0.49\t6001\t6450\nappropriate sizes and applies the specified transformer model to produce vector embeddings. Documents can come from data sources such as Object Storage. Vector store creation An important feature of Select AI RAG is the integrated automatic update of new data from Object Storage into the vector store. As new data arrives in Object Storage, it is automatically added to the corresponding vector store and the vector index is updated. \tAnnouncing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Announcing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt\t0.44\t4001\t4450\nenforcement, rate limiting, and row-level security. Select AI helps you to adhere to your organization\u2019s governance and compliance standards. LLM-agnostic and enterprise-ready: Choose from a wide range of AI providers, including public LLMs like OpenAI GPT-4o, Cohere Command-A, Gemini 2.5 Pro, Claude 3.5 Sonnet, and many others. Select AI securely connects to LLMs using cloud-native service principal tokens (AWS ARN, Google Cloud IAM, Azure SPs)\tSupercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Supercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt\t0.44\t12401\t12850\n Select AI is natively integrated into the Oracle Database engine, giving unparalleled access to database metadata, object definitions, and user privileges, allowing for more accurate, secure, and context-aware SQL generation. Security that is built-In, not bolted on: Unlike external solutions, Select AI fully leverages Oracle Database\u2019s security model and natively supports auditing, privilege enforcement, rate limiting, and row-level security\tSupercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Supercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt\t0.44\t12001\t12450\nSupercharge SQL: Unleashing AI Queries with Oracle Autonomous Database Select AI June 20, 2025 | 10 minute read Mark Hornick Senior Director, Machine Learning and AI Product Management Oracle Autonomous Database Select AI is a powerful tool that allows you to use generative AI from a wide range of third-party AI providers\u2013 right from your database. Select AI quickly and easily enables you to build AI-enabled applications supporting many use\tSupercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt\thttps://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Supercharge SQL Unleashing AI Queries with Oracle Autonomous Database Select AI.txt\t0.44\t1\t450\n","type":"TABLE"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","","#### Use GENERATE for dynamic action selection","","The `generate()` method handles different Select AI actions specified as an argument. Additional parameters like conversation IDs can be passed for context-aware ","conversations. ","","The examples demonstrate using generate with different actions: 'chat' for direct LLM model interaction, 'runsql' to run queries, and 'narrate' to provide a natural ","language interpretation of the query result."],"enabled":true,"result":{"startTime":1760326930938,"interpreter":"md.low","endTime":1760326931276,"results":[{"message":" The The examples demonstrate using generate with different actions: 'chat' for direct LLM model interaction, 'runsql' to run queries, and 'narrate' to provide a natural\nlanguage interpretation of the query result.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Use GENERATE with Select AI RAG 'chat'","message":["%python","","response = profile2.generate("," prompt = \"What are the benefits of Select AI for retrieval augmented generation (RAG)?\","," action = select_ai.Action.CHAT",")","print(response)"],"enabled":true,"result":{"startTime":1760326931658,"interpreter":"python.low","endTime":1760326945038,"results":[{"message":"Select AI is a retrieval-augmented generation (RAG) model that combines the strengths of retrieval and generation to produce high-quality text. The benefits of Select AI for RAG include:\n\n1. **Improved accuracy**: By retrieving relevant information from a large database or knowledge graph, Select AI can generate more accurate and informative text, reducing the likelihood of errors or inaccuracies.\n2. **Increased context understanding**: Select AI's retrieval component allows it to better understand the context of the input prompt, enabling it to generate text that is more relevant and coherent.\n3. **Enhanced knowledge coverage**: The model's ability to retrieve information from a large database or knowledge graph enables it to cover a wider range of topics and domains, making it a more versatile and knowledgeable generator.\n4. **Reducing hallucinations**: Select AI's retrieval component helps to reduce hallucinations (i.e., generating text that is not based on actual facts or evidence) by providing a factual basis for the generated text.\n5. **Improved fluency and coherence**: The model's generation component can produce fluent and coherent text, while the retrieval component ensures that the generated text is grounded in reality and consistent with the input prompt.\n6. **Flexibility and adaptability**: Select AI can be fine-tuned for specific tasks or domains, allowing it to adapt to different applications and use cases.\n7. **Efficient use of knowledge**: The model's retrieval component enables it to efficiently use the knowledge stored in the database or knowledge graph, reducing the need for redundant or unnecessary generation.\n8. **Better handling of ambiguity and uncertainty**: Select AI's retrieval component can help to resolve ambiguities and uncertainties in the input prompt, enabling the model to generate more accurate and informative text.\n9. **Improved evaluation and feedback**: The model's retrieval component can provide a basis for evaluating and feedback on the generated text, enabling more effective assessment and improvement of the model's performance.\n10. **Potential for multimodal generation**: Select AI's architecture can be extended to support multimodal generation, enabling the model to generate text, images, or other types of media in response to input prompts.\n\nOverall, the benefits of Select AI for RAG make it a powerful tool for a wide range of natural language processing applications, including text generation, question answering, and dialogue systems.\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Use GENERATE with Select AI RAG 'narrate'","message":["%python","","response = profile2.generate("," prompt = \"What are the benefits of Select AI for retrieval augmented generation (RAG)?\","," action = select_ai.Action.NARRATE",")","print(response)"],"enabled":true,"result":{"startTime":1760326945411,"interpreter":"python.low","endTime":1760326955896,"results":[{"message":"The benefits of Select AI for retrieval augmented generation (RAG) include democratizing data access, removing barriers to using enterprise data, and producing more relevant results. Select AI RAG makes it easy to use LLMs with semantic similarity search to generate responses based on private data using natural language prompts, while helping to reduce the risk of hallucination. Additionally, Select AI RAG offers the ability to get more relevant responses based on up-to-date information.\n\nSources:\n - Announcing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Announcing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt, offsets [1:450])\n - Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt, offsets [6001:6450])\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":"[{\"raw\":{\"height\":300,\"lastColumns\":[],\"version\":1}}]","hideInIFrame":false,"selectedVisualization":"raw","title":"Use GENERATE with Select AI RAG 'runsql'","message":["%python","","response = profile2.generate("," prompt = \"What are the benefits of Select AI for retrieval augmented generation (RAG)?\","," action = select_ai.Action.RUNSQL",")","print(response)"],"enabled":true,"result":{"startTime":1760326956291,"interpreter":"python.low","endTime":1760326956884,"results":[{"message":"[\n {\n \"data\" : \"Announcing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database September 10, 2024 | 10 minute read Mark Hornick Senior Director, Machine Learning and AI Product Management We\u2019re excited to introduce the availability of Select AI with support for Retrieval Augmented Generation (RAG) \u2013 making it easy to use LLMs to gain insight or generate innovative content based on your private data using natural language prompts. Wit\",\n \"source\" : \"Announcing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt\",\n \"url\" : \"https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Announcing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt\",\n \"score\" : 0.82,\n \"start_offset\" : 1,\n \"end_offset\" : 450\n },\n {\n \"data\" : \"ame. Key benefits Select AI RAG offers the following benefits: Democratize data access: Remove barriers to using enterprise data. Instead of relying on SQL experts to access and query corporate data stores, simply provide questions in natural language and leverage powerful vector search. More relevant results: LLMs can produce more accurate and relevant responses when provided with sufficient context from enterprise data. This helps to re\",\n \"source\" : \"Announcing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt\",\n \"url\" : \"https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Announcing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt\",\n \"score\" : 0.76,\n \"start_offset\" : 12401,\n \"end_offset\" : 12850\n },\n {\n \"data\" : \"in Oracle Cloud Storage. Why use Select AI RAG? Select AI RAG makes it easy to use LLMs with semantic similarity search to generate responses based on your private data using natural language prompts. With Select AI RAG, you can get more relevant responses based on up-to-date information, while helping to reduce the risk of hallucination. By leveraging Select AI with RAG to augment your prompt with your enterprise data, you can bridge the\",\n \"source\" : \"Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt\",\n \"url\" : \"https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt\",\n \"score\" : 0.76,\n \"start_offset\" : 6001,\n \"end_offset\" : 6450\n },\n {\n \"data\" : \" the retrieval-augmented generation (RAG) workflow, and enables generating synthetic data. Select AI enables you to take your application and AppDev to the next level with generative AI, conveniently through SQL. We\u2019re announcing general availability for several Select AI enhancements on Autonomous Database for natural language to SQL query generation, also known as NL2SQL or text-to-SQL. These new capabilities can help improve query and resul\",\n \"source\" : \"Select AI Enhances Text-to-SQL Support.txt\",\n \"url\" : \"https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Select AI Enhances Text-to-SQL Support.txt\",\n \"score\" : 0.75,\n \"start_offset\" : 401,\n \"end_offset\" : 850\n },\n {\n \"data\" : \"Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers May 6, 2025 | 5 minute read Mark Hornick Senior Director, Machine Learning and AI Product Management Last year, we announced Select AI Retrieval Augmented Generation (RAG) for Oracle Autonomous Database, which uses Oracle Database 23ai AI Vector Search and transformers hosted by your choice of supported AI providers. Cloud-based transformers (also kno\",\n \"source\" : \"Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt\",\n \"url\" : \"https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt\",\n \"score\" : 0.72,\n \"start_offset\" : 1,\n \"end_offset\" : 450\n }\n]\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":"[{\"raw\":{\"height\":300,\"lastColumns\":[],\"version\":1}}]","hideInIFrame":false,"selectedVisualization":"raw","title":"Use GENERATE with Select AI RAG 'narrate'","message":["%python","","response = profile2.generate("," prompt = \"How do I create a vector index in Select AI?\","," action = select_ai.Action.NARRATE",")","print(response)"],"enabled":true,"result":{"startTime":1760326957265,"interpreter":"python.low","endTime":1760326967249,"results":[{"message":"To create a vector index in Select AI, you can use the `DBMS_CLOUD_AI.CREATE_VECTOR_INDEX` procedure. This procedure takes an index name and a set of attributes, including the vector database provider, location in Object Storage, Object Storage credential name, AI profile name, vector size, distance metric, and chunk overlap and size. \n\nHere is an example of how to create a vector index:\n```sql\nBEGIN\n DBMS_CLOUD_AI.CREATE_VECTOR_INDEX(\n index_name => 'MY_VECTOR_INDEX',\n attributes => '{\"vector_db_provider\": \"oracle\", \n \"location\": \"https:.../my_namespace/my_bucket/my_data_folder\", \n \"object_storage_credential_name\": \"OCI_CRED\", \n \"profile_name\": \"OPENAI_TEXT_TRANSFORMER\", \n \"vector_dimension\": 1536, \n \"vector_distance_metric\": \"cosine\"}'\n );\nEND;\n```\n\nSources:\n - Announcing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Announcing Select AI with Retrieval Augmented Generation (RAG) on Autonomous Database.txt, offsets [6001:6450])\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":"[{\"raw\":{\"height\":300,\"lastColumns\":[],\"version\":1}}]","hideInIFrame":false,"selectedVisualization":"raw","title":"Use GENERATE with Select AI RAG 'narrate'","message":["%python","","response = profile2.generate("," prompt = \"What do I need to specify in my AI profile to enable RAG?\","," action = select_ai.Action.NARRATE",")","print(response) "],"enabled":true,"result":{"startTime":1760326967638,"interpreter":"python.low","endTime":1760326974331,"results":[{"message":"To enable RAG, you need to specify the \"vector_index_name\" in your AI profile, which is the name of the index you might have created. Additionally, you can specify the \"embedding_model\" attribute to use an in-database transformer. You would also specify the \"provider\" attribute set to the AI provider hosting your model.\n\nSources:\n - Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt (https://objectstorage.ap-tokyo-1.oraclecloud.com/p/z2owElG2mSpDpE7o_W64WhaTAkcgyEE5UgFbna5zoilICjl06iHMMnCXdc1P6SVo/n/adwc4pm/b/select_ai_rag_demo_1/o/Select AI Retrieval Augmented Generation now supports in-database ONNX-format transformers.txt, offsets [1201:1650])\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### End of Script"],"enabled":true,"result":{"startTime":1760326974715,"interpreter":"md.low","endTime":1760326975042,"results":[{"message":" Select AI Synthetic Data Generation (SDG) enables using the LLM to generate data to populate database tables.\nThis can be helpful when real or production data is unavailable, limited, or contains sensitive information that has restricted access.<\/p>\n Select AI provides metadata to the LLM and, if requested, example rows from each table, to help the LLM produce rows that meet the table definition and referential integrity constraints.<\/p>\n This notebook demonstrates using Select AI's Key benefits include:<\/p>\n SDG enables you to develop, test, and demonstrate solutions effectively while maintaining data privacy and security.<\/p>\n Copyright (c) 2025 Oracle Corporation<\/p>\nSetup Overview<\/h4>\n
\n
\n
\n
The Universal Permissive License (UPL), Version 1.0<\/a><\/h6>\n
\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### For more information...","","Select AI for Python documentation<\/a>"],"enabled":true,"result":{"startTime":1760327450806,"interpreter":"md.low","endTime":1760327451144,"results":[{"message":"For more information...<\/h3>\n
ADMIN: Grant 'EXECUTE' on DBMS_CLOUD packages<\/h3>\n
ADMIN<\/code> user must grant execute privileges on DBMS_CLOUD<\/code>, DBMS_CLOUD_AI<\/code>, and DBMS_CLOUD_PIPELINE<\/code> packages to the Select AI user. In SelectAI4Py, use\nselect_ai.enable_provider<\/code> to grant these privileges to a single user or list of users. Replace SELECT_AI_USER<\/code> with your username.<\/p>\nselect_ai.enable_provider<\/code> also enables users to invoke the AI (LLM) endpoint by adding them to the Access Control List (ACL).<\/p>\nSelect AI User: Create cloud authentication credential<\/h3>\n
select_ai.create_credential()<\/code> function securely stores your OCI identity information (user OCID, tenancy OCID, private key, and API key fingerprint).<\/p>\n\n
credential_name<\/code>: A unique identifier for this set of credentials ("OCI_CRED2" in this example)<\/li>\nuser_ocid<\/code>: Your OCI user's unique identifier<\/li>\ntenancy_ocid<\/code>: Your OCI tenancy's unique identifier<\/li>\nprivate_key<\/code>: Your RSA private key (in PEM format) that authenticates API requests<\/li>\nfingerprint<\/code>: The fingerprint of the public key uploaded to your OCI user account<\/li>\n<\/ul>\nselect_ai<\/code> functions.<\/p>\n\n
AI Profile Overview<\/h3>\n
\n
\n
Create an AI profile for chat, NL2SQL, and SDG<\/h3>\n
OCI_GENAI_PY_DEMO<\/code> to support chat interactions, querying the database using natural language, and generating synthetic data.<\/p>\nmeta.llama-3.1-70b-instruct<\/code> LLM.<\/p>\nCUSTOMERS<\/code>, SALES<\/code>, PRODUCTS<\/code>, and COUNTRIES<\/code>.<\/p>\n\n
\n
"object_list_mode": "automated"<\/code> in the DBMS_CLOUD_AI.CREATE_PROFILE<\/code> attributes list to enable this feature. See "Automatically Detect Relevant Table Metadata" in Example: Improve SQL Query Generation for details<\/a>.<\/p>\n<\/blockquote>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Select AI user: OCI_GENAI_PY_DEMO profile definition","message":["%python","","# OCI GenAI uses the default model if \"model\" is not set in attributes ","","import select_ai","","provider = select_ai.OCIGenAIProvider()","","profile_attributes = select_ai.ProfileAttributes("," provider = provider,"," credential_name = \"OCI_CRED2\","," conversation = True,"," comments = True,"," constraints = True,"," annotations = True,"," object_list =["," {\"owner\": \"SH\", \"name\": \"CUSTOMERS\"},"," {\"owner\": \"SH\", \"name\": \"SALES\"},"," {\"owner\": \"SH\", \"name\": \"PRODUCTS\"},"," {\"owner\": \"SH\", \"name\": \"COUNTRIES\"}"," ])","","profile = select_ai.Profile("," profile_name = \"OCI_GENAI_PY_DEMO \","," attributes = profile_attributes,"," description = \"Profile for chat, NL2SQL, and SDG\","," replace = True)","","print(profile.profile_name + \" profile has been successfully created\")"],"enabled":true,"result":{"startTime":1760327456816,"interpreter":"python.low","endTime":1760327460181,"results":[{"message":"OCI_GENAI_PY_DEMO profile has been successfully created\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### Create an AI profile for RAG","","We'll create an AI profile named `OCI_GENAI_RAG_PY_DEMO` that also uses OCI Generative AI Service as the provider and the same LLM. ","But we also can specify the embedding model (or transformer) we want to use for generating vectors. ","","Additionally, we'll specify a vector index named `MY_VECTOR_INDEX2` to enable RAG. This profile will be used in the corresponding RAG notebook. ","",">Note, we haven't created `MY_VECTOR_INDEX2` yet. That will be done in the notebook that covers RAG. ","","In this profile, we enable conversations and set it as the current profile after creation. ","","The RAG profile will allow you to ask questions about customer documentation in your vector store, such as 'What are our service level agreements for high-value customers ","in the Asia Pacific region?' and receive answers enhanced with information derived from your object storage documents."],"enabled":true,"result":{"startTime":1760327460554,"interpreter":"md.low","endTime":1760327460886,"results":[{"message":"Create an AI profile for RAG<\/h3>\n
OCI_GENAI_RAG_PY_DEMO<\/code> that also uses OCI Generative AI Service as the provider and the same LLM.\nBut we also can specify the embedding model (or transformer) we want to use for generating vectors.<\/p>\nMY_VECTOR_INDEX2<\/code> to enable RAG. This profile will be used in the corresponding RAG notebook.<\/p>\n\n
MY_VECTOR_INDEX2<\/code> yet. That will be done in the notebook that covers RAG.<\/p>\n<\/blockquote>\n
","Multilingual Support for Semantic Similarity Search<\/a>"],"enabled":true,"result":{"startTime":1760327462903,"interpreter":"md.low","endTime":1760327463238,"results":[{"message":"Transformer model selection<\/h4>\n
embedding_model<\/code> parameter allows you to choose between different text embedding models and deployment approaches. You can use third-party hosted transformer\nmodels from providers like OpenAI or Cohere, or use in-database transformers as described below.<\/p>\n\n
profile.set_attribute()<\/code>, as demonstrated below in this section.<\/p>\n
\nMultilingual Support for Semantic Similarity Search<\/a><\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Load Hugging Face all-MiniLM-L12-v2 model","message":["%python","","import oml","cursor = oml.cursor()","","model_name = 'ALL_MINILM_L12_V2'","onnx_file = 'all_MiniLM_L12_v2.onnx'","location_uri = 'https://adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com/p/qXfE9JKYR_w7UP-473agAv_c9b0rQC6vo8_K6bCsaBpSXO0CFzFp7HHx_H7P8HGf/n/adwc4pm/b/OML-ai-models/o/'","","cursor.execute(f\"\"\"","BEGIN"," BEGIN "," DBMS_DATA_MINING.DROP_MODEL('{model_name}');"," EXCEPTION WHEN OTHERS THEN NULL; "," END;"," "," DBMS_CLOUD.GET_OBJECT("," credential_name => 'OCI_CRED2',"," directory_name => 'DATA_PUMP_DIR',"," object_uri => '{location_uri}{onnx_file}');"," "," DBMS_VECTOR.LOAD_ONNX_MODEL("," directory => 'DATA_PUMP_DIR',"," file_name => '{onnx_file}',"," model_name => '{model_name}');","END;","\"\"\")","","print(model_name + \" model successfully loaded\")"],"enabled":true,"result":{"startTime":1760327463601,"interpreter":"python.low","endTime":1760327475976,"results":[{"message":"ALL_MINILM_L12_V2 model successfully loaded\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":0,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Load Hugging Face multilingual-e5-small model","message":["%python","","model_name = 'MULTILINGUAL_E5_SMALL'","onnx_file = 'multilingual_e5_small.onnx'","location_uri = 'https://adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com/p/k0BGCbupcnBQfLPWX5egR0M7fqKEE3jWqyRDio6Um_AU_N6BheP7yiQgn_0SfmfR/n/adwc4pm/b/OML-ai-models/o/'","","cursor.execute(f\"\"\"","BEGIN"," BEGIN "," DBMS_DATA_MINING.DROP_MODEL('{model_name}');"," EXCEPTION WHEN OTHERS THEN NULL; "," END;"," "," DBMS_CLOUD.GET_OBJECT("," credential_name => 'OCI_CRED2',"," directory_name => 'DATA_PUMP_DIR',"," object_uri => '{location_uri}{onnx_file}');"," "," DBMS_VECTOR.LOAD_ONNX_MODEL("," directory => 'DATA_PUMP_DIR',"," file_name => '{onnx_file}',"," model_name => '{model_name}');","END;","\"\"\")","","print(model_name + \" model successfully loaded\")"],"enabled":true,"result":{"startTime":1760327476335,"interpreter":"python.low","endTime":1760327488102,"results":[{"message":"MULTILINGUAL_E5_SMALL model successfully loaded\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":0,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Load the Hugging Face CLIP ViT-B/32 text model","message":["%python","","model_name = 'CLIP_VIT_BASE_PATCH32_TXT'","onnx_file = 'clip_vit_base_patch32_txt.onnx'","location_uri = 'https://adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com/p/YjeKIRvRbFsq6g5gWFlxazvUxbELCG161GFMEegfYRz7a3gHABeE5m6iQ3fChXYD/n/adwc4pm/b/OML-ai-models/o/'","","cursor.execute(f\"\"\"","BEGIN"," BEGIN "," DBMS_DATA_MINING.DROP_MODEL('{model_name}');"," EXCEPTION WHEN OTHERS THEN NULL; "," END;"," "," DBMS_CLOUD.GET_OBJECT("," credential_name => NULL,"," directory_name => 'DATA_PUMP_DIR',"," object_uri => '{location_uri}{onnx_file}');"," "," DBMS_VECTOR.LOAD_ONNX_MODEL("," directory => 'DATA_PUMP_DIR',"," file_name => '{onnx_file}',"," model_name => '{model_name}',"," metadata => JSON('{{\"function\" : \"embedding\", \"embeddingOutput\" : \"embedding\", \"input\": {{\"input\": [\"DATA\"]}}}}'));","END;","\"\"\")","","print(model_name + \" model successfully loaded\")"],"enabled":true,"result":{"startTime":1760327488468,"interpreter":"python.low","endTime":1760327510555,"results":[{"message":"CLIP_VIT_BASE_PATCH32_TXT model successfully loaded\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":0,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Load the Hugging Face CLIP ViT-B/32 image model","message":["%python","","model_name = 'CLIP_VIT_BASE_PATCH32_IMG'","onnx_file = 'clip_vit_base_patch32_img.onnx'","location_uri = 'https://adwc4pm.objectstorage.us-ashburn-1.oci.customer-oci.com/p/VvKu-Ab2FxWRXrONLXwMclTw0iYAtsUJOVn_m4p1R8rNF4ea8o9ytSPMVf4r3Oid/n/adwc4pm/b/OML-ai-models/o/'","","cursor.execute(f\"\"\"","BEGIN"," BEGIN "," DBMS_DATA_MINING.DROP_MODEL('{model_name}');"," EXCEPTION WHEN OTHERS THEN NULL; "," END;"," "," DBMS_CLOUD.GET_OBJECT("," credential_name => NULL,"," directory_name => 'DATA_PUMP_DIR',"," object_uri => '{location_uri}{onnx_file}');"," "," DBMS_VECTOR.LOAD_ONNX_MODEL("," directory => 'DATA_PUMP_DIR',"," file_name => '{onnx_file}',"," model_name => '{model_name}',"," metadata => JSON('{{\"function\" : \"embedding\", \"embeddingOutput\" : \"embedding\", \"input\": {{\"input\": [\"DATA\"]}}}}'));","END;","\"\"\")","","print(model_name + \" model successfully loaded\")"],"enabled":true,"result":{"startTime":1760327510930,"interpreter":"python.low","endTime":1760327540934,"results":[{"message":"CLIP_VIT_BASE_PATCH32_IMG model successfully loaded\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":0,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"List imported transformer models available for use with in-database ONNX Runtime","message":["%python","","df = oml.sync(query = \"\"\""," SELECT MODEL_NAME"," FROM user_mining_models"," WHERE mining_function = 'EMBEDDING'\"\"\")","","print(df)"],"enabled":true,"result":{"startTime":1760327541298,"interpreter":"python.low","endTime":1760327541689,"results":[{"message":" MODEL_NAME\n0 MULTILINGUAL_E5_SMALL\n1 ALL_MINILM_L12_V2\n2 CLIP_VIT_BASE_PATCH32_IMG\n3 CLIP_VIT_BASE_PATCH32_TXT\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":0,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Select AI user: IN_DB_TRANSFORMER_RAG_DEMO profile definition","message":["%python","","provider = select_ai.OCIGenAIProvider("," embedding_model = \"database:MULTILINGUAL_E5_SMALL\")","","profile_attributes = select_ai.ProfileAttributes("," provider = provider,"," credential_name = \"OCI_CRED2\","," vector_index_name = \"MY_VECTOR_INDEX3\","," enable_source_offsets = True,"," conversation = True)","","profile = select_ai.Profile("," profile_name = \"IN_DB_TRANSFORMER_RAG_DEMO\","," attributes = profile_attributes,"," description = \"Supports RAG with semantic search to augment prompts using a vector store using in-database transformer\","," replace = True)","","print(profile.profile_name + \" profile has been successfully created\")"],"enabled":true,"result":{"startTime":1760327542039,"interpreter":"python.low","endTime":1760327543405,"results":[{"message":"IN_DB_TRANSFORMER_RAG_DEMO profile has been successfully created\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Optionally specify in-database transformer","message":["%python","","profile = select_ai.Profile(profile_name = \"IN_DB_TRANSFORMER_RAG_DEMO\")","","embedding_model = \"database:MULTILINGUAL_E5_SMALL\"","# embedding_model = \"database:CLIP_VIT_BASE_PATCH32_TXT\"","# embedding_model = \"database:CLIP_VIT_BASE_PATCH32_IMG\"","# embedding_model = \"database:ALL_MINILM_L12_V2\"","","profile.set_attribute("," attribute_name = \"embedding_model\","," attribute_value = embedding_model)","","print(\"Updated \" + profile.profile_name + \" to use transformer: \" + embedding_model)"],"enabled":true,"result":{"startTime":1760327543754,"interpreter":"python.low","endTime":1760327544186,"results":[{"message":"Updated IN_DB_TRANSFORMER_RAG_DEMO to use transformer: database:MULTILINGUAL_E5_SMALL\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Review profile configurations","message":["%md","","Once the profiles are defined, we can list and review their configurations. The following paragraph prints each profile's name and description, providing a ","summary of the defined profiles. The second retrieves and displays all profile attributes,such as model type, schema handling options, and object list settings.","","Together, these steps verify that each profile is correctly configured before being used in Select AI queries."],"enabled":true,"result":{"startTime":1760327544532,"interpreter":"md.low","endTime":1760327544856,"results":[{"message":"Next Steps<\/h3>\n
\n
End of Script<\/h1>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"}],"version":"7","snapshot":false,"tags":null}]
\ No newline at end of file
diff --git a/select-ai/python/SelectAI4Py -1- Chat.dsnb b/select-ai/python/SelectAI4Py -1- Chat.dsnb
new file mode 100644
index 0000000..9a876c0
--- /dev/null
+++ b/select-ai/python/SelectAI4Py -1- Chat.dsnb
@@ -0,0 +1 @@
+[{"layout":"jupyter","isRunnable":true,"template":null,"templateConfig":null,"isEditable":true,"name":"SelectAI4Py -1- Chat","description":null,"type":"low","paragraphs":[{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":null,"title":null,"message":[],"enabled":true,"result":{"startTime":1760327940331,"interpreter":"md.low","endTime":1760327940773,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":0,"hideResult":true,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","# Using Select AI for Chat-Based LLM Interactions ","","Select AI enables you to interact with large language models (LLMs) directly from your database through natural language prompts. ","The `chat` action sends your prompt to the LLM and returns the response, supporting more traditional chatbot-like interactions.","","The `chat` action provides your prompt to the LLM without augmentation - supporting a wide range of use cases, for example:","","* Content generation","* Question answering","* Information extraction","* Sentiment analysis","* Chatbot/conversation","* Content translation","* Document summarization","* Write email responses","* Code generation","* Discover topics/themes","","You can apply manual prompt engineering techniques to customize results.","","---","Copyright (c) 2025 Oracle Corporation ","###### [The Universal Permissive License (UPL), Version 1.0](https://oss.oracle.com/licenses/upl/)"],"enabled":true,"result":{"startTime":1760327941139,"interpreter":"md.low","endTime":1760327941476,"results":[{"message":"
Using Select AI for Chat-Based LLM Interactions<\/h1>\n
chat<\/code> action sends your prompt to the LLM and returns the response, supporting more traditional chatbot-like interactions.<\/p>\nchat<\/code> action provides your prompt to the LLM without augmentation - supporting a wide range of use cases, for example:<\/p>\n\n
\nThe Universal Permissive License (UPL), Version 1.0<\/a><\/h6>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### For more information...","","Select AI for Python documentation<\/a>"],"enabled":true,"result":{"startTime":1760327941857,"interpreter":"md.low","endTime":1760327942267,"results":[{"message":"
For more information...<\/h3>\n
Prerequisites<\/h2>\n
\n
Use GENERATE for dynamic action selection<\/h4>\n
generate()<\/code> method handles different Select AI actions specified as an argument. Additional parameters like conversation IDs can be passed for context-aware\nconversations.<\/p>\nEnd of Script<\/h2>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"}],"version":"7","snapshot":false,"tags":null}]
\ No newline at end of file
diff --git a/select-ai/python/SelectAI4Py -2- Natural Language to SQL (NL2SQL).dsnb b/select-ai/python/SelectAI4Py -2- Natural Language to SQL (NL2SQL).dsnb
new file mode 100644
index 0000000..dec4824
--- /dev/null
+++ b/select-ai/python/SelectAI4Py -2- Natural Language to SQL (NL2SQL).dsnb
@@ -0,0 +1 @@
+[{"layout":"jupyter","isRunnable":true,"template":null,"templateConfig":null,"isEditable":true,"name":"SelectAI4Py -2- Natural Language to SQL (NL2SQL)","description":null,"type":"low","paragraphs":[{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":null,"title":null,"message":[],"enabled":true,"result":{"startTime":1760325684854,"interpreter":"md.low","endTime":1760325685300,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":true,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","# Using Select AI for Natural Language to SQL (NL2SQL) Generation","","One of the features of Select AI enables you to ask questions of your database data using natural language. ","Select AI augments your user-provided prompt with metadata from tables and views in your database schema before sending it to LLMs. ","The generated SQL query is then processed according the 'action' specified. ","","Select AI provides multiple **actions**. These are related to NL2SQL: ","","* `showsql` - generate and return the SQL query","* `runsql` (default) - generate and run the SQL query returning the query result","* `narrate` - generate natural language text from data returned from the NL2SQL query or RAG, depending on the AI profile settings","* `explainsql` - return an explanation of generated SQL query","* `showprompt` - return the augmented prompt that Select AI sends to the LLM","",">Note that the full Select AI functionality is available in Oracle Autonomous Database 23ai. NL2SQL is also available with Oracle Database 23.7+ instances and Autonomous Database 19c instances. ","","---","","Copyright (c) 2025 Oracle Corporation ","###### [The Universal Permissive License (UPL), Version 1.0](https://oss.oracle.com/licenses/upl/)"],"enabled":true,"result":{"startTime":1760325685658,"interpreter":"md.low","endTime":1760325686036,"results":[{"message":"
Using Select AI for Natural Language to SQL (NL2SQL) Generation<\/h1>\n
\n
showsql<\/code> - generate and return the SQL query<\/li>\nrunsql<\/code> (default) - generate and run the SQL query returning the query result<\/li>\nnarrate<\/code> - generate natural language text from data returned from the NL2SQL query or RAG, depending on the AI profile settings<\/li>\nexplainsql<\/code> - return an explanation of generated SQL query<\/li>\nshowprompt<\/code> - return the augmented prompt that Select AI sends to the LLM<\/li>\n<\/ul>\n\n
\nThe Universal Permissive License (UPL), Version 1.0<\/a><\/h6>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### For more information...","","Select AI for Python documentation<\/a>"],"enabled":true,"result":{"startTime":1760325686414,"interpreter":"md.low","endTime":1760325686757,"results":[{"message":"
For more information...<\/h3>\n
Prerequisites<\/h2>\n
\n
Working with NL2SQL Actions<\/h3>\n
showsql<\/code> to display SQL generated from natural language without running the query. This is followed by runsql<\/code> to both generate and run the SQL query. Use\nshowprompt<\/code> to reveal the augmented prompt that includes your schema metadata.<\/p>\n
\nYou'll then examine a more complex example that interprets business terms like "baby boomer."<\/p>\nshow_sql<\/code> to view the generated SQL query, run_sql<\/code> to run the generated SQL query, narrate<\/code> to get natural language text from the structured\nresults, explainsql<\/code> to understand the generated SQL, and the generate<\/code> method.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":"Create a profile proxy object for the current session","message":["%python","","import select_ai","","profile = select_ai.Profile(profile_name=\"OCI_GENAI_PY_DEMO\")"],"enabled":true,"result":{"startTime":1760325688517,"interpreter":"python.low","endTime":1760325690887,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Show SQL for \"how many customers do I have?\"","message":["%python","","# This begins a series of conversation-aware queries that build on previous requests using the conversation capability.","","profile.show_sql(prompt = \"how many customers do I have?\")"],"enabled":true,"result":{"startTime":1760325691246,"interpreter":"python.low","endTime":1760325702829,"results":[{"message":"'SELECT COUNT(\"c\".\"CUST_ID\") AS \"customer_count\" FROM \"SH\".\"CUSTOMERS\" \"c\"'\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Run SQL query for \"how many customers do I have?\"","message":["%python","","profile.run_sql(prompt = \"how many customers do I have?\")"],"enabled":true,"result":{"startTime":1760325703189,"interpreter":"python.low","endTime":1760325705358,"results":[{"message":" customer_count\n0 55500\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":"[{\"raw\":{\"height\":400,\"lastColumns\":[],\"version\":1}}]","hideInIFrame":false,"selectedVisualization":"raw","title":"Show prompt for \"how many customers do I have?\"","message":["%python","","import json","","result = profile.show_prompt(prompt = \"how many customers do I have?\")","","if isinstance(result, str):"," parsed = json.loads(result)"," print(json.dumps(parsed, indent=2))","else:"," print(json.dumps(result, indent=2))"],"enabled":true,"result":{"startTime":1760325705710,"interpreter":"python.low","endTime":1760325706477,"results":[{"message":"[\n {\n \"role\": \"SYSTEM\",\n \"content\": [\n {\n \"type\": \"TEXT\",\n \"text\": \"### Oracle SQL tables with their properties:\"\n }\n ]\n },\n {\n \"role\": \"SYSTEM\",\n \"content\": [\n {\n \"type\": \"TEXT\",\n \"text\": \"--'dimension table' # CREATE TABLE \\\"SH\\\".\\\"CUSTOMERS\\\" (\\\"CUST_ID\\\" NUMBER 'primary key' , \\\"CUST_VALID\\\" VARCHAR2(1) , \\\"CUST_EFF_TO\\\" DATE , \\\"CUST_EFF_FROM\\\" DATE , \\\"CUST_SRC_ID\\\" NUMBER , \\\"CUST_TOTAL_ID\\\" NUMBER , \\\"CUST_TOTAL\\\" VARCHAR2(14) , \\\"CUST_EMAIL\\\" VARCHAR2(50) 'customer email id' , \\\"CUST_CREDIT_LIMIT\\\" NUMBER 'customer credit limit' , \\\"CUST_INCOME_LEVEL\\\" VARCHAR2(30) 'customer income level' , \\\"CUST_MAIN_PHONE_NUMBER\\\" VARCHAR2(25) 'customer main phone number' , \\\"COUNTRY_ID\\\" NUMBER 'foreign key to the countries table (snowflake)' , \\\"CUST_STATE_PROVINCE_ID\\\" NUMBER , \\\"CUST_STATE_PROVINCE\\\" VARCHAR2(40) 'customer geography: state or province' , \\\"CUST_CITY_ID\\\" NUMBER , \\\"CUST_CITY\\\" VARCHAR2(30) 'city where the customer lives' , \\\"CUST_POSTAL_CODE\\\" VARCHAR2(10) 'postal code of the customer' , \\\"CUST_STREET_ADDRESS\\\" VARCHAR2(40) 'customer street address' , \\\"CUST_MARITAL_STATUS\\\" VARCHAR2(20) 'customer marital status; low cardinality attribute' , \\\"CUST_YEAR_OF_BIRTH\\\" NUMBER(4,0) 'customer year of birth' , \\\"CUST_GENDER\\\" CHAR(1) 'gender; low cardinality attribute' , \\\"CUST_LAST_NAME\\\" VARCHAR2(40) 'last name of the customer' , \\\"CUST_FIRST_NAME\\\" VARCHAR2(20) 'first name of the customer')\"\n }\n ]\n },\n {\n \"role\": \"SYSTEM\",\n \"content\": [\n {\n \"type\": \"TEXT\",\n \"text\": \"--'facts table, without a primary key; all rows are uniquely identified by the combination of all foreign keys' # CREATE TABLE \\\"SH\\\".\\\"SALES\\\" (\\\"PROD_ID\\\" NUMBER 'FK to the products dimension table' , \\\"AMOUNT_SOLD\\\" NUMBER(10,2) 'invoiced amount to the customer' , \\\"QUANTITY_SOLD\\\" NUMBER(10,2) 'product quantity sold with the transaction' , \\\"PROMO_ID\\\" NUMBER 'promotion identifier, without FK constraint (intentionally) to show outer join optimization' , \\\"CHANNEL_ID\\\" NUMBER 'FK to the channels dimension table' , \\\"TIME_ID\\\" DATE 'FK to the times dimension table' , \\\"CUST_ID\\\" NUMBER 'FK to the customers dimension table')\"\n }\n ]\n },\n {\n \"role\": \"SYSTEM\",\n \"content\": [\n {\n \"type\": \"TEXT\",\n \"text\": \"--'dimension table' # CREATE TABLE \\\"SH\\\".\\\"PRODUCTS\\\" (\\\"PROD_ID\\\" NUMBER(6,0) 'primary key' , \\\"PROD_VALID\\\" VARCHAR2(1) , \\\"PROD_EFF_TO\\\" DATE , \\\"PROD_EFF_FROM\\\" DATE , \\\"PROD_SRC_ID\\\" NUMBER , \\\"PROD_TOTAL_ID\\\" NUMBER , \\\"PROD_TOTAL\\\" VARCHAR2(13) , \\\"PROD_MIN_PRICE\\\" NUMBER(8,2) 'product minimum price' , \\\"PROD_LIST_PRICE\\\" NUMBER(8,2) 'product list price' , \\\"PROD_STATUS\\\" VARCHAR2(20) 'product status' , \\\"SUPPLIER_ID\\\" NUMBER(6,0) 'this column' , \\\"PROD_PACK_SIZE\\\" VARCHAR2(30) 'product package size' , \\\"PROD_UNIT_OF_MEASURE\\\" VARCHAR2(20) 'product unit of measure' , \\\"PROD_WEIGHT_CLASS\\\" NUMBER(3,0) 'product weight class' , \\\"PROD_CATEGORY_DESC\\\" VARCHAR2(2000) 'product category description' , \\\"PROD_CATEGORY_ID\\\" NUMBER , \\\"PROD_CATEGORY\\\" VARCHAR2(50) 'product category' , \\\"PROD_SUBCATEGORY_DESC\\\" VARCHAR2(2000) 'product subcategory description' , \\\"PROD_SUBCATEGORY_ID\\\" NUMBER , \\\"PROD_SUBCATEGORY\\\" VARCHAR2(50) 'product subcategory' , \\\"PROD_DESC\\\" VARCHAR2(4000) 'product description' , \\\"PROD_NAME\\\" VARCHAR2(50) 'product name')\"\n }\n ]\n },\n {\n \"role\": \"SYSTEM\",\n \"content\": [\n {\n \"type\": \"TEXT\",\n \"text\": \"--'country dimension table (snowflake)' # CREATE TABLE \\\"SH\\\".\\\"COUNTRIES\\\" (\\\"COUNTRY_ID\\\" NUMBER 'primary key' , \\\"COUNTRY_NAME_HIST\\\" VARCHAR2(40) , \\\"COUNTRY_TOTAL_ID\\\" NUMBER , \\\"COUNTRY_TOTAL\\\" VARCHAR2(11) , \\\"COUNTRY_REGION_ID\\\" NUMBER , \\\"COUNTRY_REGION\\\" VARCHAR2(20) 'e.g. Europe, Asia' , \\\"COUNTRY_SUBREGION_ID\\\" NUMBER , \\\"COUNTRY_SUBREGION\\\" VARCHAR2(30) 'e.g. Western Europe, to allow hierarchies' , \\\"COUNTRY_NAME\\\" VARCHAR2(40) 'country name' , \\\"COUNTRY_ISO_CODE\\\" CHAR(2))\"\n }\n ]\n },\n {\n \"role\": \"USER\",\n \"content\": [\n {\n \"type\": \"TEXT\",\n \"text\": \"\\n\\nGiven an input Question, create a syntactically correct Oracle SQL query to run. Pretty print the SQL query. \\n - Pay attention to using only the column names that you can see in the schema description.\\n - Be careful to not query for columns that do not exist. Also, pay attention to which column is in which table.\\n - Please double check that the SQL query you generate is valid for Oracle Database.\\n - Consider table name, schema name and column name to be case sensitive and enclose in double quotes. - Only use the tables listed below. \\n - If the table definition includes the table owner, you should include both the owner name and user-qualified table name in the Oracle SQL. - DO NOT keep empty lines in the middle of the Oracle SQL.\\n - DO NOT write anything else except the Oracle SQL.\\n - Always use table alias and easy to read column aliases. \\n\\nFor string comparisons in WHERE clause, CAREFULLY check if any string in the question is in DOUBLE QUOTES, and follow the rules: \\n - If a string is in DOUBLE QUOTES, use case SENSITIVE comparisons with NO UPPER() function.\\n - If a string is not in DOUBLE QUOTES, use case INSENSITIVE comparisons by using UPPER() function around both operands of the string comparison.\\nNote: These rules apply strictly to string comparisons in the WHERE clause and do not affect column names, table names, or other query components.\\n\\nQuestion: how many customers do I have?\"\n }\n ]\n }\n]\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Run SQL query for \"how many are in each country\"","message":["%python","","profile.run_sql(prompt=\"how many are in each country?\")"],"enabled":true,"result":{"startTime":1760325706844,"interpreter":"python.low","endTime":1760325711200,"results":[{"message":" country_id country_name customer_count\n0 52770 Italy 7780\n1 52775 Brazil 832\n2 52782 Japan 624\n3 52789 United Kingdom 7557\n4 52776 Germany 8173\n5 52790 United States of America 18520\n6 52779 France 3833\n7 52772 Canada 2010\n8 52778 Spain 2039\n9 52771 China 712\n10 52769 Singapore 597\n11 52785 New Zealand 244\n12 52786 Poland 708\n13 52774 Australia 831\n14 52773 Argentina 403\n15 52777 Denmark 383\n16 52791 South Africa 88\n17 52787 Saudi Arabia 75\n18 52788 Turkey 91\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"View history of SQL invocations","message":["%python","","# To run this query, the user must be granted READ priviliegs on SYS.V_$MAPPED_SQL.","# Under ADMIN: grant READ on SYS.V_$MAPPED_SQL to SELECT_AI_USER;","","import oml","","df = oml.sync(query=\"\"\""," SELECT SQL_TEXT, MAPPED_SQL_TEXT, TRANSLATION_TIMESTAMP"," FROM V$MAPPED_SQL"," ORDER BY TRANSLATION_TIMESTAMP DESC\"\"\")","","print(df) "],"enabled":true,"result":{"startTime":1760325711551,"interpreter":"python.low","endTime":1760325712549,"results":[{"message":" SQL_TEXT ... TRANSLATION_TIMESTAMP\n0 DECLARE SqlDevBind1Z_1 VARCHAR2(32767):=:SqlDe... ... 2025-10-10 17:51:28\n1 SELECT AI runsql quali sono i vantaggi dell ut... ... 2025-10-10 17:51:22\n2 SELECT AI narrate quali sono i vantaggi dell u... ... 2025-10-10 17:51:15\n3 SELECT AI runsql what are the benefits of usin... ... 2025-10-10 17:51:07\n4 SELECT AI narrate what are the benefits of usi... ... 2025-10-10 17:51:03\n.. ... ... ...\n125 DECLARE v_response VARCHAR2(4000); BEGIN v... ... 2025-10-09 14:55:17\n126 SELECT AI chat How does it integrate with othe... ... 2025-10-09 14:54:52\n127 SELECT AI chat what is Oracle Autonomous Database ... 2025-10-09 14:54:28\n128 begin dbms_output.enable(120000); end; ... 2025-10-09 14:54:12\n129 declare\\r l_line varchar2(32767);\\r l_... ... 2025-10-09 14:54:11\n\n[130 rows x 3 columns]\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Run SQL query for \"add to that the number of males and females in each country\"","message":["%python","","# This uses the conversation to further refine the result from the previous invocation.","profile.run_sql(prompt = \"add the number of males and females in each country\")"],"enabled":true,"result":{"startTime":1760325712903,"interpreter":"python.low","endTime":1760325718268,"results":[{"message":" country_id country_name male_count female_count\n0 52770 Italy 5167 2613\n1 52775 Brazil 531 301\n2 52782 Japan 397 227\n3 52789 United Kingdom 5111 2446\n4 52776 Germany 5564 2609\n5 52790 United States of America 12323 6197\n6 52779 France 2614 1219\n7 52772 Canada 1371 639\n8 52778 Spain 1376 663\n9 52771 China 477 235\n10 52769 Singapore 395 202\n11 52785 New Zealand 157 87\n12 52786 Poland 476 232\n13 52774 Australia 531 300\n14 52773 Argentina 264 139\n15 52777 Denmark 257 126\n16 52791 South Africa 51 37\n17 52787 Saudi Arabia 52 23\n18 52788 Turkey 61 30\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Find the top 3 baby boomer big spenders","message":["%python","","# This uses the general knowledge of the LLM to understand what a \"baby boomer\" and \"big spenders\" are.","profile.run_sql(prompt=\"find the top 3 baby boomer big spenders\")"],"enabled":true,"result":{"startTime":1760325718638,"interpreter":"python.low","endTime":1760325723999,"results":[{"message":" first_name last_name total_spent\n0 Marvel Bakerman 145358.48\n1 Harold Allis 143700.70\n2 Ona Cattlett 122683.52\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Narrate the query result for \"find the top 3 baby boomer big spenders\"","message":["%python","","profile.narrate(prompt = \"find the top 3 baby boomer big spenders\")"],"enabled":true,"result":{"startTime":1760325724365,"interpreter":"python.low","endTime":1760325732146,"results":[{"message":"'The top 3 big spenders who were born between 1946 and 1964 are:\\n* Marvel Bakerman\\n* Harold Allis\\n* Ona Cattlett \\nThey have spent the most money among their age group.'\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Show SQL for \"find the top 3 baby boomer big spenders\"","message":["%python","","# Notice in the query: \"CUST_YEAR_OF_BIRTH BETWEEN 1946 AND 1964\"","sql = profile.show_sql(prompt = \"find the top 3 baby boomer big spenders\")","print(sql)"],"enabled":true,"result":{"startTime":1760325732623,"interpreter":"python.low","endTime":1760325738489,"results":[{"message":"SELECT \n \"c\".\"CUST_FIRST_NAME\" AS \"first_name\", \n \"c\".\"CUST_LAST_NAME\" AS \"last_name\", \n SUM(\"s\".\"AMOUNT_SOLD\") AS \"total_spent\"\nFROM \n \"SH\".\"CUSTOMERS\" \"c\"\n JOIN \"SH\".\"SALES\" \"s\" ON \"c\".\"CUST_ID\" = \"s\".\"CUST_ID\"\nWHERE \n \"c\".\"CUST_YEAR_OF_BIRTH\" BETWEEN 1946 AND 1964\nGROUP BY \n \"c\".\"CUST_FIRST_NAME\", \n \"c\".\"CUST_LAST_NAME\"\nORDER BY \n \"total_spent\" DESC\nFETCH FIRST 3 ROWS ONLY\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Explain SQL for \"find the top 3 baby boomer big spenders\"","message":["%python","","response = profile.explain_sql(prompt = \"find the top 3 baby boomer big spenders\")","print(response.replace('```sql\\n', '\\nSQL Query:\\n\\n').replace('```', '\\n'))"],"enabled":true,"result":{"startTime":1760325738842,"interpreter":"python.low","endTime":1760325752419,"results":[{"message":"\nSQL Query:\n\nSELECT \n \"c\".\"CUST_FIRST_NAME\" AS \"first_name\", \n \"c\".\"CUST_LAST_NAME\" AS \"last_name\", \n SUM(\"s\".\"AMOUNT_SOLD\") AS \"total_spent\"\nFROM \n \"SH\".\"CUSTOMERS\" \"c\"\n JOIN \"SH\".\"SALES\" \"s\" ON \"c\".\"CUST_ID\" = \"s\".\"CUST_ID\"\nWHERE \n \"c\".\"CUST_YEAR_OF_BIRTH\" BETWEEN 1946 AND 1964\nGROUP BY \n \"c\".\"CUST_FIRST_NAME\", \n \"c\".\"CUST_LAST_NAME\"\nORDER BY \n \"total_spent\" DESC\nFETCH FIRST 3 ROWS ONLY;\n\n\n\n**Explanation:**\n\nThis Oracle SQL query finds the top 3 big spenders among the baby boomer generation (born between 1946 and 1964). \n\n1. **Table Selection:** The query joins two tables: `\"SH\".\"CUSTOMERS\"` (aliased as `\"c\"`) and `\"SH\".\"SALES\"` (aliased as `\"s\"`). The join is based on the `\"CUST_ID\"` column, which is common to both tables.\n\n2. **Filtering:** The `WHERE` clause filters the results to include only customers born between 1946 and 1964, which is the typical birth year range for the baby boomer generation.\n\n3. **Grouping and Aggregation:** The `GROUP BY` clause groups the results by the customer's first and last names. The `SUM` aggregation function calculates the total amount spent by each customer.\n\n4. **Sorting and Limiting:** The `ORDER BY` clause sorts the results in descending order based on the total amount spent. The `FETCH FIRST 3 ROWS ONLY` clause limits the output to the top 3 big spenders.\n\n**Note:** The query uses table aliases (`\"c\"` and `\"s\"`) to improve readability and follows the rules for string comparisons in the `WHERE` clause. However, since there are no string comparisons in this query, the rules for case-sensitive and case-insensitive comparisons do not apply.\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","","#### Use GENERATE for dynamic action selection","","The `generate()` method handles different Select AI actions specified as an argument. Additional parameters like conversation IDs can be passed for context-aware ","conversations. ","","The examples demonstrate using generate with different actions: `showsql` to get SQL statements, `runsql` to run queries, ","`explainsql` to obtain query explanations, and `narrate` to provide a natural language interpretation of the query result."],"enabled":true,"result":{"startTime":1760325752779,"interpreter":"md.low","endTime":1760325753103,"results":[{"message":"Use GENERATE for dynamic action selection<\/h4>\n
generate()<\/code> method handles different Select AI actions specified as an argument. Additional parameters like conversation IDs can be passed for context-aware\nconversations.<\/p>\nshowsql<\/code> to get SQL statements, runsql<\/code> to run queries,\nexplainsql<\/code> to obtain query explanations, and narrate<\/code> to provide a natural language interpretation of the query result.<\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Use GENERATE with 'showsql'","message":["%python","","response = profile.generate("," prompt = \"find the top 3 baby boomer big spenders\","," action = select_ai.Action.SHOWSQL",")","print(response)"],"enabled":true,"result":{"startTime":1760325753458,"interpreter":"python.low","endTime":1760325759229,"results":[{"message":"SELECT \n \"c\".\"CUST_FIRST_NAME\" AS \"first_name\", \n \"c\".\"CUST_LAST_NAME\" AS \"last_name\", \n SUM(\"s\".\"AMOUNT_SOLD\") AS \"total_spent\"\nFROM \n \"SH\".\"CUSTOMERS\" \"c\"\n JOIN \"SH\".\"SALES\" \"s\" ON \"c\".\"CUST_ID\" = \"s\".\"CUST_ID\"\nWHERE \n \"c\".\"CUST_YEAR_OF_BIRTH\" BETWEEN 1946 AND 1964\nGROUP BY \n \"c\".\"CUST_FIRST_NAME\", \n \"c\".\"CUST_LAST_NAME\"\nORDER BY \n \"total_spent\" DESC\nFETCH FIRST 3 ROWS ONLY\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Use GENERATE with 'runsql' for the same prompt","message":["%python","","response = profile.generate("," prompt = \"find the top 3 baby boomer big spenders\","," action = select_ai.Action.RUNSQL",")","print(response)"],"enabled":true,"result":{"startTime":1760325759583,"interpreter":"python.low","endTime":1760325765349,"results":[{"message":"[\n {\n \"first_name\" : \"Marvel\",\n \"last_name\" : \"Bakerman\",\n \"total_spent\" : 145358.48\n },\n {\n \"first_name\" : \"Harold\",\n \"last_name\" : \"Allis\",\n \"total_spent\" : 143700.7\n },\n {\n \"first_name\" : \"Ona\",\n \"last_name\" : \"Cattlett\",\n \"total_spent\" : 122683.52\n }\n]\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Use GENERATE with 'explainsql' for the same prompt","message":["%python","","response = profile.generate("," prompt = \"find the top 3 baby boomer big spenders\","," action = select_ai.Action.EXPLAINSQL",")","print(response)"],"enabled":true,"result":{"startTime":1760325765706,"interpreter":"python.low","endTime":1760325781684,"results":[{"message":"```sql\nSELECT \n \"c\".\"CUST_FIRST_NAME\" AS \"first_name\", \n \"c\".\"CUST_LAST_NAME\" AS \"last_name\", \n SUM(\"s\".\"AMOUNT_SOLD\") AS \"total_spent\"\nFROM \n \"SH\".\"CUSTOMERS\" \"c\"\n JOIN \"SH\".\"SALES\" \"s\" ON \"c\".\"CUST_ID\" = \"s\".\"CUST_ID\"\nWHERE \n \"c\".\"CUST_YEAR_OF_BIRTH\" BETWEEN 1946 AND 1964\nGROUP BY \n \"c\".\"CUST_FIRST_NAME\", \n \"c\".\"CUST_LAST_NAME\"\nORDER BY \n \"total_spent\" DESC\nFETCH FIRST 3 ROWS ONLY;\n```\n\n**Detailed Explanation:**\n\nThis Oracle SQL query finds the top 3 big spenders among the baby boomer generation (born between 1946 and 1964).\n\n1. **Table Selection:** The query joins two tables: `\"SH\".\"CUSTOMERS\"` (aliased as `\"c\"`) and `\"SH\".\"SALES\"` (aliased as `\"s\"`). The join is based on the `\"CUST_ID\"` column, which is common to both tables.\n\n2. **Filtering:** The `WHERE` clause filters the results to include only customers born between 1946 and 1964, which is the typical birth year range for the baby boomer generation. Since the birth year is a numeric value, no string comparison rules apply here.\n\n3. **Grouping and Aggregation:** The `GROUP BY` clause groups the results by the customer's first and last names. The `SUM` aggregation function calculates the total amount spent by each customer.\n\n4. **Sorting and Limiting:** The `ORDER BY` clause sorts the results in descending order based on the total amount spent. The `FETCH FIRST 3 ROWS ONLY` clause limits the output to the top 3 big spenders.\n\n**Note:** The query uses table aliases (`\"c\"` and `\"s\"`) to improve readability and follows the rules for case-sensitive and case-insensitive comparisons in the `WHERE` clause. However, since there are no string comparisons in this query, the rules for case-sensitive and case-insensitive comparisons do not apply. The column names, table names, and schema names are enclosed in double quotes to ensure case sensitivity.\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"raw","title":"Use GENERATE with 'narrate' for the same prompt","message":["%python","","response = profile.generate("," prompt = \"find the top 3 baby boomer big spenders\","," action = select_ai.Action.NARRATE",")","print(response)"],"enabled":true,"result":{"startTime":1760325782030,"interpreter":"python.low","endTime":1760325790186,"results":[{"message":"The top 3 big spenders among the baby boomer generation are:\n* Marvel Bakerman\n* Harold Allis\n* Ona Cattlett \nThey have spent the most money among their age group.\n","type":"TEXT"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":false,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":true,"hideVizConfig":false,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","# End of Script"],"enabled":true,"result":{"startTime":1760325790535,"interpreter":"md.low","endTime":1760325790866,"results":[{"message":"End of Script<\/h1>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"}],"version":"7","snapshot":false,"tags":null}]
\ No newline at end of file
diff --git a/select-ai/python/SelectAI4Py -3- Retrieval Augmented Generation (RAG).dsnb b/select-ai/python/SelectAI4Py -3- Retrieval Augmented Generation (RAG).dsnb
new file mode 100644
index 0000000..c943f3b
--- /dev/null
+++ b/select-ai/python/SelectAI4Py -3- Retrieval Augmented Generation (RAG).dsnb
@@ -0,0 +1 @@
+[{"layout":"jupyter","isRunnable":true,"template":null,"templateConfig":null,"isEditable":true,"name":"SelectAI4Py -3- Retrieval Augmented Generation (RAG)","description":null,"type":"low","paragraphs":[{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":null,"title":null,"message":[],"enabled":true,"result":{"startTime":1760326824283,"interpreter":"md.low","endTime":1760326824740,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":0,"hideResult":true,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","# Select AI with Retrieval Augmented Generation (RAG)","","Select AI supports retreival augmented generation (RAG) to enhance LLM responses by augmenting the user prompt with your specific content retrieved using semantic similarity search. ","RAG is supported in Oracle Autonomous Database 23ai and uses the AI Vector Search feature. ","RAG enables more accurate and contextually relevant responses while reducing hallucinations. RAG bridges the gap between the general ","knowledge of the LLM and your proprietary information, without LLM fine-tuning. ","","Select AI RAG can also provide document sources and text chunk offsets within those documents that contribute to responses. The document sources enhances explainability. ","You can also view the specific text chunks that are provided to the LLM for a given prompt. ","","Select AI RAG provides the following capabilities:","","* Create and populate an Autonomous Database 23ai vector store and vector index based on content in object storage ","* Periodically update the vector index based on content in object storage with a frequency you set","* Augment prompts with content retrieved using semantic similarity search","* Send the augmented prompt to your specified LLM and return generated results with optional sources","* View the specific text chunks that are provided to the LLM for a given prompt","","Select AI RAG simplifies and automates retrieval augmentation generation.","","---","","Copyright (c) 2025 Oracle Corporation ","###### [The Universal Permissive License (UPL), Version 1.0](https://oss.oracle.com/licenses/upl/)"],"enabled":true,"result":{"startTime":1760326825129,"interpreter":"md.low","endTime":1760326825498,"results":[{"message":"
Select AI with Retrieval Augmented Generation (RAG)<\/h1>\n
\n
\nThe Universal Permissive License (UPL), Version 1.0<\/a><\/h6>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### For more information...","","Select AI for Python documentation<\/a>"],"enabled":true,"result":{"startTime":1760326825882,"interpreter":"md.low","endTime":1760326826231,"results":[{"message":"
For more information...<\/h3>\n
Prerequisites<\/h3>\n
ADMIN:<\/h6>\n
\n
Select AI user:<\/h6>\n
\n
Use Select AI to create a vector index on OML blogs<\/h3>\n
MY_VECTOR_INDEX2<\/code> that will store vector embeddings, which are semantic representations of your content from object storage.<\/p>\n\n
chunk_size<\/code> and chunk_overlap<\/code> parameters)<\/li>\n\n
Understanding chunk size and chunk overlap<\/h3>\n
\n
\n
Track and view document processing status for vector indexing<\/h3>\n
Vector index inspection<\/h3>\n
Create a profile proxy object for the current session<\/h3>\n
Query data using Select AI RAG<\/h3>\n
Use GENERATE for dynamic action selection<\/h4>\n
generate()<\/code> method handles different Select AI actions specified as an argument. Additional parameters like conversation IDs can be passed for context-aware\nconversations.<\/p>\n
","Multilingual Support for Semantic Similarity Search<\/a>"],"enabled":true,"result":{"startTime":1760326877234,"interpreter":"md.low","endTime":1760326877568,"results":[{"message":"Using an in-database transformer<\/h3>\n
profile.set_attribute()<\/code> method's embedding_model<\/code> parameter allows you to specify your desired text embedding model. Oracle provides several pre-built ONNX transformer models that have been augmented through a specialized pipeline:<\/p>\n\n
ALL_MINILM_L12_V2<\/code> - Optimized for English language content with faster processing and compact 384-dimensional embeddings<\/li>\nMULTILINGUAL_E5_SMALL<\/code> - Supports over 100 languages with 384-dimensional embeddings, ideal for multilingual applications<\/li>\n<\/ul>\n\n
CLIP_VIT_BASE_PATCH32_IMG<\/code> - CLIP model for image embeddings (512 dimensions)<\/li>\nCLIP_VIT_BASE_PATCH32_TXT<\/code> - CLIP model for text embeddings (512 dimensions)<\/li>\n<\/ul>\nprofile.set_attribute()<\/code>, as demonstrated below. In this example, we use the MULTILINGUAL_E5_SMALL<\/code> model to leverage its multilingual capabilities. The same embedding model must be used consistently when creating the vector index and vectorizing the user prompt.<\/p>\n\n
\nMultilingual Support for Semantic Similarity Search<\/a><\/p>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### Create a vector index using the in-database transformer","","Having configured our AI profile `IN_DB_TRANSFORMER_RAG_DEMO` to use the `MULTILINGUAL_E5_SMALL` embedding model, we'll create a new vector index (`MY_VECTOR_INDEX2`). ","A new index is required because each embedding model creates unique vector representations. ","","This new vector index will use the same source data and chunking parameters as before, but will generate embeddings using the in-database transformer model."],"enabled":true,"result":{"startTime":1760326877952,"interpreter":"md.low","endTime":1760326878327,"results":[{"message":"Create a vector index using the in-database transformer<\/h3>\n
IN_DB_TRANSFORMER_RAG_DEMO<\/code> to use the MULTILINGUAL_E5_SMALL<\/code> embedding model, we'll create a new vector index (MY_VECTOR_INDEX2<\/code>).\nA new index is required because each embedding model creates unique vector representations.<\/p>\nUse GENERATE for dynamic action selection<\/h4>\n
generate()<\/code> method handles different Select AI actions specified as an argument. Additional parameters like conversation IDs can be passed for context-aware\nconversations.<\/p>\nEnd of Script<\/h3>\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":12,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"}],"version":"7","snapshot":false,"tags":null}]
\ No newline at end of file
diff --git a/select-ai/python/SelectAI4Py -4- Synthetic Data Generation (SGD).dsnb b/select-ai/python/SelectAI4Py -4- Synthetic Data Generation (SGD).dsnb
new file mode 100644
index 0000000..ebdeee7
--- /dev/null
+++ b/select-ai/python/SelectAI4Py -4- Synthetic Data Generation (SGD).dsnb
@@ -0,0 +1 @@
+[{"layout":"jupyter","isRunnable":true,"template":null,"templateConfig":null,"isEditable":true,"name":"SelectAI4Py -4- Synthetic Data Generation (SGD)","description":null,"type":"low","paragraphs":[{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":null,"title":null,"message":[],"enabled":true,"result":{"startTime":1760328768936,"interpreter":"md.low","endTime":1760328769385,"results":[],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":0,"hideResult":true,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","# Generating Synthetic Data using Select AI","","Select AI Synthetic Data Generation (SDG) enables using the LLM to generate data to populate database tables. ","This can be helpful when real or production data is unavailable, limited, or contains sensitive information that has restricted access. ","","Select AI provides metadata to the LLM and, if requested, example rows from each table, to help the LLM produce rows that meet the table definition and referential integrity constraints. ","","This notebook demonstrates using Select AI's `profile.generate_synthetic_data()` method for creating test data that fits your database schema. ","","Key benefits include:","* Populating database tables with sample data to avoid exposing sensitive data","* Starting new projects with \"realistic\" examples","* Validating user interfaces early in a project where actual data is unavailable","","SDG enables you to develop, test, and demonstrate solutions effectively while maintaining data privacy and security.","","Copyright (c) 2025 Oracle Corporation ","###### The Universal Permissive License (UPL), Version 1.0<\/a>","---"],"enabled":true,"result":{"startTime":1760328769758,"interpreter":"md.low","endTime":1760328770123,"results":[{"message":"
Generating Synthetic Data using Select AI<\/h1>\n
profile.generate_synthetic_data()<\/code> method for creating test data that fits your database schema.<\/p>\n\n
The Universal Permissive License (UPL), Version 1.0<\/a><\/h6>\n
\n","type":"HTML"}],"taskStatus":"SUCCESS","forms":"[]","status":"SUCCESS"},"sizeX":0,"hideCode":true,"width":0,"hideResult":false,"dynamicFormParams":"{}","row":0,"hasTitle":false,"hideVizConfig":true,"hideGutter":true,"relations":[],"forms":"[]"},{"col":0,"visualizationConfig":null,"hideInIFrame":false,"selectedVisualization":"html","title":null,"message":["%md","### For more information...","","Select AI for Python documentation<\/a>"],"enabled":true,"result":{"startTime":1760328770474,"interpreter":"md.low","endTime":1760328770829,"results":[{"message":"For more information...<\/h3>\n