5.8 Create and use an Oracle Cloud Infrastructure Generative AI Connection

Oracle Cloud Infrastructure (OCI) Generative AI enables organizations to automate text summarization and dynamic content generation. Data Transforms integrates with OCI Generative AI to support the use of embedding vectors in a data flow.

Before you create an OCI Generative AI connection you create an Oracle Database 23ai connection. Data Transforms will use this connection to test the OCI Generative AI connection. To create the OCI Generative AI connection you need to specify details such as the OCI URL, User OCID, Tenancy OCID, Compartment OCID, Private Key, and Fingerprint information.
See Use Text Embedding Vector in a Data Flow for information on how you will use this connection to add vector embedding in a data flow.

To define Oracle Cloud Infrastructure Generative AI Connection:

  1. From the left pane of the Home page, click the Connections tab.

    Connections page appears.

  2. Click Create Connection.

    Create Connection page slides in.

  3. For Select Type,
    • In the Name field, enter the name of the newly created connection.
    • Select Services as the type of connection.
  4. Select OCI Generative AI, and Next.
  5. For Connection Details, provide the following details:
    • OCI URL - The endpoint URL of the OCI Generative AI service.
    • User OCID - The user OCID from the Oracle Cloud Infrastructure Console.
    • Tenancy OCID - The tenancy OCID from the Oracle Cloud Infrastructure Console.
    • Compartment OCID - The compartment OCID from the Oracle Cloud Infrastructure Console.
    • Private Key - The private key in the PEM format. Specify the path to your downloaded private key file.
    • Fingerprint - The fingerprint of the key that was just added.
  6. After proving all the required connection details, click Create.

    The new connection is created.

  7. Click Test Connection, to test the established connection.

    A pop-up appears listing the Oracle Database 23ai connections that you have configured. Select the option you want to use to test this connection.

    Note:

    If test connection fails see Troubleshooting OCI Generative AI connection issues for instructions to fix the issue.

The newly created connection is displayed in the Connections page.

Troubleshooting OCI Generative AI connection issues

If Test Connection fails for an OCI Generative AI connection, do the following to troubleshoot the issue:

  1. Make sure that you have entered all the connection information correctly. For example,
    • OCI URL sample: https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/20231130/actions/embedText
    • Private Key sample: MIIEvg......beE/
  2. When you click Test Connection, you will be asked to choose an Oracle Connection. Make sure that it is an Oracle 23ai connection.
  3. Log into that Oracle 23ai database as admin and run the following query to make sure the statuses are valid:
    SELECT object_name, object_type, status
    FROM dba_objects
    WHERE object_name = 'DBMS_VECTOR_CHAIN' AND owner = 'CTXSYS';
  4. Check whether the following plsql block works in your database. Data Transforms uses the plsql block to run the Test Connection.
    exec dbms_vector_chain.drop_credential('OCI_CRED');
    declare
      jo json_object_t;
    begin
      -- create an OCI credential
      jo := json_object_t();
      jo.put('user_ocid', '<your user ocid>');
      jo.put('tenancy_ocid', '<your tenancy ocid');
      jo.put('compartment_ocid', '<your compartment ocid');
      jo.put('private_key', '<your private key');
      jo.put('fingerprint', '<your fingerprint>');
      dbms_output.put_line(jo.to_string);
      dbms_vector_chain.create_credential(
        credential_name => 'OCI_CRED',
        params => json(jo.to_string));
    end; 
    select dbms_vector_chain.utl_to_embedding('hello', JSON('{"provider": "ocigenai","credential_name" : "OCI_CRED", "url": "https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/20231130/actions/embedText","model": "cohere.embed-english-light-v2.0"}')) from dual;
    If you get an HTTP request failed error when running the plsql block query, try to grant network access to your user:
    BEGIN
        DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
            host => '*',
            ace => xs$ace_type(privilege_list => xs$name_list('connect'),
                               principal_name => '<your username>',
                               principal_type => xs_acl.ptype_db));
    END;