-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Vertex AI] Test SDK with v1
API instead of v1beta
#14345
Conversation
/gemini summary |
Summary of ChangesThis pull request is for testing the Vertex AI SDK with the Highlights
Changelog
Activity
|
/gemini review |
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.
Code Review
This pull request updates the Vertex AI SDK to use the v1
API instead of v1beta
. The changes include updating the base URL and API version, as well as adding new integration tests. The code appears to be well-written and the changes are straightforward. I have provided some minor feedback in the review comments. Please address these comments and have others review and approve this code before merging.
Summary of Findings
- Test Naming: Consider renaming the test function
testGenerateContent
totestGenerateContent_text
for clarity and consistency with other test names. - XCTFail Message: Enhance the
XCTFail
messages in the test functions to provide more context about the expected vs. actual results.
Assessment
The pull request updates the Vertex AI SDK to use the v1
API instead of v1beta
. The changes include updating the base URL and API version, as well as adding new integration tests. The code appears to be well-written and the changes are straightforward. I have provided some minor feedback in the review comments. Please address these comments and have others review and approve this code before merging.
@@ -17,7 +17,7 @@ import Foundation | |||
/// Constants associated with the Vertex AI for Firebase SDK. | |||
enum Constants { | |||
/// The Vertex AI backend endpoint URL. | |||
static let baseURL = "https://firebasevertexai.googleapis.com" | |||
static let baseURL = "https://staging-firebasevertexai.sandbox.googleapis.com" |
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.
@@ -31,7 +31,7 @@ public struct RequestOptions { | |||
let timeout: TimeInterval | |||
|
|||
/// The API version to use in requests to the backend. | |||
let apiVersion = "v1beta" | |||
let apiVersion = "v1" |
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.
|
||
do { | ||
let response = try await model.generateContent(fileData, "What color is this?") | ||
XCTFail("Expected to throw an error, got response: \(response)") |
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.
Enhance the XCTFail
message to provide more context about the expected vs. actual results. For example, include the error that was caught.
XCTFail("Expected to throw an error, got response: \(response)") | |
XCTFail("Expected to throw an error, got response: \(response), error: \(error)") |
_ = try await model.generateContent(prompt) | ||
XCTFail("Expected a Firebase App Check error; none thrown.") | ||
let response = try await model.generateContent(prompt) | ||
XCTFail("Expected a Firebase App Check error, got response: \(response)") |
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.
Enhance the XCTFail
message to provide more context about the expected vs. actual results. For example, include the error that was caught.
XCTFail("Expected a Firebase App Check error, got response: \(response)") | |
XCTFail("Expected a Firebase App Check error, got response: \(response), error: \(error)") |
for try await response in contentStream { | ||
responses.append(response) | ||
} | ||
XCTFail("Expected to throw an error, got response(s): \(responses)") |
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.
Enhance the XCTFail
message to provide more context about the expected vs. actual results. For example, include the error that was caught.
XCTFail("Expected to throw an error, got response(s): \(responses)") | |
XCTFail("Expected to throw an error, got response(s): \(responses), error: \(error)") |
_ = try await model.countTokens(fileData) | ||
XCTFail("Expected to throw an error.") | ||
let response = try await model.countTokens(fileData) | ||
XCTFail("Expected to throw an error, got response: \(response)") |
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.
Enhance the XCTFail
message to provide more context about the expected vs. actual results. For example, include the error that was caught.
XCTFail("Expected to throw an error, got response: \(response)") | |
XCTFail("Expected to throw an error, got response: \(response), error: \(error)") |
_ = try await model.countTokens(prompt) | ||
XCTFail("Expected a Firebase App Check error; none thrown.") | ||
let response = try await model.countTokens(prompt) | ||
XCTFail("Expected a Firebase App Check error, got response: \(response)") |
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.
Enhance the XCTFail
message to provide more context about the expected vs. actual results. For example, include the error that was caught.
XCTFail("Expected a Firebase App Check error, got response: \(response)") | |
XCTFail("Expected a Firebase App Check error, got response: \(response), error: \(error)") |
Do not merge. Testing the Vertex AI SDK with the
v1
version of the API (instead ofv1beta
).#no-changelog