Autonomous Database : Use Select AI to Generate SQL from Natural Language Prompts using Cohere
Autonomous Database now has a SELECT AI feature that generates SQL from natural language, enabling you to query your data using natural language.
As of September 2023, OpenAI and Cohere are available as AI providers for the SELECT AI function. Cohere was used as the AI provider for this post.
As a prerequisite create an account with AI providers like, OpenAI and Cohere and create an API Key. For Cohere, create an API Key from the API Key page under Cohere Dashboard after logging into your Cohere account.
Here are the steps for the "MAGIC" to work -
Grant execution privileges for the DBMS_CLOUD_AI package required to use the SELECT AI function to ADB_USER.
Allow ADB_USER HTTP access to Cohere's API host api.cohere.ai
Create a profile that describes your LLM provider and the metadata (schemas, tables, views, etc.) that can be used for natural language queries. Use DBMS_CLOUD_AI.CREATE_PROFILE to create a profile by passing the following -
领英推荐
Set an AI profile using the DBMS_CLOUD_AI.SET_PROFILE procedure to be used in the current session.
Let's use SELECT AI to perform a natural language query.
Check the SQL generated by SELECT AI SHOWSQL.
Documentation : Using Select AI with Autonomous Database
Blog Posts : Autonomous Database speaks “human”
Manager @Navisite - Part of Accenture | EBS Managed Services | Ex-Racker| Ex-Oracle
1 年Truly wonderful. You will do wonders for sure.. Keep going!! Keep Inspiring!!
Software Architect, Engineering Manager @ Oracle Autonomous Database
1 年Great feature and Very well written post
Senior Manager, Software Engineering | Ex-MSFT | Ex-Oracle | Microsoft Fabric, Azure, Analytics, Solutions Architect | Oracle Exadata | Azure Synapse | Data Architect
1 年Good Read