add support for gpt5 and azure gpt5 series (#3136)
This commit is contained in:
@@ -215,6 +215,27 @@ class Settings(BaseSettings):
|
|||||||
AZURE_O3_API_BASE: str | None = None
|
AZURE_O3_API_BASE: str | None = None
|
||||||
AZURE_O3_API_VERSION: str = "2025-01-01-preview"
|
AZURE_O3_API_VERSION: str = "2025-01-01-preview"
|
||||||
|
|
||||||
|
# AZURE gpt-5
|
||||||
|
ENABLE_AZURE_GPT5: bool = False
|
||||||
|
AZURE_GPT5_DEPLOYMENT: str = "gpt-5"
|
||||||
|
AZURE_GPT5_API_KEY: str | None = None
|
||||||
|
AZURE_GPT5_API_BASE: str | None = None
|
||||||
|
AZURE_GPT5_API_VERSION: str = "2025-04-01-preview"
|
||||||
|
|
||||||
|
# AZURE gpt-5 mini
|
||||||
|
ENABLE_AZURE_GPT5_MINI: bool = False
|
||||||
|
AZURE_GPT5_MINI_DEPLOYMENT: str = "gpt-5-mini"
|
||||||
|
AZURE_GPT5_MINI_API_KEY: str | None = None
|
||||||
|
AZURE_GPT5_MINI_API_BASE: str | None = None
|
||||||
|
AZURE_GPT5_MINI_API_VERSION: str = "2025-04-01-preview"
|
||||||
|
|
||||||
|
# AZURE gpt-5 nano
|
||||||
|
ENABLE_AZURE_GPT5_NANO: bool = False
|
||||||
|
AZURE_GPT5_NANO_DEPLOYMENT: str = "gpt-5-nano"
|
||||||
|
AZURE_GPT5_NANO_API_KEY: str | None = None
|
||||||
|
AZURE_GPT5_NANO_API_BASE: str | None = None
|
||||||
|
AZURE_GPT5_NANO_API_VERSION: str = "2025-04-01-preview"
|
||||||
|
|
||||||
# GEMINI
|
# GEMINI
|
||||||
GEMINI_API_KEY: str | None = None
|
GEMINI_API_KEY: str | None = None
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,39 @@ class LLMConfigRegistry:
|
|||||||
|
|
||||||
|
|
||||||
if settings.ENABLE_OPENAI:
|
if settings.ENABLE_OPENAI:
|
||||||
|
LLMConfigRegistry.register_config(
|
||||||
|
"OPENAI_GPT5",
|
||||||
|
LLMConfig(
|
||||||
|
"gpt-5-2025-08-07",
|
||||||
|
["OPENAI_API_KEY"],
|
||||||
|
supports_vision=True,
|
||||||
|
add_assistant_prefix=False,
|
||||||
|
max_completion_tokens=128000,
|
||||||
|
temperature=None,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
LLMConfigRegistry.register_config(
|
||||||
|
"OPENAI_GPT5_MINI",
|
||||||
|
LLMConfig(
|
||||||
|
"gpt-5-mini-2025-08-07",
|
||||||
|
["OPENAI_API_KEY"],
|
||||||
|
supports_vision=True,
|
||||||
|
add_assistant_prefix=False,
|
||||||
|
max_completion_tokens=128000,
|
||||||
|
temperature=None,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
LLMConfigRegistry.register_config(
|
||||||
|
"OPENAI_GPT5_NANO",
|
||||||
|
LLMConfig(
|
||||||
|
"gpt-5-nano-2025-08-07",
|
||||||
|
["OPENAI_API_KEY"],
|
||||||
|
supports_vision=True,
|
||||||
|
add_assistant_prefix=False,
|
||||||
|
max_completion_tokens=128000,
|
||||||
|
temperature=None,
|
||||||
|
),
|
||||||
|
)
|
||||||
LLMConfigRegistry.register_config(
|
LLMConfigRegistry.register_config(
|
||||||
"OPENAI_GPT4_TURBO",
|
"OPENAI_GPT4_TURBO",
|
||||||
LLMConfig(
|
LLMConfig(
|
||||||
@@ -537,6 +570,77 @@ if settings.ENABLE_AZURE_GPT4_1_NANO:
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if settings.ENABLE_AZURE_GPT5:
|
||||||
|
LLMConfigRegistry.register_config(
|
||||||
|
"AZURE_OPENAI_GPT5",
|
||||||
|
LLMConfig(
|
||||||
|
f"azure/{settings.AZURE_GPT5_DEPLOYMENT}",
|
||||||
|
[
|
||||||
|
"AZURE_GPT5_DEPLOYMENT",
|
||||||
|
"AZURE_GPT5_API_KEY",
|
||||||
|
"AZURE_GPT5_API_BASE",
|
||||||
|
"AZURE_GPT5_API_VERSION",
|
||||||
|
],
|
||||||
|
litellm_params=LiteLLMParams(
|
||||||
|
api_base=settings.AZURE_GPT5_API_BASE,
|
||||||
|
api_key=settings.AZURE_GPT5_API_KEY,
|
||||||
|
api_version=settings.AZURE_GPT5_API_VERSION,
|
||||||
|
model_info={"model_name": "azure/gpt-5"},
|
||||||
|
),
|
||||||
|
supports_vision=True,
|
||||||
|
add_assistant_prefix=False,
|
||||||
|
max_completion_tokens=128000,
|
||||||
|
temperature=None,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
if settings.ENABLE_AZURE_GPT5_MINI:
|
||||||
|
LLMConfigRegistry.register_config(
|
||||||
|
"AZURE_OPENAI_GPT5_MINI",
|
||||||
|
LLMConfig(
|
||||||
|
f"azure/{settings.AZURE_GPT5_MINI_DEPLOYMENT}",
|
||||||
|
[
|
||||||
|
"AZURE_GPT5_MINI_DEPLOYMENT",
|
||||||
|
"AZURE_GPT5_MINI_API_KEY",
|
||||||
|
"AZURE_GPT5_MINI_API_BASE",
|
||||||
|
"AZURE_GPT5_MINI_API_VERSION",
|
||||||
|
],
|
||||||
|
litellm_params=LiteLLMParams(
|
||||||
|
api_base=settings.AZURE_GPT5_MINI_API_BASE,
|
||||||
|
api_key=settings.AZURE_GPT5_MINI_API_KEY,
|
||||||
|
api_version=settings.AZURE_GPT5_MINI_API_VERSION,
|
||||||
|
model_info={"model_name": "azure/gpt-5-mini"},
|
||||||
|
),
|
||||||
|
supports_vision=True,
|
||||||
|
add_assistant_prefix=False,
|
||||||
|
max_completion_tokens=128000,
|
||||||
|
temperature=None,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
if settings.ENABLE_AZURE_GPT5_NANO:
|
||||||
|
LLMConfigRegistry.register_config(
|
||||||
|
"AZURE_OPENAI_GPT5_NANO",
|
||||||
|
LLMConfig(
|
||||||
|
f"azure/{settings.AZURE_GPT5_NANO_DEPLOYMENT}",
|
||||||
|
[
|
||||||
|
"AZURE_GPT5_NANO_DEPLOYMENT",
|
||||||
|
"AZURE_GPT5_NANO_API_KEY",
|
||||||
|
"AZURE_GPT5_NANO_API_BASE",
|
||||||
|
"AZURE_GPT5_NANO_API_VERSION",
|
||||||
|
],
|
||||||
|
litellm_params=LiteLLMParams(
|
||||||
|
api_base=settings.AZURE_GPT5_NANO_API_BASE,
|
||||||
|
api_key=settings.AZURE_GPT5_NANO_API_KEY,
|
||||||
|
api_version=settings.AZURE_GPT5_NANO_API_VERSION,
|
||||||
|
model_info={"model_name": "azure/gpt-5-nano"},
|
||||||
|
),
|
||||||
|
supports_vision=True,
|
||||||
|
add_assistant_prefix=False,
|
||||||
|
max_completion_tokens=128000,
|
||||||
|
temperature=None,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
if settings.ENABLE_AZURE_O4_MINI:
|
if settings.ENABLE_AZURE_O4_MINI:
|
||||||
LLMConfigRegistry.register_config(
|
LLMConfigRegistry.register_config(
|
||||||
|
|||||||
Reference in New Issue
Block a user