Skip to content

Commit

Permalink
fix o1 with system messages
Browse files Browse the repository at this point in the history
  • Loading branch information
devxpy committed Dec 15, 2024
1 parent 6cc797e commit 8f238a2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions daras_ai_v2/language_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,14 @@ def _run_openai_chat(
) -> list[ConversationEntry] | typing.Generator[list[ConversationEntry], None, None]:
from openai._types import NOT_GIVEN

if model in (
LargeLanguageModels.o1_mini.model_id,
LargeLanguageModels.o1_preview.model_id,
):
for entry in messages:
if entry["role"] == CHATML_ROLE_SYSTEM:
entry["role"] = CHATML_ROLE_USER

if avoid_repetition:
frequency_penalty = 0.1
presence_penalty = 0.25
Expand Down

0 comments on commit 8f238a2

Please sign in to comment.