Skip to content

Commit

Permalink
[Vertex AI] Test SDK with v1 API instead of v1beta
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewheard committed Jan 14, 2025
1 parent b756d39 commit 8ef93d3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion FirebaseVertexAI/Sources/GenerativeAIRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"

/// Initializes a request options object.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ final class IntegrationTests: XCTestCase {
XCTAssertEqual(text, "Mountain View")
}

func testGenerateContentStream() async throws {
let prompt = "Where is Google headquarters located? Answer with the city name only."

var text = ""
let contentStream = try model.generateContentStream(prompt)
for try await chunk in contentStream {
text += try XCTUnwrap(chunk.text)
}

text = text.trimmingCharacters(in: .whitespacesAndNewlines)
XCTAssertEqual(text, "Mountain View")
}

func testGenerateContent_appCheckNotConfigured_shouldFail() async throws {
let app = try FirebaseApp.defaultNamedCopy(name: TestAppCheckProviderFactory.notConfiguredName)
addTeardownBlock { await app.delete() }
Expand Down

0 comments on commit 8ef93d3

Please sign in to comment.