Skip to content

Commit

Permalink
VertexAI docs (#3530)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdaniels authored May 15, 2024
1 parent 1064042 commit 58e6c3b
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,14 @@ import { } from '@angular/fire/app-check';
```
</td>
</tr>
<tr>
<td>

#### [Vertex AI](docs/vertexai.md#vertex-ai-preview)
```ts
import { } from '@angular/fire/vertexai-preview';
```
</td>

</tr>
</table>
53 changes: 53 additions & 0 deletions docs/vertexai.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<small>
<a href="https://github.com/angular/angularfire">AngularFire</a> &#10097; <a href="../README.md#developer-guide">Developer Guide</a> &#10097; 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)

0 comments on commit 58e6c3b

Please sign in to comment.