{"id":18886633,"url":"https://github.com/kevin-rs/gems","last_synced_at":"2025-04-14T21:31:10.676Z","repository":{"id":225502992,"uuid":"766148927","full_name":"kevin-rs/gems","owner":"kevin-rs","description":"💎 A cli, tui, and sdk for interacting with the Gemini API (WIP)","archived":false,"fork":false,"pushed_at":"2024-06-24T03:14:56.000Z","size":133,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-09T02:23:59.237Z","etag":null,"topics":["clap","clap-rs","cli","gemini","gemini-api","gemini-pro","gemini-vision-pro","generative-ai","google","gpt","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/gems","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kevin-rs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-03-02T13:27:03.000Z","updated_at":"2024-04-18T16:19:53.000Z","dependencies_parsed_at":"2024-04-06T13:43:21.691Z","dependency_job_id":null,"html_url":"https://github.com/kevin-rs/gems","commit_stats":null,"previous_names":["wiseaidev/gems","kevin-rs/gems"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevin-rs%2Fgems","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevin-rs%2Fgems/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevin-rs%2Fgems/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevin-rs%2Fgems/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevin-rs","download_url":"https://codeload.github.com/kevin-rs/gems/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223647582,"owners_count":17179287,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clap","clap-rs","cli","gemini","gemini-api","gemini-pro","gemini-vision-pro","generative-ai","google","gpt","rust"],"created_at":"2024-11-08T07:29:22.875Z","updated_at":"2025-04-14T21:31:10.667Z","avatar_url":"https://github.com/kevin-rs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 💎 Gems\n\n[![Crates.io](https://img.shields.io/crates/v/gems.svg)](https://crates.io/crates/gems)\n[![docs](https://docs.rs/gems/badge.svg)](https://docs.rs/gems/)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\n\u003e 💎 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.\n\n## 📖 Table of Contents\n\n- [Installation](#-installation)\n- [Features](#-features)\n- [Usage](#-usage-as-cli)\n- [Options](#-options)\n- [Subcommands](#-subcommands)\n- [Examples](#-examples)\n- [Contributing](#-contributing)\n- [License](#-license)\n\n## 🚀 Installation\n\nTo install the `gems` cli, use the following Cargo command:\n\n```bash\ncargo install --locked gems --all-features\n```\n\n## ✨ Features\n\n- Interact with the Gemini API from the terminal.\n- Generate creative content with ease.\n- Stream generation of content for continuous output.\n- Count the number of tokens in a text.\n- Embed content into a specified model.\n- Batch embed multiple contents efficiently.\n- Get information about the current model and list available models.\n\n## Usage\n\nBefore using the `gems` CLI, make sure to set the following environment variables:\n\n```bash\nexport GEMINI_API_KEY=\u003cyour_gemini_api_key\u003e\nexport GEMINI_MODEL=\u003cyour_gemini_model\u003e\n```\n\nGenerate an api key from [Google AI Studio](https://aistudio.google.com/app/apikey).\n\n## ⌨ Usage as CLI\n\n### Generate creative content:\n\n```sh\ngems generate -t \"Hello\"\n```\n\n### Analyze an image and generate content from text:\n\n```sh\ncurl -o image.jpg https://storage.googleapis.com/generativeai-downloads/images/scones.jpg\n\ngems vision -i image.jpg\n\ngems vision -i image.jpg -t \"What's in the image?\"\n```\n\n### Stream generation of content:\n\n```sh\ngems stream -t \"Generate a short fictional story\"\n```\n\n### Count the number of tokens in a text:\n\n```sh\ngems count -t \"Hello There!\"\n```\n\n### Embed content into a specified model:\n\n```sh\ngems embed -t \"Write a story about a magic backpack.\"\n```\n\n### Batch embed multiple contents:\n\n```sh\ngems batch -t \"Write a story about a magic backpack.\",\"Generate a poem about nature.\"\n```\n\n### Get information about the current model:\n\n```sh\ngems info\n```\n\n### List available models:\n\n```sh\ngems list\n```\n\n### Generate an Image\n\n```sh\ngems imagen -t \"Hi, can you create a 3d rendered image of a pig with wings and a top hat flying over a happy futuristic scifi city with lots of greenery?\"\n```\n\n## 🎨 Options\n\n| Option                   | Description                                              |\n|--------------------------|----------------------------------------------------------|\n| `--api-key`              | Specify the API key for accessing the Gemini API.        |\n| `--model`                | Specify the model to use for generating content.         |\n\n\n## 🛠 Subcommands\n\n| Subcommand              | Description                                              |\n|-------------------------|----------------------------------------------------------|\n| `generate`              | Generate creative content.                               |\n| `vision`                | Analyze an image and generate content from text.         |\n| `stream`                | Stream the generation of content.                        |\n| `imagen`                | Generate an image.                                       |\n| `count`                 | Count the number of tokens in a text.                    |\n| `embed`                 | Embed content into a specified model.                    |\n| `batch`                 | Batch embed multiple contents.                           |\n| `info`                  | Get information about the current model.                 |\n| `list`                  | List available models.                                   |\n\n\n## ✨ Usage as Dependency\n\n\n1. Add the `gems` crate:\n\n   ```toml\n   [dependencies]\n   gems = \"0.1.1\"\n   ```\n\n1. Use the `Client` struct to interact with the Gemini API:\n\n   ```rust\n   use gems::Client;\n   use gems::traits::CTrait;\n   use gems::messages::Content;\n   use gems::messages::Message;\n   use gems::models::Model;\n   use gems::chat::ChatBuilder;\n   use anyhow::Result;\n\n   #[tokio::main]\n   async fn main() -\u003e Result\u003c()\u003e {\n        let mut gemini_client = Client::builder().model(\"your-model\").build()?;\n\n        gemini_client.set_api_key(\"your-api-key\".to_string());\n\n      let parameters = ChatBuilder::default()\n          .model(Model::Flash20)\n          .messages(vec![Message::User {\n              content: Content::Text(\"Hello\".to_string()),\n              name: None,\n          }])\n          .build()?;\n\n       match gemini_client.chat().generate(parameters).await {\n           Ok(response) =\u003e {\n               println!(\"{}\", response);\n           }\n           Err(err) =\u003e {\n               eprintln!(\"Error: {:?}\", err);\n           }\n       }\n\n       Ok(())\n   }\n   ```\n\n## 📌 Examples\n\nThis 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:\n\n1. Clone the repository to your local machine:\n\n   ```sh\n   git clone https://github.com/kevin-rs/gems.git\n   ```\n\n1. Install the required dependencies and libraries. Make sure you have [`Rust`](https://rustup.rs/), [`Jupyter Notebook`](https://jupyter.org/install), and [`evcxr_jupyter`](https://github.com/evcxr/evcxr/blob/main/evcxr_jupyter/README.md) installed on your system.\n\n   ```sh\n   # Install a Rust toolchain (e.g. nightly):\n   curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly\n \n   # Install Jupyter Notebook\n   pip install notebook\n \n   # Install evcxr_jupyter\n   cargo install evcxr_jupyter\n   evcxr_jupyter --install \n   ```\n\n1. Navigate to the cloned repository and build the project:\n\n   ```sh\n   cd gems\n   cargo build --release --all-features\n   ```\n\n1. Start Jupyter Notebook:\n\n   ```sh\n   jupyter notebook\n   ```\n\n1. Access the notebooks in your web browser by clicking on the notebook file you want to explore.\n\n| ID | Example | Open on GitHub | Launch on Binder | Launch on Colab |\n|----|---------------|-----------|:-------------|-------------|\n| 1  | **Basic** | [![Github](https://img.shields.io/badge/launch-Github-181717.svg?logo=github\u0026logoColor=white)](./examples/basic.ipynb) | [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/kevin-rs/gems/main?filepath=examples/basic.ipynb) |  [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/kevin-rs/gems/blob/main/examples/basic.ipynb) |\n| 2  | **Rocket** | [![Github](https://img.shields.io/badge/launch-Github-181717.svg?logo=github\u0026logoColor=white)](./examples/rocket.ipynb) | [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/kevin-rs/gems/main?filepath=examples/rocket.ipynb) |  [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/kevin-rs/gems/blob/main/examples/rocket.ipynb) |\n| 3  | **Axum** | [![Github](https://img.shields.io/badge/launch-Github-181717.svg?logo=github\u0026logoColor=white)](./examples/axum.ipynb) | [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/kevin-rs/gems/main?filepath=examples/axum.ipynb) |  [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/kevin-rs/gems/blob/main/examples/axum.ipynb) |\n\n## 🤝 Contributing\n\nContributions and feedback are welcome! If you'd like to contribute, report an issue, or suggest an enhancement, please engage with the project on [GitHub](https://github.com/kevin-rs/gems). Your contributions help improve this crate for the community.\n\n## 📄 License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevin-rs%2Fgems","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevin-rs%2Fgems","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevin-rs%2Fgems/lists"}