{"id":3322,"date":"2024-03-23T09:26:00","date_gmt":"2024-03-23T09:26:00","guid":{"rendered":"https:\/\/www.bohort.nl\/?p=3322"},"modified":"2024-08-06T10:22:45","modified_gmt":"2024-08-06T10:22:45","slug":"introducing-oracle-select-ai","status":"publish","type":"post","link":"https:\/\/www.bohort.nl\/en\/2024\/03\/23\/introducing-oracle-select-ai\/","title":{"rendered":"Introducing Oracle Select AI"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Last week a presented on APEX World24 where I introduced Oracle Select AI to the audience. The first part of the session was all about what is Select AI, how to you set it up, and how to use it. In this blogpost I will share my findings on how Select AI works and how you can set it up on readily prepared data from Oracle, so you can start playing around. Using Oracle Select AI\u2019s NLP feature, a marketing manager can generate insights using simple language:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\"Show me the top 10 products by sales in the last quarter.\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Oracle Select AI translates this request into an SQL query, executes it, and presents the results in an easy-to-understand format. In order to understand this, please have a look at the image below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"960\" height=\"239\" src=\"https:\/\/www.bohort.nl\/wp-content\/uploads\/2024\/05\/image.png\" alt=\"\" class=\"wp-image-3323\" srcset=\"https:\/\/www.bohort.nl\/wp-content\/uploads\/2024\/05\/image.png 960w, https:\/\/www.bohort.nl\/wp-content\/uploads\/2024\/05\/image-300x75.png 300w, https:\/\/www.bohort.nl\/wp-content\/uploads\/2024\/05\/image-768x191.png 768w, https:\/\/www.bohort.nl\/wp-content\/uploads\/2024\/05\/image-18x4.png 18w\" sizes=\"(max-width: 960px) 100vw, 960px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Setup Oracle select ai<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">It is very easy to setup Oracle Select AI in you database. There are just a few steps involved. Let me explain them. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Oracle Autonomous Database uses a large language model (LLM) to translate natural language to SQL. You can choose the LLM to use for your application. I choose to use my OpenAI account. If you do not have any, you can sign up for one. In either case, you would need a to&nbsp;create a new API secret key. The secret key is used to sign requests to OpenAI&#8217;s API. You will need it when creating a credential later. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first thing you need to do is grant the&nbsp;<strong>moviestream<\/strong>&nbsp;user permissions to make REST calls to&nbsp;<strong>api.open.com<\/strong>. This is done by adding the user to the network Access Control List (ACL). For more details, see the&nbsp;<a href=\"https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/19\/arpls\/DBMS_NETWORK_ACL_ADMIN.html\">DBMS_NETWORK_ACL_ADMIN&nbsp;PL\/SQL Package<\/a>&nbsp;documentation.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"BEGIN\nDBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE (\n  HOST         =&gt; 'api.openai.com',\n  LOWER_PORT   =&gt; 443,\n  UPPER_PORT   =&gt; 443,\n  ACE          =&gt; xs$ace_type(\n      PRIVILEGE_LIST =&gt; xs$name_list('http'),\n      PRINCIPAL_NAME =&gt; 'MOVIESTREAM',\n      PRINCIPAL_TYPE =&gt; xs_acl.ptype_db));\nEND;\n\/\" style=\"color:#D4D4D4;display:none\" aria-label=\"Kopieer\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #4FC1FF\">BEGIN<\/span><\/span>\n<span class=\"line\"><span style=\"color: #4FC1FF\">DBMS_NETWORK_ACL_ADMIN<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">APPEND_HOST_ACE<\/span><span style=\"color: #D4D4D4\"> (<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #9CDCFE\">HOST<\/span><span style=\"color: #D4D4D4\">         <\/span><span style=\"color: #569CD6\">=&gt;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;api.openai.com&#39;<\/span><span style=\"color: #D4D4D4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #9CDCFE\">LOWER_PORT<\/span><span style=\"color: #D4D4D4\">   <\/span><span style=\"color: #569CD6\">=&gt;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #B5CEA8\">443<\/span><span style=\"color: #D4D4D4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #9CDCFE\">UPPER_PORT<\/span><span style=\"color: #D4D4D4\">   <\/span><span style=\"color: #569CD6\">=&gt;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #B5CEA8\">443<\/span><span style=\"color: #D4D4D4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #9CDCFE\">ACE<\/span><span style=\"color: #D4D4D4\">          <\/span><span style=\"color: #569CD6\">=&gt;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">xs$ace_type<\/span><span style=\"color: #D4D4D4\">(<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">      <\/span><span style=\"color: #9CDCFE\">PRIVILEGE_LIST<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">=&gt;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">xs$name_list<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&#39;http&#39;<\/span><span style=\"color: #D4D4D4\">),<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">      <\/span><span style=\"color: #9CDCFE\">PRINCIPAL_NAME<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">=&gt;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;MOVIESTREAM&#39;<\/span><span style=\"color: #D4D4D4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">      <\/span><span style=\"color: #9CDCFE\">PRINCIPAL_TYPE<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">=&gt;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">xs_acl<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">ptype_db<\/span><span style=\"color: #D4D4D4\">));<\/span><\/span>\n<span class=\"line\"><span style=\"color: #4FC1FF\">END<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\/<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Next grant the&nbsp;<code>EXECUTE<\/code>&nbsp;privilege on the&nbsp;<code>DBMS_CLOUD_AI<\/code>&nbsp;package to the user who wants to use Select AI.By default, only ADMIN user is granted the&nbsp;<code>EXECUTE<\/code>&nbsp;privilege. The ADMIN user can grant&nbsp;<code>EXECUTE<\/code>&nbsp;privilege to other users.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"GRANT EXECUTE ON DBMS_CLOUD_AI TO &lt;USER&gt;;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Kopieer\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #4FC1FF\">GRANT<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4FC1FF\">EXECUTE<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4FC1FF\">ON<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4FC1FF\">DBMS_CLOUD_AI<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4FC1FF\">TO<\/span><span style=\"color: #D4D4D4\"> &lt;<\/span><span style=\"color: #4FC1FF\">USER<\/span><span style=\"color: #D4D4D4\">&gt;;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Then create a credential to enable access to your AI provider<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"BEGIN\n  DBMS_CLOUD.DROP_CREDENTIAL (\n   credential_name  =&gt; 'OPENAI_CRED');\n\n  DBMS_CLOUD.CREATE_CREDENTIAL(\n    credential_name =&gt; 'OPENAI_CRED',\n    username =&gt; 'OPENAI',\n    password =&gt; 'enter-your-LLM-secret-key-here' );\nEND;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Kopieer\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #4FC1FF\">BEGIN<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #4FC1FF\">DBMS_CLOUD<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">DROP_CREDENTIAL<\/span><span style=\"color: #D4D4D4\"> (<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">   <\/span><span style=\"color: #9CDCFE\">credential_name<\/span><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #569CD6\">=&gt;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;OPENAI_CRED&#39;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #4FC1FF\">DBMS_CLOUD<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">CREATE_CREDENTIAL<\/span><span style=\"color: #D4D4D4\">(<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #9CDCFE\">credential_name<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">=&gt;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;OPENAI_CRED&#39;<\/span><span style=\"color: #D4D4D4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #9CDCFE\">username<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">=&gt;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;OPENAI&#39;<\/span><span style=\"color: #D4D4D4\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #9CDCFE\">password<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">=&gt;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;enter-your-LLM-secret-key-here&#39;<\/span><span style=\"color: #D4D4D4\"> );<\/span><\/span>\n<span class=\"line\"><span style=\"color: #4FC1FF\">END<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Finally you DBMS_CLOUD_AI.CREATE_PROFILE to create an AI profile. The following example with the OpenAI provider creates an AI profile called openai_gpt35. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"BEGIN \nDBMS_CLOUD_AI.CREATE_PROFILE( \n   profile_name =&gt; 'openai_gpt35\u2019, \n   attributes =&gt; '{&quot;provider&quot;: &quot;openai\u201d, \n                 &quot;credential_name&quot;: &quot;OPENAI_CRED&quot;, \n                 &quot;object_list&quot;: \n                [{&quot;owner&quot;: &quot;MOVIESTREAM&quot;, &quot;name&quot;: &quot;movies&quot;}, \n                 \u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\n                 {&quot;owner&quot;: &quot;MOVIESTREAM&quot;, &quot;name&quot;: &quot;pizza_shop&quot;},\n                 {&quot;owner&quot;: \u201d&lt;OWNER-NAME&gt;&quot;, &quot;name&quot;: \u201d&lt;OBJECT-NAME&quot;},\n                 {&quot;owner&quot;: &quot;] }\u2019 \n); \nEND; \n\/\" style=\"color:#D4D4D4;display:none\" aria-label=\"Kopieer\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #4FC1FF\">BEGIN<\/span><span style=\"color: #D4D4D4\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #4FC1FF\">DBMS_CLOUD_AI<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">CREATE_PROFILE<\/span><span style=\"color: #D4D4D4\">( <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">   <\/span><span style=\"color: #9CDCFE\">profile_name<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">=&gt;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;openai_gpt35\u2019,<\/span><span style=\"color: #F44747\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">   <\/span><span style=\"color: #9CDCFE\">attributes<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">=&gt;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;{&quot;provider&quot;: &quot;openai\u201d,<\/span><span style=\"color: #F44747\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                 <\/span><span style=\"color: #CE9178\">&quot;credential_name&quot;<\/span><span style=\"color: #D4D4D4\">: <\/span><span style=\"color: #CE9178\">&quot;OPENAI_CRED&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                 <\/span><span style=\"color: #CE9178\">&quot;object_list&quot;<\/span><span style=\"color: #D4D4D4\">: <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                [{<\/span><span style=\"color: #CE9178\">&quot;owner&quot;<\/span><span style=\"color: #9CDCFE\">:<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;MOVIESTREAM&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;name&quot;<\/span><span style=\"color: #9CDCFE\">:<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;movies&quot;<\/span><span style=\"color: #D4D4D4\">}, <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                 \u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                 {<\/span><span style=\"color: #CE9178\">&quot;owner&quot;<\/span><span style=\"color: #9CDCFE\">:<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;MOVIESTREAM&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;name&quot;<\/span><span style=\"color: #9CDCFE\">:<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;pizza_shop&quot;<\/span><span style=\"color: #D4D4D4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                 {<\/span><span style=\"color: #CE9178\">&quot;owner&quot;<\/span><span style=\"color: #9CDCFE\">:<\/span><span style=\"color: #D4D4D4\"> \u201d&lt;<\/span><span style=\"color: #4FC1FF\">OWNER<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #4FC1FF\">NAME<\/span><span style=\"color: #D4D4D4\">&gt;<\/span><span style=\"color: #CE9178\">&quot;, &quot;<\/span><span style=\"color: #9CDCFE\">name<\/span><span style=\"color: #CE9178\">&quot;: \u201d&lt;OBJECT-NAME&quot;<\/span><span style=\"color: #D4D4D4\">},<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                 {<\/span><span style=\"color: #CE9178\">&quot;owner&quot;<\/span><span style=\"color: #9CDCFE\">:<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;] }\u2019<\/span><span style=\"color: #F44747\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">); <\/span><\/span>\n<span class=\"line\"><span style=\"color: #4FC1FF\">END<\/span><span style=\"color: #D4D4D4\">; <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\/<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">As you can have multiple&nbsp;<strong>Select AI<\/strong>&nbsp;profiles. You need to pick the one to use for your session. Use the&nbsp;<strong>DBMS_CLOUD_AI.SET_PROFILE<\/strong>&nbsp;procedure to specify which profile to use as follows:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"BEGIN\n    DBMS_CLOUD_AI.SET_PROFILE(profile_name =&gt; 'openai_gpt35');\nEND;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Kopieer\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #4FC1FF\">BEGIN<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #4FC1FF\">DBMS_CLOUD_AI<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">SET_PROFILE<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">profile_name<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">=&gt;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;openai_gpt35&#39;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #4FC1FF\">END<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">You can use the AI keyword in a query with Oracle clients such as SQL Developer. Use AI as the keyword in a SELECT statement for interacting with the database using natural language prompts. The AI keyword in a SELECT statement instructs the SQL execution engine to use the LLM identified in the active AI profile to process natural language and to generate SQL.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Note that you can use several different keywords with Select AI:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>1.<strong>chat<\/strong>: Use for general AI chat.<\/li>\n\n\n\n<li>2.<strong>runsql<\/strong>&nbsp;[default]: Use to ask a question and get a structured result.<\/li>\n\n\n\n<li>3.<strong>narrate<\/strong>: Use to ask a question and get a conversational result.<\/li>\n\n\n\n<li>4.<strong>showsql<\/strong>: Use to show the SQL code that was used to produce the result.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The image below show the use of showsql<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"889\" data-src=\"https:\/\/www.bohort.nl\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-at-11.48.57-1024x889.png\" alt=\"\" class=\"wp-image-3324 lazyload\" data-srcset=\"https:\/\/www.bohort.nl\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-at-11.48.57-1024x889.png 1024w, https:\/\/www.bohort.nl\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-at-11.48.57-300x261.png 300w, https:\/\/www.bohort.nl\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-at-11.48.57-768x667.png 768w, https:\/\/www.bohort.nl\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-at-11.48.57-14x12.png 14w, https:\/\/www.bohort.nl\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-23-at-11.48.57.png 1416w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/889;\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Select AI opens up the database to users without any SQL knowledge. They can now just chat with the database as if it was a real person. If this was too fast, you can go to this Oracle live lab and implement all of this for yourself: <a href=\"https:\/\/apexapps.oracle.com\/pls\/apex\/r\/dbpm\/livelabs\/run-workshop?p210_wid=3831\">https:\/\/apexapps.oracle.com\/pls\/apex\/r\/dbpm\/livelabs\/run-workshop?p210_wid=3831<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week a presented on APEX World24 where I introduced Oracle Select AI to the audience. The first part of the session was all about what is Select AI, how&#8230;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kadence_starter_templates_imported_post":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[91,73],"tags":[4,5,92],"class_list":["post-3322","post","type-post","status-publish","format-standard","hentry","category-ai","category-apex-world","tag-bohort","tag-luc-bors","tag-select-ai"],"_links":{"self":[{"href":"https:\/\/www.bohort.nl\/en\/wp-json\/wp\/v2\/posts\/3322","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bohort.nl\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bohort.nl\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bohort.nl\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bohort.nl\/en\/wp-json\/wp\/v2\/comments?post=3322"}],"version-history":[{"count":3,"href":"https:\/\/www.bohort.nl\/en\/wp-json\/wp\/v2\/posts\/3322\/revisions"}],"predecessor-version":[{"id":3351,"href":"https:\/\/www.bohort.nl\/en\/wp-json\/wp\/v2\/posts\/3322\/revisions\/3351"}],"wp:attachment":[{"href":"https:\/\/www.bohort.nl\/en\/wp-json\/wp\/v2\/media?parent=3322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bohort.nl\/en\/wp-json\/wp\/v2\/categories?post=3322"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bohort.nl\/en\/wp-json\/wp\/v2\/tags?post=3322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}