Skip to content

Commit 42bfb60

Browse files
szymondudyczManul from Pathway
authored andcommitted
Fix test_anthropic_call_arg (#8975)
GitOrigin-RevId: ce182e17e0f99283f8798c4d227171bf89843a97
1 parent 408cbf4 commit 42bfb60

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

python/pathway/xpacks/llm/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def wrapper(*args, **kwargs):
4949
return func
5050

5151

52-
def _check_model_accepts_arg(model_name: str, provider: str, arg: str):
52+
def _check_model_accepts_arg(model_name: str, provider: str | None, arg: str):
5353
from litellm import get_supported_openai_params
5454

5555
supported_params = (

python/pathway/xpacks/llm/llms.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,10 +442,14 @@ def _accepts_call_arg(self, arg_name: str) -> bool:
442442
if self.model is None:
443443
return False
444444

445-
provider = self.model.split("/")[0]
446-
model = "".join(
447-
self.model.split("/")[1:]
448-
) # handle case: replicate/meta/meta-llama-3-8b
445+
if "/" in self.model:
446+
provider = self.model.split("/")[0]
447+
model = "".join(
448+
self.model.split("/")[1:]
449+
) # handle case: replicate/meta/meta-llama-3-8b
450+
else:
451+
model = self.model
452+
provider = None
449453
return _check_model_accepts_arg(model, provider, arg_name)
450454

451455

python/pathway/xpacks/llm/tests/test_llms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ def test_openai_call_args(model, call_arg):
9797
[
9898
"claude-3-5-sonnet-20240620",
9999
"claude-3-opus-20240229",
100-
"antrophic/claude-3-5-sonnet-20240620",
100+
"anthropic/claude-3-5-sonnet-20240620",
101101
None,
102102
],
103103
)
104104
@pytest.mark.parametrize("call_arg", [*VALID_ARGS, *INVALID_ARGS])
105-
def test_antrophic_call_args(model, call_arg):
105+
def test_anthropic_call_args(model, call_arg):
106106
llm = llms.LiteLLMChat(model=model)
107107

108108
if model is None:

0 commit comments

Comments
 (0)