forked from lab/TPM
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
687 B
30 lines
687 B
""" |
|
OpenAI API 配置 |
|
|
|
請設置您的OpenAI API金鑰 |
|
""" |
|
|
|
import os |
|
|
|
# OpenAI API 配置 |
|
OPENAI_CONFIG = { |
|
'api_key': os.getenv('OPENAI_API_KEY', 'your-api-key-here'), |
|
'model': 'gpt-4', # 可選擇 gpt-3.5-turbo 以降低成本 |
|
'max_tokens': 2000, |
|
'temperature': 0.7, |
|
'timeout': 30, # 請求超時時間(秒) |
|
} |
|
|
|
# API 調用限制 |
|
RATE_LIMITS = { |
|
'requests_per_minute': 60, # 每分鐘最大請求數 |
|
'max_retries': 3, # 最大重試次數 |
|
'retry_delay': 2, # 重試間隔(秒) |
|
} |
|
|
|
# 快取設定 |
|
CACHE_CONFIG = { |
|
'enabled': True, |
|
'ttl': 3600, # 快取時間(秒) |
|
'max_size': 100, # 最大快取項目數 |
|
}
|
|
|