Skip to content

Commit

Permalink
error improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
MateuszOssGit committed Nov 8, 2024
1 parent d7546da commit bdf0f70
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion libs/ibm/langchain_ibm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ def check_duplicate_chat_params(params: dict, kwargs: dict) -> None:

if duplicate_keys:
raise ValueError(
f"Duplicate parameters found in params and attributes: "
f"Duplicate parameters found in params and keyword arguments: "
f"{list(duplicate_keys)}"
)
6 changes: 3 additions & 3 deletions libs/ibm/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions libs/ibm/tests/integration_tests/test_chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,9 @@ def test_init_with_params_5() -> None:
params=params_1,
**params_2, # type: ignore[arg-type]
)
assert "Duplicate parameters found in params and attributes: ['max_tokens']" in str(
e.value
assert (
"Duplicate parameters found in params and keyword arguments: ['max_tokens']"
in str(e.value)
)


Expand Down Expand Up @@ -829,8 +830,9 @@ def test_invoke_with_params_4() -> None:
with pytest.raises(ValueError) as e:
chat.invoke(prompt_1, params=params_1, **params_2) # type: ignore[arg-type]

assert "Duplicate parameters found in params and attributes: ['max_tokens']" in str(
e.value
assert (
"Duplicate parameters found in params and keyword arguments: ['max_tokens']"
in str(e.value)
)


Expand All @@ -847,7 +849,7 @@ def test_invoke_with_params_5() -> None:
chat.invoke(prompt_1, params=params_1, **params_2, **params_3) # type: ignore[arg-type]

assert (
"Duplicate parameters found in params and attributes: " in str(e.value)
"Duplicate parameters found in params and keyword arguments: " in str(e.value)
and "'logprobs'" in str(e.value)
and "'max_tokens'" in str(e.value)
)
Expand Down Expand Up @@ -949,6 +951,7 @@ def test_init_and_invoke_with_params_4() -> None:
with pytest.raises(ValueError) as e:
chat.invoke(prompt_1, params=params_1_b, **params_1_c) # type: ignore[arg-type]

assert "Duplicate parameters found in params and attributes: ['max_tokens']" in str(
e.value
assert (
"Duplicate parameters found in params and keyword arguments: ['max_tokens']"
in str(e.value)
)

0 comments on commit bdf0f70

Please sign in to comment.