Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
added no tools support for openrouter
Browse files Browse the repository at this point in the history
  • Loading branch information
nsosio committed Jun 10, 2024
1 parent 402a62f commit 322eaf6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions prem_utils/connectors/openrouter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections.abc import Sequence
from typing import Any

from prem_utils import errors
from prem_utils.connectors.openai import OpenAIConnector


Expand All @@ -24,7 +25,15 @@ async def chat_completion(
stream: bool = False,
temperature: float = 1,
top_p: float = 1,
tools=None,
):
if tools is not None:
raise errors.PremProviderError(
"Tools are not supported for this model",
provider="openrouter",
model=model,
provider_message="Tools are not supported for this model",
)
if "openrouter" in model:
model = model.replace("openrouter/", "", 1)

Expand Down

0 comments on commit 322eaf6

Please sign in to comment.