Skip to content

Commit 58e6c3b

Browse files
authoredMay 15, 2024··
VertexAI docs (#3530)
1 parent 1064042 commit 58e6c3b

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
 

‎README.md

+10
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,14 @@ import { } from '@angular/fire/app-check';
190190
```
191191
</td>
192192
</tr>
193+
<tr>
194+
<td>
195+
196+
#### [Vertex AI](docs/vertexai.md#vertex-ai-preview)
197+
```ts
198+
import { } from '@angular/fire/vertexai-preview';
199+
```
200+
</td>
201+
202+
</tr>
193203
</table>

‎docs/vertexai.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<small>
2+
<a href="https://github.com/angular/angularfire">AngularFire</a> &#10097; <a href="../README.md#developer-guide">Developer Guide</a> &#10097; Vertex AI
3+
</small>
4+
5+
# Vertex AI (preview)
6+
7+
The Vertex AI Gemini API gives you access to the latest generative AI models from Google: the Gemini models.
8+
9+
[Learn more](https://firebase.google.com/docs/vertex-ai)
10+
11+
## Dependency Injection
12+
13+
As a prerequisite, ensure that `AngularFire` has been added to your project via
14+
```bash
15+
ng add @angular/fire
16+
```
17+
18+
Provide a Vertex AI instance in the application's `app.config.ts`:
19+
20+
```ts
21+
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
22+
import { provideVertexAI, getVertexAI } from '@angular/fire/vertexai-preview';
23+
24+
export const appConfig: ApplicationConfig = {
25+
providers: [
26+
provideFirebaseApp(() => initializeApp({ ... })),
27+
provideVertexAI(() => getVertexAI()),
28+
...
29+
],
30+
...,
31+
}
32+
```
33+
34+
Next inject `VertexAI` into your component:
35+
36+
```typescript
37+
import { Component, inject } from '@angular/core';
38+
import { VertexAI } from '@angular/fire/vertexai-preview';
39+
40+
@Component({ ... })
41+
export class MyComponent {
42+
private vertexAI = inject(VertexAI);
43+
...
44+
}
45+
```
46+
47+
## Firebase API
48+
49+
AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API.
50+
51+
Update the imports from `import { ... } from 'firebase/vertexai-preview'` to `import { ... } from '@angular/fire/vertexai-preview'` and follow the official documentation.
52+
53+
[Getting Started](https://firebase.google.com/docs/vertex-ai/get-started?platform=web) | [API Reference](https://firebase.google.com/docs/reference/js/vertexai-preview)

0 commit comments

Comments
 (0)
Please sign in to comment.