Skip to content

api: RequestCost configurations#103

Merged
yuzisun merged 27 commits intomainfrom
requestcosts
Jan 18, 2025
Merged

api: RequestCost configurations#103
yuzisun merged 27 commits intomainfrom
requestcosts

Conversation

@mathetake
Copy link
Copy Markdown
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 <t.y.mathetake@gmail.com>
@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
Copy Markdown
Member Author

cc @envoyproxy/ai-gateway-assignable

@mathetake
Copy link
Copy Markdown
Member Author

will do the e2e tests in another PR

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
@mathetake mathetake marked this pull request as draft January 17, 2025 00:28
@mathetake
Copy link
Copy Markdown
Member Author

marking as draft until all ready including tests

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
@mathetake mathetake marked this pull request as ready for review January 17, 2025 01:16
@mathetake
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

@mathetake mathetake requested a review from arkodg January 17, 2025 02:01
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
@mathetake mathetake requested a review from yuzisun January 17, 2025 04:29
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
@mathetake mathetake requested a review from aabchoo January 17, 2025 20:30
@mathetake
Copy link
Copy Markdown
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 <t.y.mathetake@gmail.com>
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
@mathetake
Copy link
Copy Markdown
Member Author

ready 🎵

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
@yuzisun yuzisun merged commit f4ba5cc into main Jan 18, 2025
@yuzisun yuzisun deleted the requestcosts branch January 18, 2025 18:04
mathetake added a commit that referenced this pull request Jan 25, 2025
This commit implements the CEL expression API
left as a TODO in #103. Closes #97.

---------

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Co-authored-by: Dan Sun <dsun20@bloomberg.net>
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