Add support for o3 mini model by openai

This commit is contained in:
Debanjum
2025-02-01 02:29:44 +05:30
parent b111a9d6c6
commit 0bfa7c1c45
3 changed files with 6 additions and 0 deletions

View File

@@ -71,6 +71,8 @@ def completion_with_backoff(
elif model_name.startswith("o1"):
temperature = 1
model_kwargs.pop("response_format", None)
elif model_name.startswith("o3-"):
temperature = 1
if os.getenv("KHOJ_LLM_SEED"):
model_kwargs["seed"] = int(os.getenv("KHOJ_LLM_SEED"))
@@ -181,6 +183,8 @@ def llm_thread(
elif model_name.startswith("o1-"):
temperature = 1
model_kwargs.pop("response_format", None)
elif model_name.startswith("o3-"):
temperature = 1
elif model_name.startswith("deepseek-reasoner"):
# Two successive messages cannot be from the same role. Should merge any back-to-back messages from the same role.
# The first message should always be a user message (except system message).

View File

@@ -55,6 +55,7 @@ model_to_prompt_size = {
"gpt-4o-mini": 60000,
"o1": 20000,
"o1-mini": 60000,
"o3-mini": 60000,
# Google Models
"gemini-1.5-flash": 60000,
"gemini-1.5-pro": 60000,

View File

@@ -40,6 +40,7 @@ model_to_cost: Dict[str, Dict[str, float]] = {
"gpt-4o-mini": {"input": 0.15, "output": 0.60},
"o1": {"input": 15.0, "output": 60.00},
"o1-mini": {"input": 3.0, "output": 12.0},
"o3-mini": {"input": 1.10, "output": 4.40},
# Gemini Pricing: https://ai.google.dev/pricing
"gemini-1.5-flash": {"input": 0.075, "output": 0.30},
"gemini-1.5-flash-002": {"input": 0.075, "output": 0.30},