-
Notifications
You must be signed in to change notification settings - Fork 560
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
add an experimental gemini call to the backend #2974
Conversation
Looks like we need to fiddle with the package versions on main: https://github.com/dart-lang/dart-pad/actions/runs/9354896383/job/25748806872?pr=2974 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as any client calling the API as many times as they'd like is not a concern, looks good to me.
Do wait for John to take a look too :D
} | ||
|
||
// Only allow the call from known clients / endpoints. | ||
const firebaseHostAddress = '199.36.158.100'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be the address used if calling from a Firebase-hosted cloud function or similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I don't know.
This IP is often (always?) the address for firebase hosted web apps (though, this may or may not always be true with custom domains).
Fair to say that this check has some room for improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An update here - after an in-person discussion w/ @johnpryan, I switched to checking that the request origin is https://dartpad.dev
.
Co-authored-by: Parker Lougheed <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as any client calling the API as many times as they'd like is not a concern, looks good to me.
We could put some call throttling in perhaps. I'm not committed to this particular impl., but do like the idea of experimenting against a live backend. If we see usage issues (way too much, ...) we can always remove the API / otherwise pivot.
} | ||
|
||
// Only allow the call from known clients / endpoints. | ||
const firebaseHostAddress = '199.36.158.100'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I don't know.
This IP is often (always?) the address for firebase hosted web apps (though, this may or may not always be true with custom domains).
Fair to say that this check has some room for improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Add an experimental gemini call to the backend:
GOOGLE_API_KEY
will need to be configured in the cloud serving infragemini-1.5-flash-latest
modelContribution guidelines:
dart format
.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.