Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Support Google Gemini through AI Studio#62927

Merged
rafax merged 14 commits into
mainfrom
rg/gemini
May 27, 2024
Merged

Support Google Gemini through AI Studio#62927
rafax merged 14 commits into
mainfrom
rg/gemini

Conversation

@rafax

@rafax rafax commented May 27, 2024

Copy link
Copy Markdown
Contributor

This PR adds support for Google Gemini models as exposed by AI Studio API.
Slack context.

Closes AI-50.

Test plan

  • tested locally
  • e2e tests

@cla-bot cla-bot Bot added the cla-signed label May 27, 2024
@rafax rafax requested review from a team May 27, 2024 13:16
@rafax rafax marked this pull request as ready for review May 27, 2024 13:17
Comment thread cmd/cody-gateway/shared/config/config.go Outdated
type upstreamHandlerMethods[ReqT UpstreamRequest] interface {
// getAPIURLByFeature returns the upstream API endpoint to call for the given feature.
getAPIURLByFeature(codygateway.Feature) string
getAPIURL(codygateway.Feature, ReqT) string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see that the implementations of this method always ignore the second parameter, except the new GoogleHandler, but that only uses req.ShouldStream() (a bool) and req.Model (a string).
It feels meh. But the best alternative I could come up with it to use the feature argument and concat the two values as a string with some separator, but that's even uglier. So 👍 , just wanted to note that I thought about it and ack that this is the best solution we found without major changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

UpstreamRequest only has 3 properties (GetModel() ShouldStream() and BuildPrompt(), so I decided that Google using 2/3 is close enough to pass the whole request.

@vdavid vdavid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks 👌

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants