diff --git a/docs/ai/usage/index.md b/docs/ai/usage/index.md new file mode 100644 index 0000000000..d80d7bb5ba --- /dev/null +++ b/docs/ai/usage/index.md @@ -0,0 +1,440 @@ +--- +title: AI Logic +description: Installation and getting started with Firebase AI Logic. +icon: //static.invertase.io/assets/social/firebase-logo.png +next: /analytics/usage +previous: /remote-config/usage +--- + +# Installation + +This module requires that the `@react-native-firebase/app` module is already setup and installed. To install the "app" module, view the +[Getting Started](/) documentation. + +```bash +# Install & setup the app module +yarn add @react-native-firebase/app + +# Install the ai module +yarn add @react-native-firebase/ai +``` + +# What does it do + +Firebase AI Logic gives you access to the latest generative AI models from Google. + +If you need to call the Gemini API directly from your mobile or web app — rather than server-side — you can use the Firebase AI Logic client SDKs. These client SDKs are built specifically for use with mobile and web apps, offering security options against unauthorized clients as well as integrations with other Firebase services. + +# Usage + +## Generate text from text-only input + +You can call the Gemini API with input that includes only text. For these calls, you need to use a model that supports text-only prompts (like Gemini 1.5 Pro). + +Use `generateContent()` which waits for the entire response before returning. + +```js +import React from 'react'; +import { AppRegistry, Button, Text, View } from 'react-native'; +import { getApp } from '@react-native-firebase/app'; +import { getAI, getGenerativeModel } from '@react-native-firebase/ai'; + +function App() { + return ( + +