Few posts planned for use in expected Hackathons.
We want to use Oracle AI Service of OCI Language. (OCI - Oracle Cloud Infrastructure)
A nice workshop from Oracle Live-Labs: Get started with Oracle Cloud Infrastructure Language.
The Language AI Service documentation is here.
Permissions
First, we need to gain access to the service. It can be granted to all OCI users of the tenancy or specific group you belong to. For this we need to create a Policy that allows to use ai-service-language-family in tenancy.
- allow group <group-name> to use ai-service-language-family in tenancy
- allow any-user to use ai-service-language-family in tenancy
Intro
- Using pretrained models
- Text translation
- Custom Models
- Language detection - Identify the language of your text from more than 75 languages.
- Text classification - Classifies text content into more than 600 categories.
- Sentiment analysis - Extract sentiment expressed towards product and product aspects.
- Key phrase extraction - Identify the most salient talking points in your text.
- Named entity recognition - Identify entities such as people, places, organization, date, etc in text.
- PII Detection - Detect PII entities and mask, replace or remove them from text records.
- Arabic
- Brazilian-Portugese
- Czech
- Danish
- Dutch
- English
- Finnish
- French
- French-Canadian
- German
- Greek
- Hebrew
- Italian
- Japanese
- Korean
- Norwegian
- Polish
- Romanian
- Simplified-Chinese
- Spanish
- Swedish
- Traditional-Chinese
- Turkish
There are many options to consume the services:
- Console UI
- OCI CLI
- Language SDK
- Rest API
- From DataSience Notebook Session
Results in Console
I copied a text I was reading in Businessinsider.com (https://www.businessinsider.com/oracle-chooses-cohere-ai-startup-best-alternative-openai-2023-6) and analyzed it. As you can see in the image, we can get plain layout or JSON:
Here are the results:
Actual Work
We can do the same with:
OCI CLI see here in the above mentioned Workshop - Lab 1 Task 1. And Language CLI documentation here.
Using Language SDK with Java, Python, TypeScript and JavaScript, .NET, Go, Ruby. See here for links to documentation and a example in Python (Workshop Lab 1 Task 2) see also API reference of AIServiceLanguageClient (that includes translation and many more options) here.
General SDK and CLI documentation (Not only Language) is here.
Using REST APIs (with POSTMAN). See here Workshop Lab 1 Task 4
Language API documentation is here
An example of working Notebooks of "Sentiment Analysis" and "Named Entity Recognition" from Oracle DayaScience Service, see here Workshop Lab 1 Task 3.
Custom Models
As part of the Language service we can create custom classification, custom Named entity recognition (NER) and more. In the Workshop Lab 2, we can learn how to create and train Custom models.
In the Lab, we learn to
- Create project.
- Train a custom NER and custom Text Classification model.
- Create endpoint and analyze text using OCI console and Python SDK
Please notice, this part requires additional visit to the "Identity & Security" section.
There creating a dynamic group with the following matching rule:
all {resource.type='ailanguagemodel'}
And a new policy with the following statements:
- allow any-user to manage ai-service-language-family in tenancy
- allow dynamic-group <dynamic-group> to manage objects in tenancy
(<dynamic_group> is the group name you just created). As before we can set it to a group and not any-user.
For extra reading see this blog and product documentation (that includes supported languages as well).
Translation
Beyond the described in the Intro, Lab 3 of the Workshop presents translating text with Python SDK and using the OCI Console example.