Showing posts with label Gen AI. Show all posts
Showing posts with label Gen AI. Show all posts

Wednesday, April 29, 2026

#1144 - OIC Agents powered by OCI GenAI

 Introduction

This is a new feature, available with the 26.04 release, the ability to use one of the models, available with OCI GenAI, as your LLM.

I will go through the setup, step by step.
Let's begin by checking our OIC instance has access to OCI GenAI. I do this by creating a simple integration that uses the OCI GenAI native action.

Validate OIC has access to OCI Gen AI 


Mapping is as follows -

Type = 'TEXT'
Text = request field 'prompt'
Role = 'USER'

I run the integration with prompt set to - who was cathal brugha -

The only extra prep required was to create a policy allowing my OIC instance to use the GenAI family in the relevant compartment (the one in which OIC is running).

Here's an example of such -
Allow dynamic-group yourDynamicGroup to manage 
generative-ai-family in compartment yourCompartment

 
The dynamic group will have entries such as - 
resource.id = 'yourOIC Instance ClientID'

The client id can be found in the entry for your OIC instance, created under Oracle Cloud Services -

You can filter by 'Integration', if you have a lot of entries - 

Once you find your instance, click on OAuth configuration - 

Scroll down and you will see the Client Id - 

Copy this, including the _APPID suffix.




Check out the models available to you

Please check the following page, when using OCI GenAI as the LLM provider for your OIC Agent -

My OIC instance is in Phoenix, so I see the relevant GenAI region is Chicago (ORD).

Now you can open your OCI console and navigate to GenAI -

Ensure you are in the correct region, in my case, Chicago, then click on Chat. Select your compartment where OIC is located -

Here is the list of models available to you.

As I'm in the us-chicago-1 region, I see some models from Cohere, Meta, OpenAI, Google Gemini and grok. Google Gemini is not hosted in the Oracle Datacenter, so I'll not choose it. I go for openai.gpt-oss-120b.

I ask the usual - who was Cathal Brugha question - 

Which models are actually hosted on OCI? 

Data residency is often a reason for choosing to use OCI Gen AI models. However, as just mentioned, the Google Gemini models are not hosted on OCI. Check out this page for more information - 

I check out the Google Gemini models - 
Ergo, if you use any of these models, your data is being passed to GCP, i.e. it's leaving your OCI region.

Another point to note - the US regions leverage Chicago, another region in the US. In Europe it's a bit different - EU data centers use Frankfurt. The UK uses LHR (uk-london-1).

Data Privacy 

You can check out the data handling in GenAI here - 


Net, net - no data is stored or shared, if you use models hosted on OCI.

Back to our case at hand, let's use the xai.grok-4 model

OIC Agents using GenAI LLMs

I'm back in my order processing demo project; here I'll create a new Agent Pattern - 

Note the pre-seeded settings - 

There is a input field on the right, this is for the model type; here I enter openai.gpt-oss-120b.


Some other artifacts have also been created. One is the integrations that orchestrates agent actions - 

You can treat this as a blackbox, but it's good to know why it is there.

A new lookup has also been created - 

This you need to configure - 

I enter my compartment id and destination region, in my case, ORD,  (us-chicago-1)

These values are used by the aforementioned integration, when invoking the LLM.

The final artifact created is the following Library - 

This, too, is invoked by the auto-generated integration'


Now to the Agent - 

This agent is a clone of the one I already described in previous posts, so I will not go into the gory details again.

I run the new agent - 


Summa Summarum

There are multiple reasons for using the OCI GenAI based LLM. They include - 
  • common billing - costs come out of the same universal credits pot as OIC
  • data privacy
  • ease of use
Do try it out!












 

 

Wednesday, October 15, 2025

#1090 - OIC Native Actions for AI

Introduction

These are the native actions, available in the palette. I covered invoking OCI Gen AI in a previous post. This was based on the REST adapter. Let us look at doing the same with the native action -

I've dropped the OCI Generative AI action into my integration. It is configured as follows -

The map is configured as follows - 

Serving Type = ON_DEMAND
Role = USER

Type = TEXT
Text is set to the request field request.

Let's run the integration - 

Simple stuff!

This native action gives us access to Gen AI in a specific region. I chose Chicago, let's look at what Gen AI offers there - 

Note the availability of grok, which does not currently appear in the models supported by the native action - 

Ergo, use the REST adapter route, if you want to use grok today. 

Summa Summarum

These native actions make it so easy for you to leverage OCI AI services. All you need is the appropriate use cases to kickstart your AI journey with OIC.




Monday, May 19, 2025

#1069 OIC invoking OCI GenAI Agents - the basics

Introduction

Welcome to this simple example of invoking an OCI Gen AI Agent from OIC. This post will introduce GenAI Agents and how to leverage them from your integrations.

According to the docs - OCI Generative AI Agents is a fully managed service that combines the power of large language models (LLMs) with AI technologies to create intelligent virtual agents that can provide personalized, context-aware, and highly engaging customer experiences.


 So let's get started with a simple example. I will create an agent that will assist in processing expenses.


Create the OCI GenAI Agent

The menu from Gen AI Agents above gives us an idea of how this will be done. Firstly, I need a knowledge base, e.g. corporate rules around expenses. We will use the following rules from Commiskey Inc.

This is my knowledge base and I'll make it available to the Agent via OCI Object Storage - 

I created the Knowledge Base - 

with its data source - 

The Ingestion Job pulling in the file from Object Storage - 

I then created the Agent - 

The Agent also has an endpoint, which will receive requests - 

I copy the endpoint ocid, as I will need this later.

Let's try out the Chat function - 


Looks good, so now to leveraging the Agent from OIC. But first, let's take a look at the apis we will be invoking from OIC.

OCI GenAI Agent REST APIs



The api docs are here.

As you can see there are 2 groups of api, consider these management and runtime.


Management APIs 

I will invoke some of these from an integrations, using the API Endpoint base url for Chicago, as that's the region hosting my agent.

Runtime APIs 

I will be invoking the createSession and chat api in my integration, but more of that later.

Creating the Connections in OIC 

As you will probably realise, I will need to create 2 connections in OIC, one for the management api and another for the runtime/client api.

Naturally, I will also need to create the relevant Policies to allow my OIC instance to invoke these apis. My esteemed colleague, Harris Q. has documented an easy approach for doing this, so check out his post here. Net, net, here are my 2 connections - 

Note the security policy used, in both connection definitions.

OIC Invoking the Management APIs




So how did I proceed here? I started off with list knowledge bases - the invoke is configured as follows - 

I didn't know the response structure to begin with, so I initially set this to {}. I then ran the integration and copied and pasted the response json from the activity stream. 

I did the same for the other invokes.

I also externalised the ocids for endpoint and compartment -

So let's run this - 

The relevant JSON response is available under Wire Message received...

OIC Invoking the Runtime/Client APIs

The above 2 are the key invokes - create session and then, using the session id, invoke the chat api. 

createSession configuration 






The chat invoke is configured as follows -

Let's run it...

The response - 
{
  "response" : "I'd be happy to help you with your expenses query. 
  However, I have to advise you that the meal you're trying to expense doesn't quite meet our company's expenses rules.
  Firstly, the meal value of €150 exceeds the allowed limit of €100, as per reference 1. 
  Additionally, the beer you've had with your meal is not eligible for expensing, as per reference 2, which clearly states that no alcohol can be expensed.
  Lastly, I notice that the receipt date is May 9th, 2025, which falls on a Friday. According to reference 7, on Fridays, only fish meals can be expensed, 
  and since your meal consisted of steak, it doesn't meet this criteria.\n\nI'm afraid I won't be able to approve this expense. 
  If you have any other receipts that meet our company's expenses rules, I'd be more than happy to help you with those."
}

I can easily add multi-language support to the endpoint - here I use the management api - updateAgentEndpoint -

I re-run the integration with the following request payload - 

{
  "idleTimeoutInSeconds": 3600,
  "expenseNr": "1",
  "details": "Das Datum des Spesenbelegs ist der 9. Mai 2025. Kann ich ein Menü mit Steak und Bier im Wert von 130 € als Spesen abrechnen??"
}
 
The response - 

{
  "response" : "Hallo!\n\nIch verstehe, dass Sie ein Menü mit Steak und Bier im Wert von 130 € als Spesen abrechnen möchten. Leider muss ich Ihnen mitteilen, dass dies nicht möglich ist.\n\nGemäß unseren Spesenregeln (Referenz 1) dürfen Mahlzeiten nicht über 100 € kosten, und Ihr Menü liegt über diesem Betrag. Darüber hinaus ist es nicht erlaubt, Alkohol (Referenz 2) zu expensieren, und Bier fällt unter diese Kategorie.\n\nAußerdem fällt der 9. Mai 2025 auf einen Freitag, und gemäß unserer Regel (Referenz 7) dürfen an Freitagen nur Mahlzeiten mit Fisch expensiert werden, nicht mit Fleisch wie Steak.\n\nIch hoffe, Sie verstehen unsere Regeln und können Ihre Ausgaben entsprechend anpassen. Wenn Sie weitere Fragen haben, stehe ich Ihnen gerne zur Verfügung.\n\nMit freundlichen Grüßen,\nIhr Spesenberater"
}

I can also try in Gaeilge -

{
  "idleTimeoutInSeconds": 3600,
  "expenseNr": "1",
  "details": "Is é dáta Admhála Costais ná 9 Bealtaine 2025. An féidir liom béile steak agus beoir ar €130 a chaitheamh?"
}

{
  "response" : "Dia duit,\n\nTáim buíoch duit as do cheist. Mar chomhairleoir costais, táim ansin chun cabhrú leat a chinntiú go bhfuil do chostais i gcomhréir leis na rialacha atá leagtha amach.\n\nI ndáil le do cheist, táim afraid nach féidir leat béile steak agus beoir ar €130 a chaitheamh. Tá dhá fhadhb ann:\n\n1. Tá an béile thar an teorainn luach, €100, a luaitear i réamhshráid 1.\n2. Tá beoir san áireamh, agus de réir réamhshráid 2, ní ceadmhach é a chaitheamh.\n3. Chomh maith leis sin, tá an béile steak ar siúl ar Dé hAoine, agus de réir réamhshráid 7, ní ceadmhach béile le feoil a chaitheamh ar Dé hAoine - iasc amháin atá ceadmhach.\n\nTáim sásta cabhrú leat a chinntiú go bhfuil do chostais i gcomhréir leis na rialacha. Má tá aon cheist eile agat, ná bíodh drogall orm a chur in iúl.\n\nGo raibh maith agat,\n[Your Name]\nComhairleoir Costais"
} 

Summa Summarum

I accept the use case is banal, but I'm sure you can all extrapolate from it, and apply what I have done to your own use case(s). The post shows you can leverage OCI Gen AI Agents easily, from your OIC integrations. It really only a couple of minutes work. So try it out!