-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
rh-tokeefe
wants to merge
1
commit into
openshift:lightspeed-docs-main
Choose a base branch
from
rh-tokeefe:OLS-1622
base: lightspeed-docs-main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
.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> | ||
---- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 theConfigMap
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?
There was a problem hiding this comment.
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>