Here’s the updated README.md
with the addition of the gemini-embeddings.js
script:
MY-AI-APP is a Node.js application that leverages Google Generative AI's Gemini model to perform various tasks such as text generation, streaming responses, multi-model interactions, and more. The project includes multiple scripts that demonstrate different ways to interact with the Gemini model, allowing users to create, manage, and customize AI-driven tasks.
-
Clone the repository:
git clone https://github.com/your-username/my-ai-app.git
-
Navigate to the project directory:
cd my-ai-app
-
Install dependencies:
npm install
-
Configure environment variables:
-
Create a
.env
file in the root directory. -
Add your Google Generative AI API key:
API_KEY=your-google-generative-ai-api-key
-
Facilitates an interactive chat with the Gemini-1.5-Flash model. It loads API configurations, handles user input, and displays AI responses in the console. The chat session continues until 'exit' is entered.
Usage:
node gemini-chat.js
Utilizes the Google Generative AI API to generate text from provided images. It initializes the API client with your key, converts images for the Gemini-1.5-Flash model, and logs the generated text to the console.
Usage:
node gemini-multi-model.js
The main entry point for initializing and starting AI operations. It provides a basic framework to kickstart AI-driven processes.
Usage:
node gemini-start.js
Enables real-time text-based chat with the Gemini-1.5-Flash model. It initializes the AI client, uses readline for user input, and streams AI responses live. The chat continues until 'exit' is typed.
Usage:
node gemini-streaming.js
Uses the Google Generative AI API to create a rhyming sonnet about a programmer's life. It initializes the client with your API key, uses the "gemini-1.5-flash" model, and logs the generated sonnet to the console.
Usage:
node gemini-text-to-text.js
Generates embeddings for a given text using the "text-embedding-004" model. It initializes the AI client, generates the embeddings, and logs the resulting values to the console.
Usage:
node gemini-embeddings.js
- Run any of the provided scripts using Node.js, ensuring that your API key is correctly set up in the
.env
file. - Customize the scripts according to your specific use case by modifying the prompts, models, or additional configurations.
Feel free to explore the repository and dive into the various AI interactions and use cases provided. If you have any questions or suggestions, don't hesitate to reach out. Happy coding! 🚀