Oauth2 for LXM usage — Unique AI Documentation

Oauth2 for LXM usage

Unique offers the possibility to use oauth2 as authentication for LXM calls. Means supporting the configuration of an clientId, an clientSecret, an endpoint and optionally a scope value to first call this endpoint in order to receive a valid token for the request to the LXM.

This token endpoint needs to provide an access_token and an expires_in (seconds) attribute as response. Based on this expires_in and the clientId Unique caches this token in the application memory to not request a new token for the same clientId again for every LXM request. 30 seconds before the token expires or when its already expired Unique will request a new token.

Configuration for LXM calls from node-chat application:

Environment variable CHAT_LLM_OAUTH_CONFIGURATION
Description Its an JSON array of objects, which contain the following string attributes:
- clientId

- clientSecret

- authEndpoint

- scope (optional)

- llmEndpoint

The llmEndpoint needs to match with the endpoint corresponding to the provided LLM configuration environment variable.

Example:

json

CHAT_LLM_OAUTH_CONFIGURATION='[{\
   "llmEndpoint": "{SAME_ENDPOINT_AS_IN_ENDPOINTS_JSON}",\
   "clientId": "myClientId",\
   "clientSecret": "myClientSecret",\
   "authEndpoint": "https://www.oauth.testing/token",\
   "scope": "custom-scope"\
}]'

Also External / Custom LXMs can use the oauth2 authentication. Please check the following documentation.

Configuration for embedding calls from node-ingestion:

Environment variable INGESTION_EMBEDDING_OAUTH_CLIENT_ID
INGESTION_EMBEDDING_OAUTH_CLIENT_SECRET
INGESTION_EMBEDDING_OAUTH_ENDPOINT
INGESTION_EMBEDDING_OAUTH_SCOPE (optional)

Example:

json

INGESTION_EMBEDDING_OAUTH_CLIENT_ID="My ClientId"
INGESTION_EMBEDDING_OAUTH_CLIENT_SECRET="My ClientSecret"
INGESTION_EMBEDDING_OAUTH_ENDPOINT="https://www.oauth.testing/token"
INGESTION_EMBEDDING_OAUTH_SCOPE="custom-scope"

Configuration for MS Document Intelligence calls from node-ingestion-worker

Environment variable INGESTION_WORKER_MS_DI_OAUTH_CLIENT_ID
INGESTION_WORKER_MS_DI_OAUTH_CLIENT_SECRET
INGESTION_WORKER_MS_DI_OAUTH_ENDPOINT
INGESTION_WORKER_MS_DI_OAUTH_SCOPE (optional)

Example:

json

INGESTION_WORKER_MS_DI_OAUTH_CLIENT_ID="My ClientId"
INGESTION_WORKER_MS_DI_OAUTH_CLIENT_SECRET="My ClientSecret"
INGESTION_WORKER_MS_DI_OAUTH_ENDPOINT="https://www.oauth.testing/token"
INGESTION_WORKER_MS_DI_OAUTH_SCOPE="custom-scope"