Skip to content
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

api: RequestCost configurations #103

Merged
merged 27 commits into from
Jan 18, 2025
Merged

api: RequestCost configurations #103

merged 27 commits into from
Jan 18, 2025

Conversation

mathetake
Copy link
Member

@mathetake mathetake commented Jan 16, 2025

This adds the RequestCost field to AIGatewayRoute,
which will allows users to do the rate limiting etc
based on the calculated "token usage".

This is based on the new feature introduced in

and because of the feature, the only thing we have to do
from AI Gateway side is to set a dynamic metadata as per
the comment in the API.

Signed-off-by: Takeshi Yoneda <[email protected]>
@mathetake mathetake marked this pull request as ready for review January 16, 2025 02:31
@mathetake mathetake requested a review from a team as a code owner January 16, 2025 02:31
@mathetake
Copy link
Member Author

cc @envoyproxy/ai-gateway-assignable

@mathetake
Copy link
Member Author

will do the e2e tests in another PR

api/v1alpha1/api.go Outdated Show resolved Hide resolved
Signed-off-by: Takeshi Yoneda <[email protected]>
api/v1alpha1/api.go Outdated Show resolved Hide resolved
Signed-off-by: Takeshi Yoneda <[email protected]>
Signed-off-by: Takeshi Yoneda <[email protected]>
Signed-off-by: Takeshi Yoneda <[email protected]>
@mathetake mathetake marked this pull request as draft January 17, 2025 00:28
@mathetake
Copy link
Member Author

marking as draft until all ready including tests

Signed-off-by: Takeshi Yoneda <[email protected]>
Signed-off-by: Takeshi Yoneda <[email protected]>
Signed-off-by: Takeshi Yoneda <[email protected]>
Signed-off-by: Takeshi Yoneda <[email protected]>
Signed-off-by: Takeshi Yoneda <[email protected]>
@mathetake mathetake marked this pull request as ready for review January 17, 2025 01:16
@mathetake
Copy link
Member Author

ok ready - I would like to unblock #111 so I will defer the end to end tests in a subsequent PR.

@mathetake
Copy link
Member Author

also CEL implementation is TODO as it will be a relatively large change

Comment on lines +117 to 120
for k, v := range r.Header {
fmt.Printf("header %q: %s\n", k, v)
}
if v := r.Header.Get(expectedHeadersKey); v != "" {
Copy link
Member Author

Choose a reason for hiding this comment

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

note: intentionally left as the testupstream does this elsewhere everywhere

Signed-off-by: Takeshi Yoneda <[email protected]>
api/v1alpha1/api.go Outdated Show resolved Hide resolved
@mathetake mathetake requested a review from arkodg January 17, 2025 02:01
Signed-off-by: Takeshi Yoneda <[email protected]>
Signed-off-by: Takeshi Yoneda <[email protected]>
Signed-off-by: Takeshi Yoneda <[email protected]>
Signed-off-by: Takeshi Yoneda <[email protected]>
@mathetake mathetake requested a review from yuzisun January 17, 2025 04:29
Signed-off-by: Takeshi Yoneda <[email protected]>
api/v1alpha1/api.go Outdated Show resolved Hide resolved
@mathetake mathetake requested a review from aabchoo January 17, 2025 20:30
@mathetake
Copy link
Member Author

I made it plural so that i can be used to have a separate rate limits per metrics. ptal @aabchoo @yuzisun

Signed-off-by: Takeshi Yoneda <[email protected]>
Signed-off-by: Takeshi Yoneda <[email protected]>
Signed-off-by: Takeshi Yoneda <[email protected]>
@mathetake
Copy link
Member Author

ready 🎵

@yuzisun yuzisun merged commit f4ba5cc into main Jan 18, 2025
11 checks passed
@yuzisun yuzisun deleted the requestcosts branch January 18, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants