Skip to content

Commit

Permalink
新增gemini的demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Ikaros-521 committed Dec 17, 2023
1 parent 8c0b8e9 commit d3e6346
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_gemini/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import google.generativeai as genai
import os

genai.configure(api_key="AIzaSyCGqin4BhFsdOsvbQOv2_gYjW3kGJJo1d4")

for m in genai.list_models():
if 'generateContent' in m.supported_generation_methods:
print(m.name)

model = genai.GenerativeModel(model_name = "gemini-pro")
messages = [
{
'role':'user',
'parts': ["你好"]
}
]

response = model.generate_content(messages, stream=False)
print(response.text)

0 comments on commit d3e6346

Please sign in to comment.