Skip to content
Open
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
5 changes: 2 additions & 3 deletions src/agents-api/agents_api/clients/litellm.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async def acompletion(
)

custom_api_key = secret and secret.value
model = f"openai/{model}" # This is needed for litellm
model = f"openai/{model.removeprefix('openai/')}" # This is needed for litellm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting the model normalization (using removeprefix) into a helper function to avoid duplication and ensure consistent behavior across functions. Also, ensure that your minimum Python version supports str.removeprefix (Python 3.9+).


supported_params: list[str] = (
get_supported_openai_params(model) or []
Expand Down Expand Up @@ -136,9 +136,8 @@ async def aembedding(
custom_api_key: str | None = None,
**settings,
) -> list[list[float]]:
if not custom_api_key:
model = f"openai/{model}" # This is needed for litellm

model = f"openai/{model.removeprefix('openai/')}" # This is needed for litellm
input = (
[inputs]
if isinstance(inputs, str)
Expand Down