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.
20 lines
582 B
Python
20 lines
582 B
Python
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)
|