The Python SDK for OCI is an incredible easy way to consume any OCI service.
I covered the required pre-requisites on this post here, but as a recap here you go.
OCI Configuration
First you need to configure your OCI tenancy for access.
- Go to your user profile
- Add an API Key
- Download the generated private key
- Then copy the config file, which should be placed locally, along side the private key.
After that you will be able to load a config variable that can be used for authentication
CONFIG_PROFILE = "DEFAULT"
config = oci.config.from_file('/Users/danimmar/.oci/config', CONFIG_PROFILE)
Python Configuration
With Python installed the only thing we need to do is to install oci
pip install oci
Once that is out of the way, then you are ready to go. The below code is a working example of how we can invoke the OCI Generative AI service.
SDK Reference
https://docs.oracle.com/en-us/iaas/tools/python/2.128.1/api/generative_ai_inference.html