Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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:

Clients or developers can use Unique internal APIs, but must not build any automation or integration with them. These APIs do not guarantee backward compatibility and are excluded from any Service Level Agreement (SLA). Unique will not roll back changes to fix broken integrations caused by updates to internal APIs. Consequently, reliance on these APIs for critical functions is strongly discouraged.

Learn more about the use of Internal APIs.

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 Software Development Kit (SDK) with the Public API as outlined in APIs & Integrations.

Terms and Conditions

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

  • You agree to cover all costs resulting from any usage of the internal API, especially when used programmatically.

  • 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 (Roles and Permissions) 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

<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 Roles and Permissions 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

<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 (https://unique-ch.atlassian.net/wiki/spaces/PUB/pages/445775966/Assistant+module+settings#Available-GPT-models ) or actually your own (Connect custom LXM (LLM) with Unique Finance GPT).

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…

{
  ...
  "model": "gpt-4o-2024-05-13",
  "usage": {
    "promptTokens": 15,
    "completionTokens": 58,
    "totalTokens": 73
  },
  ...
  "choices": [
    {
      "index": 0,
      "finishReason": "stop",
      "message": {
        "role": "assistant",
        "content": "The contrast color of red, often referred to as its complementary color, is green. This is based on the color wheel, where complementary colors are positioned directly opposite each other. When placed next to each other, complementary colors create a strong visual contrast and can make each other appear more vibrant.",
        "toolCalls": []
      }
    }
  ]
}

  • No labels