Skip to content

OLS-1622: Document token quota feature #91500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: lightspeed-docs-main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions configure/ols-configuring-openshift-lightspeed.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ include::modules/ols-about-lightspeed-and-role-based-access-control.adoc[levelof
include::modules/ols-granting-access-to-individual-users.adoc[leveloffset=+2]
include::modules/ols-granting-access-to-user-group.adoc[leveloffset=+2]
include::modules/ols-filtering-and-redacting-information.adoc[leveloffset=+1]
include::modules/ols-tokens-and-token-quota-limits.adoc[leveloffset=+1]
include::modules/ols-activating-token-quota-limits.adoc[leveloffset=+2]
69 changes: 69 additions & 0 deletions modules/ols-activating-token-quota-limits.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Module included in the following assemblies:
// * TBD

:_mod-docs-content-type: PROCEDURE
[id="ols-activating-token-quota-limits_{context}"]
= Activating token quota limits

Activate token quota limits for the {ols-long} Service by defining key-value pairs in the `ConfigMap` resource. The {ols-long} pod mounts the `ConfigMap` resource as a volume, enabling access to the file stored within it. The `OLSConfig` Custom Resource (CR) references the `ConfigMap` resource to obtain the quota limit information.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we say:
Service by defining key-value pairs in the quota-limit instance of the ConfigMap resource.
?

Or can we not assured it will be named this way?
We're editing the configmap instance, instead of creating it which leads me to believe the configmap is automatically created. If so, we should know what the name is no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @JoaoFula. I'll confirm with @tisnik if I should use quota-limit. I'm not sure if it will always be referred to that way, but in this example it could be.

You also bring up a good point about hte ConfigMap. When I wrote this, I was assuming that a ConfigMap already existed. I don't think a ConfigMap is automatically generated, but I'll also have to check with Pavel on that, too.

@tisnik does it make sense to add a step to create the ConfigMap? I believe this is the syntax to do so: oc create configmap <configmap-name> --from-file=<path-to-file>


.Prerequisites

* You have installed the the {ols-long} Operator.

* You have configured a large language model provider (LLM).

* A PostgresSQL database is configured and the {ols-long} Service can access the database.

.Procedure

. Open the {ols-long} `ConfigMap` file by running the following command:
+
[source,terminal]
----
$ oc edit configmap <configmap_filename>
----

. Modify the `data` property of the `ConfigMap` file to include token quota limit information.
+
.Example {ols-long} `ConfigMap` file
[source,yaml]
----
apiVersion: v1
kind: ConfigMap
metadata:
name: quota-limit
namespace: openshift-lightspeed
data:
quota_handlers.conf:
storage:
host: <IP_address> <1>
port: "5432"
dbname: <database_name>
user: <user_name>
password_path: <file_containing_database_password>
ssl_mode: disable
limiters:
- name: user_monthly_limits
type: user_limiter
initial_quota: 100000 <2>
quota_increase: 10
period: 30 days
- name: cluster_monthly_limits
type: cluster_limiter
quota_increase: 1000000 <3>
period: 30 days
scheduler:
period: 300 <4>
----
<1> Specifies the IP address for the PostgresSQL database. The database must use port `5432`.
<2> Specifies a token quota limit of 100,000 for each user over a period of 30 days.
<3> Increases the token quota limit for the cluster by 100,000 over a period of 30 days.
<4> Defines the number of seconds that the scheduler waits and then checks if the period interval is over. When the period interval is over, the scheduler stores the timestamp and resets or increases the quota limit.

. Apply the `ConfigMap` file so that the token limit quota takes effect by running the following command:
+
[source,terminal]
----
$ oc apply -f <configmap_name>
----
12 changes: 12 additions & 0 deletions modules/ols-tokens-and-token-quota-limits.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Module included in the following assemblies:
// * TBD

:_mod-docs-content-type: CONCEPT
[id="ols-tokens-and-token-quota-limits_{context}"]
= Tokens and token quota limits

Tokens are small chunks of text, which can be as small as one character or as large as one word. Tokens are the units of measurement used to quantify the amount of text that the {ols-long} Service sends to, or receives from, a large language model (LLM). Every interaction with the Service and the LLM is counted in tokens.

Token quota limits define the number of tokens that can be used in a certain timeframe. Implementing token quota limits helps control costs, encourage more efficient use of queries, and regulate system demands. In a multi-user configuration, token quota limits help provide equal access to all users ensuring everyone has an opportunity to submit queries.

You can define token quota limits for {ocp-short-name} clusters or {ocp-short-name} user accounts.