From 86d56dd1b1bd9848e3ae5445444bfd0df837b0c6 Mon Sep 17 00:00:00 2001 From: "MinWoo(Daniel) Park" Date: Thu, 2 May 2024 16:26:08 +0900 Subject: [PATCH] doc: update readme --- README.md | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6b89986..737ab85 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,8 @@ On the official side, Google provides partially free, clean [official Gemini API ## Contents - [ Gemini API ](#-gemini-api---) - - [What is Gemini? 🔐](#what-is-gemini) + - [What is Gemini? 🔒](#what-is-gemini) + - [What is Python-Gemini-API? 🔐](#what-is-python-gemini-api) - [Installation ✅](#installation-) - [Authentication ✅](#authentication) - [Quick Start ✅](#quick-start) @@ -54,7 +55,8 @@ On the official side, Google provides partially free, clean [official Gemini API - [# 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) + - [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) @@ -625,15 +627,38 @@ If you want to develop your own simple code, you can start from [this simple cod
+--- + +
+ +## 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="" +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 @@ -670,6 +695,10 @@ print(tokenizer.decode(outputs[0])) +
+ +--- +
@@ -704,8 +733,6 @@ The free model list includes: - -
## Sponsor