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

Commit 1e5e7de

Browse files
committed
2 parents 22655d1 + 664511f commit 1e5e7de

File tree

2 files changed

+69
-13
lines changed

2 files changed

+69
-13
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These are supported funding model platforms
22

3-
github: dsdanielpark
3+
github: [dsdanielpark, acheong08]
44
patreon: # Replace with a single Patreon username
55
open_collective: # Replace with a single Open Collective username
66
ko_fi: # minwoopark

README.md

Lines changed: 68 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,43 @@ A *unofficial* Python wrapper, [python-gemini-api](https://pypi.org/project/pyth
2222

2323
Collaborated competently with [Antonio Cheong](https://github.com/acheong08).
2424

25+
<br>
2526

27+
### Large Language Models of Google
28+
29+
| Model | Type | Access | Details | Links |
30+
|:--------------:|:--------------:|-------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------|
31+
| **Gemini** | 🔐<br>Proprietary | API only *(This repository contains unofficial API)* | Gemini is a proprietary multimodal AI developed by Google DeepMind. It includes models like Gemini Pro and Gemini Pro Vision. | [Paper](https://arxiv.org/abs/2312.11805), [Website](https://deepmind.google/technologies/gemini/#introduction), [API](https://aistudio.google.com/), [API Docs](https://cloud.google.com/vertex-ai/docs/generative-ai/model-reference/gemini) |
32+
| **Gemma** | 🤝<br>Open Source | Downloadable weights for on-premises use | Gemma models are open-source, text-to-text language models with downloadable weights. Perfect for use cases like question answering and summarization. | [Paprer](https://arxiv.org/abs/2403.08295), [Website](https://ai.google.dev/gemma/docs?hl=ko), [Model Card](https://huggingface.co/google/gemma-7b) |
33+
| **Code Gemma** | 🤝<br>Open Source | Downloadable weights for on-premises use | Code Gemma models are designed specifically for coding tasks and are also open-source, providing flexibility for developers in handling code generation tasks. | [Post](https://huggingface.co/blog/codegemma), [Hugging Face Collection](https://huggingface.co/collections/google/codegemma-release-66152ac7b683e2667abdee11), [Model Card](https://huggingface.co/google/codegemma-7b-it) |
34+
35+
<details><summary>Code Examples of Gemma and GemmaCode </summary>
36+
37+
#### Gemma
38+
```python
39+
from transformers import AutoTokenizer, AutoModelForCausalLM
40+
41+
tokenizer = AutoTokenizer.from_pretrained("google/gemma-7b")
42+
model = AutoModelForCausalLM.from_pretrained("google/gemma-7b")
43+
input_text = "Write me a poem about Machine Learning."
44+
input_ids = tokenizer(input_text, return_tensors="pt")
45+
outputs = model.generate(**input_ids)
46+
print(tokenizer.decode(outputs[0]))
47+
```
48+
49+
#### Code Gemma
50+
```python
51+
from transformers import GemmaTokenizer, AutoModelForCausalLM
52+
53+
tokenizer = GemmaTokenizer.from_pretrained("google/codegemma-7b-it")
54+
model = AutoModelForCausalLM.from_pretrained("google/codegemma-7b-it")
55+
input_text = "Write me a Python function to calculate the nth fibonacci number."
56+
input_ids = tokenizer(input_text, return_tensors="pt")
57+
outputs = model.generate(**input_ids)
58+
print(tokenizer.decode(outputs[0]))
59+
```
60+
61+
</details>
2662

2763

2864

@@ -34,11 +70,11 @@ Collaborated competently with [Antonio Cheong](https://github.com/acheong08).
3470
>
3571
> Check out temporarily free Open-source LLM APIs with Open Router. (Free limit: 10 requests/minute)
3672
37-
<br><br>
73+
<br>
3874

3975

4076
- [ Gemini API ](#-gemini-api---)
41-
- [What is Gemini?](#what-is-gemini)
77+
- [What is Gemini?🔐](#what-is-gemini)
4278
- [Installation ✅](#installation-)
4379
- [Authentication ✅](#authentication)
4480
- [Quick Start ✅](#quick-start)
@@ -55,8 +91,8 @@ Collaborated competently with [Antonio Cheong](https://github.com/acheong08).
5591
- [# 10. Changing the Selected Response from 0 to *n*](#-10-changing-the-selected-response-from-0-to-n)
5692
- [# 11. Generate custom content](#-11-generate-custom-content)
5793
- [Further](#further)
58-
- [Open-source LLM, Gemma](#open-source-llm-gemma)
59-
- [How to use Gemma](#how-to-use-gemma)
94+
- [Open-source LLM, Gemma🤝](#open-source-llm-gemma)
95+
- [Open-source LLM, Code Gemma🤝](#open-source-llm-code-gemma)
6096
- [Utilize free open-source LLM API through Open Router ✅](#utilize-free-open-source-llm-api-through-open-router)
6197

6298

@@ -65,11 +101,11 @@ Collaborated competently with [Antonio Cheong](https://github.com/acheong08).
65101

66102

67103

68-
<br>
69104

70105

71106

72107

108+
<br>
73109

74110
## What is [Gemini](https://deepmind.google/technologies/gemini/#introduction)?
75111

@@ -529,7 +565,7 @@ response = GeminiClient.generate_custom_content("Give me some information about
529565

530566
## Further
531567

532-
### Use rotating proxies
568+
### Use rotating proxies via [Smart Proxy by Crawlbase](https://crawlbase.com/docs/smart-proxy/?utm_source=github_ad&utm_medium=social&utm_campaign=bard_api)
533569

534570
If you want to **avoid blocked requests** and bans, then use [Smart Proxy by Crawlbase](https://crawlbase.com/docs/smart-proxy/?utm_source=github_ad&utm_medium=social&utm_campaign=bard_api). It forwards your connection requests to a **randomly rotating IP address** in a pool of proxies before reaching the target website. The combination of AI and ML make it more effective to avoid CAPTCHAs and blocks.
535571

@@ -591,6 +627,28 @@ outputs = model.generate(**input_ids)
591627
print(tokenizer.decode(outputs[0]))
592628
```
593629

630+
<br>
631+
632+
## Open-source LLM, [Code Gemma](https://huggingface.co/collections/google/codegemma-release-66152ac7b683e2667abdee11)
633+
634+
[CodeGemma](https://huggingface.co/blog/codegemma), which is an official release from Google for code LLMs, was released on April 9, 2024. It provides three models specifically designed for generating and interacting with code. You can explore the [Code Gemma models](https://huggingface.co/collections/google/codegemma-release-66152ac7b683e2667abdee11) and view the [model card](https://huggingface.co/google/codegemma-7b-it) for more details.
635+
636+
### How to use Code Gemma
637+
```python
638+
from transformers import GemmaTokenizer, AutoModelForCausalLM
639+
640+
tokenizer = GemmaTokenizer.from_pretrained("google/codegemma-7b-it")
641+
model = AutoModelForCausalLM.from_pretrained("google/codegemma-7b-it")
642+
643+
input_text = "Write me a Python function to calculate the nth fibonacci number."
644+
input_ids = tokenizer(input_text, return_tensors="pt")
645+
646+
outputs = model.generate(**input_ids)
647+
print(tokenizer.decode(outputs[0]))
648+
```
649+
650+
651+
594652
<br>
595653

596654

@@ -630,20 +688,18 @@ The free model list includes:
630688

631689
<br>
632690

691+
## Sponsor, [Crawlbase](https://crawlbase.com/)
692+
Use [Crawlbase](https://crawlbase.com/) API for efficient data scraping to train AI models, boasting a 98% success rate and 99.9% uptime. It's quick to start, GDPR/CCPA compliant, supports massive data extraction, and is trusted by 70k+ developers.
693+
694+
<br>
633695

634696
## [FAQ](https://github.com/dsdanielpark/Gemini-API/blob/main/documents/README_FAQ.md)
635697
First review [HanaokaYuzu/Gemini-API](https://github.com/HanaokaYuzu/Gemini-API) and the [Official Google Gemini API](https://aistudio.google.com/) before using this package.
636698
You can find most help on the [FAQ](https://github.com/dsdanielpark/Gemini-API/blob/main/documents/README_FAQ.md) and [Issue](https://github.com/dsdanielpark/Gemini-API/issues) pages.
637-
638-
639699

640700
## [Issues](https://github.com/dsdanielpark/Gemini-API/issues)
641701
Sincerely grateful for any reports on new features or bugs. Your valuable feedback on the code is highly appreciated. Frequent errors may occur due to changes in Google's service API interface. Both [Issue reports](https://github.com/dsdanielpark/Gemini-API/issues) and [Pull requests](https://github.com/dsdanielpark/Gemini-API/pulls) contributing to improvements are always welcome. We strive to maintain an active and courteous open community.
642702

643-
644-
## Sponsor
645-
Use [Crawlbase](https://crawlbase.com/) API for efficient data scraping to train AI models, boasting a 98% success rate and 99.9% uptime. It's quick to start, GDPR/CCPA compliant, supports massive data extraction, and is trusted by 70k+ developers.
646-
647703
## Contributors
648704
We would like to express our sincere gratitude to all the contributors.
649705

0 commit comments

Comments
 (0)