Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dsdanielpark committed May 20, 2024
2 parents 13e7971 + cd9b8b5 commit 4eace28
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 31 deletions.
80 changes: 50 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,29 @@ On the official side, Google provides partially free, clean [official Gemini API
## Contents

- [ Gemini API ](#-gemini-api---)
- [What is Gemini? 🔐](#what-is-gemini)
- [Installation ✅](#installation-)
- [Authentication ✅](#authentication)
- [Quick Start ✅](#quick-start)
- [Usage](#usage)
- [# 01. Initialization ✅](#-01-initialization)
- [# 02. Generate content](#-02-generate-content)
- [# 03. Send request](#-03-send-request)
- [# 04. Text generation](#-04-text-generation)
- [# 05. Image generation](#-05-image-generation)
- [# 06. Retrieving Images from Gemini Responses](#-06-retrieving-images-from-gemini-responses)
- [# 07. Generate content from images](#-07-generate-content-from-images)
- [# 08. Generate content using Google Services](#-08-generate-content-using-google-services)
- [# 09. Fix context setting RCID](#-09-fix-context-setting-rcid)
- [# 10. Changing the Selected Response from 0 to *n*](#-10-changing-the-selected-response-from-0-to-n)
- [# 11. Generate custom content](#-11-generate-custom-content)
- [Further](#further)
- [Google Open-source LLMs](#google-open-source-llms)
- [What is Gemini? 🔒](#what-is-gemini)
- [What is Python-Gemini-API? 🔐](#what-is-python-gemini-api)
- [Installation ✅](#installation-)
- [Authentication ✅](#authentication)
- [Quick Start ✅](#quick-start)
- [Usage](#usage)
- [# 01. Initialization ✅](#-01-initialization)
- [# 02. Generate content](#-02-generate-content)
- [# 03. Send request](#-03-send-request)
- [# 04. Text generation](#-04-text-generation)
- [# 05. Image generation](#-05-image-generation)
- [# 06. Retrieving Images from Gemini Responses](#-06-retrieving-images-from-gemini-responses)
- [# 07. Generate content from images](#-07-generate-content-from-images)
- [# 08. Generate content using Google Services](#-08-generate-content-using-google-services)
- [# 09. Fix context setting RCID](#-09-fix-context-setting-rcid)
- [# 10. Changing the Selected Response from 0 to *n*](#-10-changing-the-selected-response-from-0-to-n)
- [# 11. Generate custom content](#-11-generate-custom-content)
- [Further](#further)
- [Google Proprietary LLM, Gemini 🔒](#google-proprietary-llm-gemini)
- [Google Open-source LLMs 🤝](#google-open-source-llms)
- [Open-source LLM, Gemma 🤝](#open-source-llm-gemma)
- [Open-source LLM, Code Gemma 🤝](#open-source-llm-code-gemma)
- [Utilize free open-source LLM API through Open Router ✅](#utilize-free-open-source-llm-api-through-open-router)
- [Utilize free open-source LLM API through Open Router 🤝 ](#utilize-free-open-source-llm-api-through-open-router)



Expand Down Expand Up @@ -625,15 +627,38 @@ If you want to develop your own simple code, you can start from [this simple cod

<br>

---

<br>

## Google Proprietary LLM, [Gemini](https://gemini.google.com/app)

#### Official API

Prepare necessary items and obtain an API key at [Google AI Studio](https://aistudio.google.com/app/apikey). Install on Python 3.9 or higher and enter the issued API key. Refer to the [tutorial](https://ai.google.dev/gemini-api/docs/get-started/python) for details.

```
pip install -q -U google-generativeai
```
```python
import google.generativeai as genai

GOOGLE_API_KEY="<your_gemini_api_key>"
genai.configure(api_key=GOOGLE_API_KEY)

model = genai.GenerativeModel('gemini-pro')
response = model.generate_content("Write me a poem about Machine Learning.")

print(response.text)
```

## Google Open-source LLMs

If you have sufficient GPU resources, you can download weights directly instead of using the Gemini API to generate content. Consider Gemma and Code Gemma, an open-source models **available for on-premises use**.



### Open-source LLM, [Gemma](https://huggingface.co/google/gemma-7b)


Gemma models are Google's lightweight, advanced text-to-text, decoder-only language models, derived from Gemini research. Available in English, they offer open weights and variants, ideal for tasks like question answering and summarization. For more infomation, visit [Gemma-7b](https://huggingface.co/google/gemma-7b) model card.

#### How to use Gemma
Expand Down Expand Up @@ -670,6 +695,10 @@ print(tokenizer.decode(outputs[0]))



<br>

---

<br>


Expand Down Expand Up @@ -704,8 +733,6 @@ The free model list includes:





<br>

## Sponsor
Expand Down Expand Up @@ -766,13 +793,6 @@ I do not plan to actively curate this repository. Please review [HanaokaYuzu/Gem
Thank you, and have a great day.
</details>

## Contacts

Core maintainers:
- [Antonio Cheong](https://github.com/acheong08) / teapotv8@proton.me <br>
- [Daniel Park](https://github.com/DSDanielPark) / parkminwoo1991@gmail.com



## License ©️
[MIT](https://opensource.org/license/mit/) license, 2024. We hereby strongly disclaim any explicit or implicit legal liability related to our works. Users are required to use this package responsibly and at their own risk. This project is a personal initiative and is not affiliated with or endorsed by Google. It is recommended to use Google's official API.
Expand Down
7 changes: 6 additions & 1 deletion documents/README_DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,9 @@ Write a rough draft of the Gemini API release notes.

#### v2.4.8
- Add verification(`verify`) argument in `Gemini` class.
- Add cookies argument in `GeminiImage` class.
- Add cookies argument in `GeminiImage` class.

#### v2.4.9 ~ v2.4.11
- Writes mostly private test code for errors and tests functionality.
- Rechecks robust implementation of parsing methods.
- Preparing to upgrade to major version three after a small patch.

0 comments on commit 4eace28

Please sign in to comment.