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

VertexAI docs #3530

Merged
merged 2 commits into from
May 15, 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
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)
Loading