Monday, March 27, 2023

#959 more on OIC and ChatGPT - Some Business Applications of such...


The chat use case from the previous post may be interesting for those with a literary bent, but what about concrete business use cases for OIC and ChatGPT? When I say OIC, I am of course referring to a company's app and tech ecosystem which can include enterprise system of record - ERP, HCM, CX etc.

OIC is the conduit in this regard, albeit a very intelligent one.

Generating Emails

The first business use case I can up with is as follows - I am late in shipping an order to a customer and need to email them my humblest apologies.





















Here are the full request and response payloads -

{
    "model""text-ada-001",
    "prompt""write an email from Harmonstown Imports to my 
customer Commiskey Trading Ltd, spologising for the delay in 
shipping their order with the number 2112. offer 10%  discount 
on next order.",
    "temperature":0.7,
    "max_tokens":256,
    "top_p":1,
    "frequency_penalty":0,
    "presence_penalty":0
}

{
    "id""cmpl-6yaQBAifxGurmlTDikuS4C16ChVT8",
    "object""text_completion",
    "created"1679897703,
    "model""text-ada-001",
    "choices": [
        {
            "text""Hello Commiskey Trading Ltd

Thank you for your order with the number 2112. 
It took longer than expected to ship, but we’ve decided to offer a 10% discount on future orders.

Thank you again for your order and we hope to have your order shipped soon.
Sincerely,

Harmonstown Imports",
            "index"0,
            "logprobs"null,
            "finish_reason""stop"
        }
    ],
    "usage": {
        "prompt_tokens"42,
        "completion_tokens"77,
        "total_tokens"119
    }
}

It's not perfect but you get the idea. OIC could then take this response and send the email via the NOTIFICATION action.

Now back to the examples screenshot from the start of the post - 

My book suggestions is a good example of Q&A or Chat - answering my questions, based on existing knowledge. This is the typical chatbot use case. The assistant helps me through it's intimate knowledge of its subject matter area.

Now let's revisit the email above and see what we can do in respect of non-English customers - 

Translating

There is a delay in shipping order 2113 to my German customer Hasselbacher Motoren Werk. So my generated email would be as follows - 

Hello Hasselbacher Motoren Werk

Thank you for your order with the number 2112. 
It took longer than expected to ship, but we’ve decided to offer a 10% discount on future orders.

Thank you again for your order and we hope to have your order shipped soon.
Sincerely,

Harmonstown Imports


So let's take that and try out the following model -




Again, let's look at the request and response payloads in detail - 

The request - 

{
    "model""text-davinci-003",
    "prompt""Translate this into German:Hello Hasselbacher Motoren Werk, 
Thank you for your order with the number 2112. It took longer than expected to ship, 
but we’ve decided to offer a 10% discount on future orders. Thank you again for your 
order and we hope to have your order shipped soon. Sincerely, Harmonstown Imports",
    "temperature":0.7,
    "max_tokens":256,
    "top_p":1,
    "frequency_penalty":0,
    "presence_penalty":0
}

Note the model setting - 
text-davinci-003.

Now to the response - 

{
    "id""cmpl-6yan4mEPE2CpdzxsYhqpnx6mNufe7",
    "object""text_completion",
    "created"1679899122,
    "model""text-davinci-003",
    "choices": [
        {
            "text""\n\nHallo Hasselbacher Motoren Werk, vielen Dank für Ihre Bestellung mit der Nummer 2112. 
Es hat länger als erwartet gedauert, um zu versenden, aber wir haben beschlossen, einen 10% Rabatt auf 
zukünftige Bestellungen anzubieten. Vielen Dank noch einmal für Ihre Bestellung und wir hoffen, dass Ihre 
Bestellung bald versandt wird. Mit freundlichen Grüßen, Harmonstown Imports",
            "index"0,
            "logprobs"null,
            "finish_reason""stop"
        }
    ],
    "usage": {
        "prompt_tokens"74,
        "completion_tokens"144,
        "total_tokens"218
    }
}

As a master of the Deusche Sprache, all I can say is sehr Gut!

Parsing Text for Contact Information



While we're on the subject of emails, how about parsing such or any text for that matter, in order to extract contact information?








 















OIC then takes such and creates a new contact in Oracle CX, SFDC or your CRM of choice.

Sentiment analysis 

Simple use case here - orders from my online shop contain a free text fields customer can fill in.
Let's do some sentiment analysis on the following values - 

1. Please ship within 3 days, not 3 weeks like the last time, you incompetent fools.
2. I love your products.
3. your products are awesome, especially the totally useless and overpriced one I bought last week.
  




















The results - 

1. Negative
2. Positive
3. Positive

As you can see in respect of 3 - ChatGPT doesn't do sarcasm.

But you could well imagine, OIC taking such results and creating a note in the target CRM, so the sales person will be even more prepared, when talking with this client in the future.  


Working Days

Simple use case here - I'm shipping to a customer in Ireland and need to find out how many working days there are in a particular time period, as my SLA is to deliver within 14 days max.

e.g. I plan to ship on March 13th from the US and know the shipment needs to arrive within 14 working days. The customer is on a 5 day week, so what is the latest date on which I can deliver?

{
    "model": "text-davinci-003",
    "prompt": "I am shipping goods to Ireland on March 13th 2023. It will take 14 working days to arrive. Working days are Monday to Friday and exclude public holidays in Ireland. On what day will I deliver the goods?",
    "temperature":0.7,
    "max_tokens":256,
    "top_p":1,
    "frequency_penalty":0,
    "presence_penalty":0
}

Response - 

{
    "id": "cmpl-6yc79XP1JN66OqQH1yXVf3qx9MVQM",
    "object": "text_completion",
    "created": 1679904211,
    "model": "text-davinci-003",
    "choices": [
        {
            "text": "\n\nThe goods will arrive in Ireland on March 31st 2023.",
            "index": 0,
            "logprobs": null,
            "finish_reason": "stop"
        }

Let's do the Math - 

13th to 31st = 19 days incl.

18/19th and 25/26th are weekends
17th is St. Patrick's Day

19 - 5 = 14.


SQL Requests

Translate text into SQL, e.g. find the orders for my customer Hare of the Dog Pub.
We can narrow this down but restricting the search to certain products











The prompt value is - 
Create an SQL request to find the orders for my customer Hare of the Dog Pub for product iBike:




The Response - 

text": "\n\nSELECT * \nFROM orders \nWHERE customer_name = 'Hare of the Dog Pub' \nAND product_name = 'iBike';"



OIC can easily use the ORCL DB adapter to execute that SQL command-




















Another example - Get my top customers - 

"prompt": "Create an SQL request to find the top customers from orders -

The response -
"text": "\n\nSELECT customer_name, SUM(order_total) \nFROM orders \nGROUP BY customer_name \nORDER BY SUM(order_total) DESC















However, our ODA team go one step further with SQL Dialogs.
SQL Dialogs are skills that can translate a user's natural language utterances into SQL queries, send the queries to a backend data source, and display the response.

Check it out here.
 
.

Content Creation

A big thank you to my colleague Manish P. for his work in this area - 
This is for the creatives among you, and the example below are simple ones, from yours truly. 

Ok I'm creating some material and need images of a Rhodesian Ridgeback dog. 













I click on one of the links - granted a lovely dog, but nothing compared to our Akira.




















Moderation - let's check for any hate speech in the following - 

"input": "Leprechauns are lazy, spend the day drinking poteen and the night searching for pots of gold. Oh how I'd love to batter the heads off them

As you can see, this is hateful and violent, and naturally, patently untrue.
     



 








Now let's ask ChatGPT


"role""user",
            "content""list me 10 compelling business applications of ChatGPT"

------------------------------------------------------------------------------------------------------

Sure, here are 10 compelling business applications of ChatGPT:

1. Customer service: ChatGPT can be used to provide quick and efficient customer service, automating common queries and freeing up customer service staff to handle more complex issues.

2. Sales and lead generation: ChatGPT can engage with potential customers, providing information on products or services, and can even generate leads by asking for contact information.

3. HR recruitment: ChatGPT can be integrated into HR systems to provide pre-screening of candidates, automating the initial stages of the recruitment process.

4. Help desk support: ChatGPT can be used to provide technical support to employees, troubleshooting common issues and providing quick solutions.

5. Marketing campaigns: ChatGPT can be used to engage with customers during marketing campaigns, providing personalized messaging and answering queries in real-time.

6. Training and onboarding: ChatGPT can assist with onboarding new employees by answering common questions and providing training materials.

7. Research and analysis: ChatGPT can be used to sift through large amounts of data, providing insights and analysis to support business decision-making.

8. Brand management: ChatGPT can monitor social media and online platforms for mentions of your brand, helping to manage your online reputation.

9. Financial analysis: ChatGPT can be integrated into financial systems to provide real-time financial analysis, forecasting and reporting.

10. Supply chain management: ChatGPT can be used to automate supply chain management, including tracking and delivery updates, reducing the need for manual tracking and communication.

Finally...

Just some final explanations and reflections - 

you may have noticed the following request payload fields - 

temperature

Firstly, what does the "temperature" request field mean? This controls the level of randomness or as one author puts it, creativity. The higher you set the more creative, however less precise.  

Here's a simple example - 

Here's a poem on Leo Tolstoy with temperature set to 0


 "prompt""Write a poem on Leo Tolstoy",
 "temperature":0,
"max_tokens":256

---------------------------------

A man of great renown, His name was Leo Tolstoy,

His works of literature, Are known the world o'er.

He wrote of love and war, Of life and death and more,

His works are timeless, And will be forevermore.

He wrote of human nature, Of joy and sorrow too,

His words are still alive, And will remain so true.

His works are timeless, His words are still alive,

Leo Tolstoy's legacy, Will never die.

------------------------------------------------

temperature set to 1.8

Great influence no voice can overwhelm.

From striving writers can draw much bread divine,

His legacy ignites canvusses anew,

Enormoubcs series praid Leo gall ions or Benvolvsovoo sttin okrinegu tithy tomstaitteSo p nmostsoean sdaignebte noMeansailleainspeinfian iopbrocu havelitfeoon

From Tsar  Alexadvres neaches Akinyein todayrajoWgrjvpointbenbreentigorrh st om skine Sosmin fentleport he salurtJoinsse lmobbanow bur grfireasesnuheionsver sirenstism tum rprise ant bollow An crsum ashylaing sherueippfsi sp ce ofmerregavenninau do artsrene Thkar ate deennues aking counsnine ain thrffatisothermad Teoldsty Grretws Cas ad Tns CiandoIofrlsov ra Manolavelt Jeredeer,\nFstone bo NrabolinrarytlereadSe yo epic writings of unwit dy flight Isolerojoyst fairtelichecingdelvey lam made Immllgurmt disshim

1.8 is very Finnegan's Wake, but I think you get the idea. You can extrapolate from this for any other use cases.

max_tokens

Secondly, max_tokens - The maximum number of tokens to generate in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length. Most models have a context length of 2048 tokens (except for the newest models, which support 4096).

Let's try out -

"prompt""Write a poem on Leo Tolstoy",
 "temperature":0,
"max_tokens":10

The result is succinct -

      "text""A man of great renown"

You can check out all the possible request fields here





































Net, net - ChatGPT will be adopted by many OIC customers,
another component in the ecosystem, that OIC plumbs together.
However, customers looking to power their existing apps
ecosystem with AI capabilities should also be looking at what
OCI AI Services provide. I don't think it will be a case of either or.

You can check out the richness of what OCI has to offer in this
respect here

































No comments: