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

Adds EP-10494: AI APIs enhancement proposal #10495

Merged

Conversation

npolshakova
Copy link
Contributor

Description

Adds Enhancement Proposal 10494 that proposes adding AI Gateway APIs support.

Supports #10494

Initial APIs can be found in this draft PR: #10493

Copy link
Contributor

@EItanya EItanya left a comment

Choose a reason for hiding this comment

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

This proposal LGTM

@npolshakova npolshakova requested a review from linsun January 28, 2025 21:57
@npolshakova
Copy link
Contributor Author

@linsun / @yuval-k can I get another review?

@npolshakova npolshakova requested a review from lgadban January 31, 2025 16:29
@npolshakova npolshakova mentioned this pull request Feb 6, 2025
4 tasks
spec:
ai:
vertexAi:
model: gemini-1.5-flash-001
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we mention what would happen if the URL or the request body contains the model value that's not the same as the model value in the Upstream?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, I'll add a sentence about if the model is not provided as well. We use the Upstream in the case of a mismatch, right?

@npolshakova npolshakova force-pushed the add-ai-api-enhancement-proposal branch from 3ab7979 to b1fe48b Compare February 12, 2025 20:46
@npolshakova npolshakova mentioned this pull request Feb 14, 2025
4 tasks
name: openai-secret
```

Notice that this Upstream does not specify a model, so kgateway will use the model value in the request to determine
Copy link
Contributor

Choose a reason for hiding this comment

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

kgateway will use the model value in the request

What does this mean? Might be worth elaborating here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can add a specific request example in a follow up, but for context this field isn't strictly required:

spec:
  ai:
    openai:
      model: my-model

You can specify a model in the request body instead, but if you specify both the Upstream will win out. (This additional note is more implementation detail, but was request in an earlier review to clarify the behavior)

Copy link
Contributor

Choose a reason for hiding this comment

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

Right but my question is how is it specified in the request body?

Comment on lines +168 to +173
filters:
- type: ExtensionRef
extensionRef:
group: gateway.kgateway.dev/v1alpha1
kind: RoutePolicy
name: open-ai-opt
Copy link
Contributor

Choose a reason for hiding this comment

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

Prefer using targetRef attachment on the RoutePolicy rather than ExtensionRef?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See the comment:

Note: For the first implementation, a RoutePolicy must be applied to a specific route in the HTTPRoute using an `extensionRef`.
Initially it's easier to only support extension ref for the first pass because it's a little trickier to confirm all the routes are AI Upstream types in the new plugin system. targetRef support will be added later if there's a specific use case for it.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is worrying because ExtensionRef is effectively redundant given named route rules.
I think we'll want to consider this as important for the plugin system if things are easier to express as ExtensionRefs instead of via policy attachment.
cc @yuval-k

Copy link
Contributor

@EItanya EItanya left a comment

Choose a reason for hiding this comment

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

These changes make sense to me

@npolshakova npolshakova added this pull request to the merge queue Feb 17, 2025
Merged via the queue into kgateway-dev:main with commit ab7a32c Feb 17, 2025
9 checks passed
@npolshakova npolshakova deleted the add-ai-api-enhancement-proposal branch February 17, 2025 22:56
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.

6 participants