RelationalAI SDK Configuration
This guide presents the configuration of the RelationalAI SDK, which is used to interact with RelationalAI’s Relational Knowledge Graph System (RKGS).
To connect to the RAI Server using any of the available RelationalAI SDKs, you need a configuration file with RAI credentials.
RAI Credentials
RAI credentials are an ID and a secret key. To get them, follow these steps:
- The
Organization/Team/Person
requests an account from RAI. Once the account is set up, an admin user is assigned to the account. - This admin creates OAuth clients. Each client is identified by a
client_id
and aclient_secret
. This can be done using the RAI Console — see the Managing OAuth Clients section in the Managing Users and OAuth Clients guide. You can also do this using any of the SDKs — see the Managing OAuth Clients section in each SDK guide. - The SDK user adds the
client_id
andclient_secret
to their configuration file.
The Configuration File
You can give the configuration file any name and extension, and put it in any path, as long as it is correctly specified in the respective SDK function used to read it.
By default, ~/.rai/config
is the configuration file and path used for Linux and MacOS.
For instance, here’s an API call to set up your RelationalAI SDK for Python with a customized configuration file:
from railib import config
cfg = config.read(fname = "~/.rai/config-folder/my-config-file.txt")
The configuraton file should look like this:
[default]
host = azure.relationalai.com
client_id = ######### [from RelationalAI admin]
client_secret = ######### [from RelationalAI admin]
Note that in place of #########
the actual OAuth user credentials should appear.
Here, [default]
is your RAI profile name.
You will refer to this profile name when using the SDK.
Within the configuration file, you can also specify some optional parameters, with the following default values:
[default]
region = us-east
port = 443
scheme = https
client_credentials_url = https://login.relationalai.com/oauth/token
Multiple Profiles
You can specify other RAI profiles in addition to [default]
in separate sections of the config
file.
Here’s an example adding [my-profile]
:
[my-profile]
host = azure.relationalai.com
client_id = ######### [from RelationalAI admin]
client_secret = ######### [from RelationalAI admin]
[default]
host = azure.relationalai.com
client_id = ######### [from RelationalAI admin]
client_secret = ######### [from RelationalAI admin]
And this is the API call to set up the RelationalAI SDK for Python using a certain profile:
from railib import config
cfg = config.read(profile = "my-profile")
Permissions
Each OAuth client has its own set of permissions, which determine the operations it can execute. Depending on the permissions, some operations, such as listing other users or creating or deleting compute engines, may fail. See Managing OAuth Clients for more details.