Friday, March 24, 2023

#958 - Invoking ChatGPT from OIC

 


I had to try this out, first step was to create an account - 








Once in, I can try it out - Who was Mikhail Bakunin anyway?















Now how can I do something like this via the api?

Next step - get an api key - 



I already have one - but you get the idea - 



Copy the key for later use.

On to the api docs - 



On to Postman, to check out which models are available - 



I set Authorization at the Collection level - 




This is the one I will use - gpt-3.5-turbo.



This is the api I will call - I'm going to ask for book suggestions for a particular subject area eg. politics.

This brings us to roles - as they will be used in the request body. 

We have the following - system - describes the assistant. I will set this to - You are Niall. you are a well read person with great book suggestions. When answering try to be funny.

Then we have user, the user is going to be asking something.  

Here is the Postman request body - 

{
    "model": "gpt-3.5-turbo",
    "messages": [
        {
            "role": "system",
            "content": "You are Niall. You are a well read person with great book suggestions. When answering try to be funny"
        },
        {
            "role": "user",
            "content": "I'm looking for books on Politics. What can you suggest?"
        }
    ]
}

Let's execute the request in Postman - 



The full content - "Well, if you're looking for a good laugh, you could always try reading the political news these days. But if you want something more informative, I highly recommend \"The Dictator's Handbook\" by Bruce Bueno de Mesquita and Alastair Smith. It's a great book that breaks down the motivations of political leaders and helps explain why they do the things they do. Plus, it's a lot less depressing than watching cable news all day."

Well I did ask it to be funny!

Now to implementing this in OIC - just a couple of steps - 

Step 1 - Create the connection 



Step 2 - Create a Lookup Table 

Just to make it flexible - 


Step 3 - Create the Integration 
























The Invoke is configured as follows - 


I use the request and response payloads from Postman - I then attend to the mapping - 



Activate and test - 
























The usual suspects - Tolstoy, Dostoyevsky and Gogol. no mention of Ivan Goncharov and his classic, Oblomov, or even Alexander Herzen; but that's it, you should have asked me and not ChatGPT.

My next post will cover more sober business applications of such.
 


 


Wednesday, March 22, 2023

#957 Enabling Visual Builder in OIC


Visual Builder is available by default, when you provision an OIC gen 2 instance. However, in OIC3, one needs to explicitly enable it. Here are the simple steps to do so - 

1. Create your OIC3 instance, unless you already have one. Then follow the screenshots - 









e.g. allow group domain_admins to manage visualbuilder-instance in compartment oic-dev-comp












Tuesday, March 14, 2023

#955 OIC B2B - Anatomy of a simple X12 P850 doc

This post is more of a note for myself, but it may also interest some of you out there. In this case, I am receiving purchase orders from my trading partner Commiskey_Inc. My OIC B2B Host configuration is as follows - 


The Trading Partner and document configuration - 















I regularly do OIC demos including B2B, using a very simple X12 P850 document - 

ISA*00*          *00*          *ZZ*Commiskey_IID  *ZZ*MyCompany_IID     *230314*1204*U*00401*000000027*0*P*:~
GS*PO*Commiskey_IID*MyCompany_IID*20230314*1204*1027*X*004010~
ST*850*1027~
BEG*00*NE*8310138**20230314~
CUR*2L*USD*0001~
PO1*HOTD TShirt*30*EA*30~
PO1*HOTD Mug*1*EA*10~
PO1*HOTD Cap*5*EA*15~
CTT*3*985~
SE*8*1027~
GE*1*1027~
IEA*1*000000027~
 

Naturally, the B2B demo goes like a dream, but what do these fields mean?

ISA - Interchange Control Header - identifies the interchange - 

ISA01 - Authorization Information Qualifier - '00' means no authorization info present i.e. next field is empty.
ISA03 - Security Information Qualifier - '00' = No Security Information Present.
Net, net, ISA01 to ISA04 are hardly ever used.

ISA05 - Interchange ID Qualifier - is a 2 char code, in my case ZZ.
ISA06 - Interchange Sender ID - this is my trading partner EDI Interchange ID, in my case, Commiskey_IID.
ISA07 - Interchange ID Qualifier, is a 2 char code, in my case ZZ.
ISA08 - Receiver Id, This identifies your partner's sender ID in outgoing messages. In my case this is MyCompany_IID.
ISA09 - Interchange Date - format is YYMMDD. My date is 23rd March 2023 so the value is 230314.
ISA10 - Interchange Time - format is HHMM, in my case, 1204.
ISA11 - Identifier - a single character code value "U" meaning "U.S. EDI Community of ASC X12, TDCC, and UCS".
ISA12 -  the EDI standard published version number. In my case this is set to 00401. 
ISA13 - This is a 9 digit control number used for tracking purposes. This number must match IEA-02 (Interchange Envelope Trailer). In my case, both are set to 000000027.
ISA14 - Acknowledgement Request Indicator, usually set to 0.
ISA15 - Data sent can be for Test (T), Production (P) or Information (I). We're doing this for real so I set this to 'P'.
ISA16 - is the delimiter used to separate compent data elements, within a composite structure. I set this to ':', but, as you can see, it is not used in this simple PO850 doc. 

GS - Functional Group Header - 

GS01 - Functional Identifier Code, PO for Purchase Order.
GS02 - Application Sender’s Code, sames as ISA06, so, in my example, Commiskey_IID. 
GS03 - Receiver's Id, should be the same as ISA08, so, in my example, MyCompany_IID.
GS04 - Transaction Date - format CCYYMMDD, in my case, 20230314.
GS05 - Time in HHMM format.
GS06 - Group control Number - not to be confused with ISA13.
GS07 - EDI standards Agency, 'X' stands for X12.
GS08 - EDI Version - in my case, 004010.

ST segment - Transaction Set Header - first field is the Transaction Set Identifier Code, in my case 850 for purchase order. The second field is the Transaction Set Control Number -  the control number that must be unique within the transaction set, in my case, 1027.  

BEG segment - 

BEG01 - First field, with the value '00' is the X12 TRANSACTION SET PURPOSE.
Valid values include - 
  • 00 Original
  • 01 Cancellation
  • 06 Confirmation
  • 07 Duplicate
Full list available here

BEG02 - Purchase Order Type Code, with the value 'NE'.
Valid values include - 
  • NE New Order
  • NS New Store
  • SA Standalone PO
  • BK Blanket PO

Full list available here

BEG03 - Purchase Order Nr, with the value '8310138'. This field can be up to 22 chars.

BEG04 - optional

BEG05 - PurchaseOrderDate, with the value 20230314 (YYYYMMDD)

CUR - the Currency Segment -

CUR01 - Code identifying an organizational entity, a physical location, property or an individual, in my case '2L' which translates to Corporation.
Full list available here  

CUR02 - Currency Code, in my case 'USD',  
CUR03 - Exchange Rate, in my case 1:1.

PO1 - Purchase Order Item details - the first field is the assigned identification, in my case, 'Bearing'.
The next field is the quantity ordered, in my case, 30. The following field is Unit of Basis for Measurement Code for the quantity, e.g single item or case of items. So my first line is for 30 Hare of the Dog T-Shirts, each costing $30.

CTT - Transaction Totals - first field is he number of line items, in my case 3. The second field is the total order value, in my case - (30 * 30) + (1 * 10) + (5 * 15) = 985 

SE - Transaction Set Trailer - indicates end of transaction set and contains a count of the transmitted segments (incl. ST and SE), in my case, 8. The second field is a unique Transaction Set Control Number (min 4 digits), in my case 1027.

GE - Functional Group trailer - First field contains the number of transaction sets included in the message, in my case, 1. Field 2 is Group Control Number, assigned by the sender. 

IEA - Interchange Control Trailer - first field in the number of included functional included groups, in my case, 1. The second field, Interchange Control Number is a mandatory 9 digit number, in my case, 000000027.       

A very helpful resource for me, when compiling this blog, was the EDI Academy Blog. Check it out here.


  

Monday, March 6, 2023

#956 OIC 23.02.2 update - Welcome Visual Builder


Another major step on the way to OIC Gen2 parity - OIC now includes Visual Builder - 



In this post I will detail the creation of a simple VB app that invokes an OIC integration, so let's check out which integrations I have on this instance. 















Let's invoke AA-PostgreSQL-Demo from VB. This creates a row in my Orders table. first step is to create a service connection in VB to OIC Integration. We have OOTB access to our activated integrations, as you can see - 





As already mentioned, the PostgreSQL integration creates an order in my PostgreSQL DB. 

So I begin by creating a simple VB app to manage my orders. I create an Orders Business Object, then I generate a CRUD UI for my Orders. Note that Visual Builder allows me to create native mobile and web apps and this very easily. When we say low code, we mean LOW! 


The final step is to amend the page workflow to invoke the integration. I will add this to the create page - Save - action chain.  



I will add the Integration invoke in the success path, after Fire Notification.






I set the body as follows - 






Let's test it - 











I check Integration Tracking -


I then check out the orders table - DB - 





Enabling VB in your OIC instance is very easy, only a couple of steps - 

1. Create a policy to allow OIC admin to manage Visual Builder -
allow group <admin_group> to manage visualbuilder-instance in compartment  <compartmentId>

2. Click the Enable link for Visual Builder on the Integration Instance Information tab.


Summa Summarum

This is the penultimate step on the way to OIC Gen 2 parity as OIC now comprises - 

  • Integration
  • File Server
  • B2B
  • Insight
  • Visual Builder

But it's not just parity - OIC includes many compelling new features, not available in OIC Gen2. So get kicking...