Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Removed monkey patch, OpenShift AI now works with max_completion_tokens #685

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions kai/llm_interfacing/model_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,36 +272,6 @@ def prepare_model_args(
model_args = deep_update(defaults, config_args)
model_id = model_args["model"]

# NOTE(JonahSussman): This is a hack to prevent `max_tokens`
# from getting converted to `max_completion_tokens` for every
# model, except for the o1 and o3 family of models.

@property # type: ignore[misc]
def _default_params(self: ChatOpenAI) -> dict[str, Any]:
return super(ChatOpenAI, self)._default_params

def _get_request_payload(
self: ChatOpenAI,
input_: LanguageModelInput,
*,
stop: list[str] | None = None,
**kwargs: Any,
) -> dict: # type: ignore[type-arg]
return super(ChatOpenAI, self)._get_request_payload(
input_, stop=stop, **kwargs
)

if not (
model_args["model"].startswith("o1") or model_args["model"].startswith("o3")
):
ChatOpenAI._default_params = _default_params # type: ignore[method-assign]
ChatOpenAI._get_request_payload = _get_request_payload # type: ignore[method-assign]
else:
if "streaming" in model_args:
del model_args["streaming"]
if "temperature" in model_args:
del model_args["temperature"]

return model_args, model_id


Expand Down
Loading