Skip to content

RelationalAI/rai-sdk-python

Repository files navigation

The RelationalAI Software Development Kit for Python

Workflow Status
Continuous Integration (CI) build
Publish to PYPI publish

The RelationalAI (RAI) SDK for Python enables developers to access the RAI REST APIs from Python.

Getting started

Requirements

  • Python 3.7+

Installing the SDK

Install using pip:

$ [sudo] pip install rai-sdk

Install from source using pip:

$ git clone [email protected]:RelationalAI/rai-sdk-python.git
$ cd rai-sdk-python
$ [sudo] python3 setup.py install

Install from source in editable mode.

$ git clone [email protected]:RelationalAI/rai-sdk-python.git
$ cd rai-sdk-python
$ [sudo] pip install -r requirements.txt
$ [sudo] pip install -e .

Create a configuration file

In order to run the examples and, you will need to create an SDK config file. The default location for the file is $HOME/.rai/config and the file should include the following:

Using OAuth Client Credentials

Sample configuration using OAuth client credentials:

[default]
host = azure.relationalai.com
client_id = <your client_id>
client_secret = <your client secret>

# the following are all optional, with default values shown
# port = 443
# scheme = https
# client_credentials_url = https://login.relationalai.com/oauth/token

Client credentials can be created using the RAI console at https://console.relationalai.com/login

Using API Access Key Credentials

Sample configuration using API access key credentials (deprecated):

[default]
host = azure.relationalai.com
port = <api-port>      # optional, default: 443
scheme = <scheme>      # optional, default: https
access_key = <your public access key>
private_key_filname = <name of file containing private key>

Note, the SDK expects to find the private key file in the same folder as the config file.

You can copy config.spec from the root of this repo and modify as needed.

Generate python protobuf sources from protobuf specification

python -m grpc_tools.protoc -I railib/pb --python_out=./railib/pb railib/pb/*.proto

Examples

Each of the example files in the ./examples folder is standalone and can be run from the command line, eg:

$ cd examples
$ python3 ./list_engines.py

Support

You can reach the RAI developer support team at [email protected]

Contributing

We value feedback and contributions from our developer community. Feel free to submit an issue or a PR here.

License

The RelationalAI Software Development Kit for Python is licensed under the Apache License 2.0. See: https://github.com/RelationalAI/rai-sdk-python/blob/master/LICENSE