-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1064042
commit 58e6c3b
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<small> | ||
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱ Vertex AI | ||
</small> | ||
|
||
# Vertex AI (preview) | ||
|
||
The Vertex AI Gemini API gives you access to the latest generative AI models from Google: the Gemini models. | ||
|
||
[Learn more](https://firebase.google.com/docs/vertex-ai) | ||
|
||
## Dependency Injection | ||
|
||
As a prerequisite, ensure that `AngularFire` has been added to your project via | ||
```bash | ||
ng add @angular/fire | ||
``` | ||
|
||
Provide a Vertex AI instance in the application's `app.config.ts`: | ||
|
||
```ts | ||
import { provideFirebaseApp, initializeApp } from '@angular/fire/app'; | ||
import { provideVertexAI, getVertexAI } from '@angular/fire/vertexai-preview'; | ||
|
||
export const appConfig: ApplicationConfig = { | ||
providers: [ | ||
provideFirebaseApp(() => initializeApp({ ... })), | ||
provideVertexAI(() => getVertexAI()), | ||
... | ||
], | ||
..., | ||
} | ||
``` | ||
|
||
Next inject `VertexAI` into your component: | ||
|
||
```typescript | ||
import { Component, inject } from '@angular/core'; | ||
import { VertexAI } from '@angular/fire/vertexai-preview'; | ||
|
||
@Component({ ... }) | ||
export class MyComponent { | ||
private vertexAI = inject(VertexAI); | ||
... | ||
} | ||
``` | ||
|
||
## Firebase API | ||
|
||
AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API. | ||
|
||
Update the imports from `import { ... } from 'firebase/vertexai-preview'` to `import { ... } from '@angular/fire/vertexai-preview'` and follow the official documentation. | ||
|
||
[Getting Started](https://firebase.google.com/docs/vertex-ai/get-started?platform=web) | [API Reference](https://firebase.google.com/docs/reference/js/vertexai-preview) |