Files
assist/test.py
zhaojie e3c68b5133 Update config, core models, and web app; refresh Python 3.11 cache
This commit includes general updates to application configuration, core data models, and various web application components (knowledge base, error handling, static assets, and websocket server). It also refreshes the Python 3.11 bytecode cache, likely due to underlying code changes and environment alignment.
2025-12-12 13:39:43 +08:00

20 lines
582 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import google.generativeai as genai
from google.api_core import client_options
# 配置代理地址
# 注意:这里不需要加 /v1beta 或 /v1只填主机和端口
proxy_url = "https://generativelanguage.googleapis.com/v1beta/openai/"
genai.configure(
api_key="AIzaSyCK8Ykg2UGzDV9ZmPAbbqOFgK3_9ghxZl4",
transport="rest",
client_options=client_options.ClientOptions(
api_endpoint=proxy_url
),
)
model = genai.GenerativeModel('gemini-2.5-pro')
response = model.generate_content("介绍一下你自己用50字中文回答。")
print(response.text)