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

Update docs for ai.proto #10358

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

Update docs for ai.proto #10358

wants to merge 19 commits into from

Conversation

Rachael-Graham
Copy link

@Rachael-Graham Rachael-Graham commented Nov 15, 2024

Updates the comments in the AI gateway proto to clean up the api ref doc.
BOT NOTES:
resolves https://github.com/solo-io/docs/issues/624

@Rachael-Graham Rachael-Graham marked this pull request as ready for review November 25, 2024 16:34
@Rachael-Graham Rachael-Graham requested a review from a team as a code owner November 25, 2024 16:34
@solo-changelog-bot
Copy link

Issues linked to changelog:
https://github.com/solo-io/docs/issues/624

Copy link

github-actions bot commented Nov 25, 2024

Visit the preview URL for this PR (updated for commit d43ffee):

https://gloo-edge--pr10358-rlg-ai-proto-fjg0h6cb.web.app

(expires Tue, 03 Dec 2024 19:26:56 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 77c2b86e287749579b7ff9cadb81e099042ef677

@Rachael-Graham Rachael-Graham enabled auto-merge (squash) November 25, 2024 17:36
message SingleAuthToken {

// Passthrough the existing token. This token can either

Choose a reason for hiding this comment

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

repeating this from the comments inside auth_token_source sounds a little odd to me. The is the configuration when Passthrough is selected as the auth_token_source. It just happens to be empty now. In the future, for example, we could put the header name that contains the token here so it doesn't need to be in the Authorization header. So, maybe something along this line.

Copy link
Author

Choose a reason for hiding this comment

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

@andy-fong To make sure I'm understanding - do you prefer that I leave this field description blank here? I dont want to promise anything that we could or might put here in the future, so if anything i think i could just remove this comment. Is that what you mean?

Choose a reason for hiding this comment

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

Maybe something like this:

// Confirguration for Passthrough the existing token. Currently, the present of an empty object will indicate Passthrough is selected

projects/gloo/api/v1/enterprise/options/ai/ai.proto Outdated Show resolved Hide resolved
// Auth Token to use for the Azure OpenAI API
// This token will be placed into the `api-key` header
// The authorization token that the AI gateway uses to access the Azure OpenAI API.
// This token is automatically sent in the `api-key` header of the request.
oneof auth_token_source {

Choose a reason for hiding this comment

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

So, this is not a documentation issue but I just notice this is odd. Inside SingleAuthToken there is already a oneof auth_token_source. Here unlike the OpenAI (which I think is correct) has the oneof outside and then the oneof inside? @EItanya @npolshakova is this right?

Same for the others. If this is correct, should we change the OpenAI to match this so it's consistent?

projects/gloo/api/v1/enterprise/options/ai/ai.proto Outdated Show resolved Hide resolved
// Auth Token to use for the Gemini API
// This token will be placed into the `key` header
// The authorization token that the AI gateway uses to access the Gemini API.
// This token is automatically sent in the `key` header of the request.

Choose a reason for hiding this comment

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

The example from Gemini doc always put the key in the key qs param (like in the example above) and not the header. In our code, we do both but I cannot find any reference that Gemini api will accept the key in the key header but it's hard to find anything in the Gemini api doc. @npolshakova @EItanya can you confirm this is correct?

Choose a reason for hiding this comment

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

Yep, for Gemini (not Vertex-AI) you need to pass the API token in query param. For vertex ai, you need the authorization token in the header.

projects/gloo/api/v1/enterprise/options/ai/ai.proto Outdated Show resolved Hide resolved
projects/gloo/api/v1/enterprise/options/ai/ai.proto Outdated Show resolved Hide resolved
message OpenAI {
oneof auth_token_source {
// The authorization token that the AI gateway uses to access the OpenAI API.
// This token is automatically sent in the `Authorization` header of the
// request and prefixed with `Bearer`.
SingleAuthToken auth_token = 1;
// re-use the token from the backend
// google.protobuf.Empty inherit_backend_token = 3;
}

Choose a reason for hiding this comment

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

@EItanya do we need a way to specify the model here?

uint32 grpc_port = 3;
// Whether or not to use a secure connection, true by default
// Whether to use a secure connection. Defaults to `true`.

Choose a reason for hiding this comment

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

This is a bit confusing and a bit against the convention where the default is always 0, "" or false. In the code, I also do not find where we set this to true by default (maybe I missed it). Maybe the original comment means secure connection by default? @EItanya can you confirm?

Also, it looks like this setting applies to both the http and grpc connections.

message Webhook {
// Host to send the traffic to.
string host = 1;
// Port to send the traffic to
uint32 port = 2;
// Describes how to match a given string in HTTP headers. Match is case-sensitive.

Choose a reason for hiding this comment

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

Not a document issue. case-sensitive will never work because HTTP/1 can be camel case but HTTP/2 is always lower case. Also, envoy lower case the header before sending to ext_proc, so the user really need to enter all lower case here for it to work. So, case-sensitive match is incorrect. HTTP header name should be case-insensitive. Should we open an issue to fix this, @EItanya

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants