💎 Gems
💎 GEMS: A cli, tui, and sdk for interacting with the Gemini API, allowing you to generate creative content, perform text-related tasks, and get information about supported models.
📖 Table of Contents
🚀 Installation
To install the gems
cli, use the following Cargo command:
✨ Features
- Interact with the Gemini API from the terminal.
- Generate creative content with ease.
- Stream generation of content for continuous output.
- Count the number of tokens in a text.
- Embed content into a specified model.
- Batch embed multiple contents efficiently.
- Get information about the current model and list available models.
Usage
Before using the gems
CLI, make sure to set the following environment variables:
Generate an api key from Google AI Studio.
⌨ Usage as CLI
Generate creative content:
Analyze an image and generate content from text:
Stream generation of content:
Count the number of tokens in a text:
Embed content into a specified model:
Batch embed multiple contents:
Get information about the current model:
List available models:
🎨 Options
Option | Description |
---|---|
--api-key |
Specify the API key for accessing the Gemini API. |
--model |
Specify the model to use for generating content. |
🛠 Subcommands
Subcommand | Description |
---|---|
generate |
Generate creative content. |
vision |
Analyze an image and generate content from text. |
stream |
Stream the generation of content. |
count |
Count the number of tokens in a text. |
embed |
Embed content into a specified model. |
batch |
Batch embed multiple contents. |
info |
Get information about the current model. |
list |
List available models. |
✨ Usage as Dependency
-
Add the
gems
crate:[] = "0.0.7"
-
Use the
Client
struct to interact with the Gemini API:use Client; async
📌 Examples
This repository contains a list of notebooks examples on how to use the sdk and or the cli. To use the notebooks in this repository, you need to set up your environment. Follow these steps to get started:
-
Clone the repository to your local machine:
-
Install the required dependencies and libraries. Make sure you have
Rust
,Jupyter Notebook
, andevcxr_jupyter
installed on your system.# Install a Rust toolchain (e.g. nightly): | # Install Jupyter Notebook # Install evcxr_jupyter
-
Navigate to the cloned repository and build the project:
-
Start Jupyter Notebook:
-
Access the notebooks in your web browser by clicking on the notebook file you want to explore.
ID | Example | Open on GitHub | Launch on Binder | Launch on Colab |
---|---|---|---|---|
1 | Basic | |||
2 | Rocket | |||
3 | Axum |
🤝 Contributing
Contributions and feedback are welcome! If you'd like to contribute, report an issue, or suggest an enhancement, please engage with the project on GitHub. Your contributions help improve this crate for the community.
📄 License
This project is licensed under the MIT License.