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

[Vertex AI] Add README for unit test mock files #13233

Merged
merged 3 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions FirebaseVertexAI/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,25 @@ ways.

- For developer documentation, please visit https://firebase.google.com/docs/vertex-ai.
- Try out the [sample app](Sample/README.md) to get started.

## Development

After following the Swift Package Manager
[setup instructions](https://github.com/firebase/firebase-ios-sdk#swift-package-manager-1),
choose the `FirebaseVertexAI-Preview` scheme to build the SDK.

### Unit Tests

> [!IMPORTANT]
> These unit tests require mock response files, which can be downloaded by
running `scripts/update_vertexai_responses.sh` from the root of this repository.

Choose the `FirebaseVertexAIUnit` scheme to build and run the unit tests.

#### Updating Mock Responses

To update the mock responses, create a PR in the
[`vertexai-sdk-test-data`](https://github.com/FirebaseExtended/vertexai-sdk-test-data)
repo. After it is merged, re-run the
[script](https://github.com/firebase/firebase-ios-sdk/blob/main/scripts/update_vertexai_responses.sh)
above to download the updated files.
3 changes: 3 additions & 0 deletions FirebaseVertexAI/Tests/Unit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
See the Vertex AI for Firebase
[README](https://github.com/firebase/firebase-ios-sdk/tree/main/FirebaseVertexAI#unit-tests)
for required setup instructions.
3 changes: 3 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,9 @@ let package = Package(
path: "FirebaseVertexAI/Tests/Unit",
resources: [
.process("vertexai-sdk-test-data/mock-responses"),
// Including this README ensures that SPM will always generate a `Bundle.module`, even if
// the mock-responses have not been downloaded with the update_vertexai_responses.sh script.
.process("README.md"),
],
cSettings: [
.headerSearchPath("../../../"),
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,10 @@ at **Project Settings > Cloud Messaging > [Your Firebase App]**.
The iOS Simulator cannot register for remote notifications and will not receive push notifications.
To receive push notifications, follow the steps above and run the app on a physical device.

### Firebase Vertex AI
The Firebase Vertex AI unit tests require mock response files, which can be downloaded by running `./scripts/update_vertexai_responses.sh`.
### Vertex AI for Firebase

See the [Vertex AI for Firebase README](FirebaseVertexAI#development) for
instructions about building and testing the SDK.

## Building with Firebase on Apple platforms

Expand Down
4 changes: 4 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ Test QuickStart with the zip distribution.

Script to add a file to an Xcode target.

### [update_vertexai_responses.sh](https://github.com/firebase/firebase-ios-sdk/blob/main/scripts/update_vertexai_responses.sh)

Downloads mock response files for Vertex AI unit tests.

### [xcresult_logs.py](https://github.com/firebase/firebase-ios-sdk/blob/main/scripts/xcresult_logs.py)

Tooling used by `build.sh` to get the log output for an `xcodebuild` invocation.
Expand Down
Loading