AI Quick Actions API Server¶
AI Quick Actions is accessible through the Python SDK APIs and CLI. If the CLI or Python SDK doesn’t work for you, you can host the Aqua API server and integrate with it. We also provide you with the OpenAPI 3.0 specification so that you can autogenerate client bindings for the language of your choice.
Prerequisite
Install oracle-ads -
pip install "oracle-ads[aqua]"
Set up AI Quick Actions policies
API Specification¶
Access API specification from aqua_spec.yaml
Configuration¶
The preferred way to set up the configuration is to create a file named .env
and set up your preferences. Here is a sample content of .env
:
OCI_IAM_TYPE=security_token
OCI_CONFIG_PROFILE=aqua
HF_TOKEN=<your token>
Authentication¶
AI Quick Actions will need to connect to OCI services to accomplish different functionalities. You can use api_key, security_token, resource_principal, instance_principal, etc.
You can set up the preferred authentication mechanism through the following environment variables -
# set this to api_key/resource_principal/instance_principal/security_token
OCI_IAM_TYPE=security_token
# Optional Profile name
OCI_CONFIG_PROFILE=<profile-name>
Set up Hugging Face token, if you will be registering the model with the download from Hugging Face option -
HF_TOKEN=<your token>
Default Settings¶
You can set up the following default values to avoid having to input them during API calls -
NB_SESSION_COMPARTMENT_OCID=ocid1.compartment...<UNIQUEID>
PROJECT_OCID=ocid1.datascienceproject.oc1...<UNIQUEID>
# Optional - If you are on a dev tenancy, you may be restricted from using default network settings. In that case, set up AQUA_JOB_SUBJECT_ID to the preferred subnet ID. This is required only while launching FineTuning jobs
AQUA_JOB_SUBNET_ID=ocid1.subnet.oc1...<UNIQUEID>
Webserver Settings¶
# Default value is 8080
AQUA_PORT=8080
# Default value is 0.0.0.0
AQUA_HOST="0.0.0.0"
# Default value is 0. Set the number of processes you wish to start to handle requests
AQUA_PROCESS_COUNT=1
# If you face CORS related issues while accessing the API, set -
AQUA_CORS_ENABLE=1
Starting the server¶
Once you have the .env
file ready, you can start the server from the same folder as .env
by running -
python -m ads.aqua.server
Docker Image¶
Copy following code into file called
Dockerfile
FROM ghcr.io/oracle/oraclelinux8-python:3.11-oracledb RUN pip3 install "oracle-ads[aqua]" CMD ["python3.11","-m","ads.aqua.server"]
Build the image using following command. Set the <tag> with the any value -
TAG=1.0 docker build -t aqua:$TAG .
Start the image -
KEY_PATH=$HOME/.oci docker run --rm -it --env-file .env \ -v ~/.oci:/root/.oci \ -v $KEY_PATH:$KEY_PATH \ -p 8080:8080 aqua:$TAG