Directly using the inbuilt Large X Models (LXM)

There are rare cases where you want to talk directly to the Large Language Models that are attached to your Unique FinanceGPT instance. The following page describes how to do so and which terms & conditions apply.

This page describes how to use an internal API of Unique, which comes with certain implications:

By using the internal API as outlined, you automatically agree to the #Terms-and-Conditions described below.

Disclaimer

The recommended way to use the inbuilt LXM is to use the with the Public API as outlined in .

Terms and Conditions

By using this API (especially but not only on a Unique ) you automatically accept the following terms:

  • You agree to cover all costs resulting from any usage of the internal API, especially when used programmatically. The cost is charged in the same means as if you would use the Chat User Interface.

  • You are aware that all models are differently priced.

  • You release UNIQUE from any Unique Credits Claims resulting from improper API usage, such as impacting the Client's own Unique tenant with improper use, especially but not exclusively, for Chat and Ingestion functionalities.

  • You accept that Incidents related to using this API improperly are not covered under any signed SLA.

  • Support in regards to this endpoint is best-effort based and is not covered under any signed SLA.

Design considerations

As said in the disclaimer, it is strongly discouraged and not supported to build automations or integrations against this internal API. If you decide to use the API programmatically, stick to the following bullets to keep the impact low.

  • Do space the requests out over time

  • Do limit the amount of parallel requests

  • Do not 'Denial Of Service' the endpoint.

  • Do select the model to use carefully (remember the cost impact and that you agreed to cover it by using the API)

  • Do avoid unlimited retries and back them off exponentially if needed

These bullets are guidelines and do not render Uniques liability in case of improper usage.

Authenticating towards the API

Prerequisites

Whether user or service user, the entity used must have the Unique Role () chat.admin.all assigned.

As user

You can learn how to get a valid token for your personal user using this guide.

As service user

Prerequisite: Having cliendId and clientSecret of a Service User (Learn here how).

This cURL will issue token that can be used to interact with the internal API.

curl --location 'https://id.<TENANT>.unique.app/oauth/v2/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --header 'Authorization: Basic <BASICAUTH>' \ --data-urlencode 'grant_type=client_credentials' \ --data-urlencode 'scope=openid profile email urn:zitadel:iam:user:resourceowner urn:zitadel:iam:org:projects:roles urn:zitadel:iam:org:project:id:<PROJECTID>:aud'

Where <> is

Description

Example

Where <> is

Description

Example

<TENANT>

The tenants sub-domain.

oleole (part of id.oleole.unique.app)

<BASICAUTH>

The clientId:clientSecret but base64 encoded.

echo "cliendId:clientSecret" | base64

Y2xpZW5kSWQ6Y2............xpZW50U2VjcmV0Cg==

<PROJECTID>

The Project ID of your Zitadel instance where the Authorizations for are granted on.

225334283118523771

Using the API

curl --location 'https://gateway.<TENANT>.unique.app/chat/openai?timeout=<TIMEOUT>&languageModel=<MODEL>' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <TOKEN>' \ --data '[ { "role": "user", "content": "What is my <PROMPT>?" } ]'

Where <> is

Description

Example

Where <> is

Description

Example

<TENANT>

The tenants sub-domain.

oleole (part of gateway.oleole.unique.app)

<TIMEOUT>

Timeout in Milliseconds!

The default is 8 seconds, the maximum is 10 minutes.

Note that depending on the model you chose, the answer can take time to generate!

15000

<MODEL>

One of the supported models ( ) or actually your own ().

AZURE_GPT_4o_2024_0513

<TOKEN>

The token you got in the Authenticating step.

eyJhb………KtOi0Vw

<PROMPT>

The prompt for the model!

What is the contrast color of red?

role: user

Learn from OpenAI what the roles mean…

 


Author

@Dominik Meyer

 

© 2024 Unique AG. All rights reserved. Privacy PolicyTerms of Service