Skip to content

Commit 5ca7be2

Browse files
ShreyaRUbuntuzsimjee
authored
Update Node.js dependencies (#667)
* Update Node.js dependencies as per dependabot warnings * Update scipy version, remove torch source, and fix anthropic ImportError * lint --------- Co-authored-by: Ubuntu <[email protected]> Co-authored-by: Zayd Simjee <[email protected]>
1 parent a28d1fc commit 5ca7be2

File tree

3 files changed

+48
-47
lines changed

3 files changed

+48
-47
lines changed

poetry.lock

Lines changed: 39 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,8 @@ pillow = "^10.1.0"
104104
cairosvg = "^2.7.1"
105105
mkdocs-glightbox = "^0.3.4"
106106

107-
[[tool.poetry.source]]
108-
name = "torch"
109-
url = "https://download.pytorch.org/whl/cpu"
110-
priority = "explicit"
111-
112107
[[tool.poetry.source]]
113108
name = "PyPI"
114-
priority = "primary"
115109

116110
[build-system]
117111
requires = ["poetry-core"]
@@ -123,4 +117,4 @@ include_trailing_comma = true
123117
force_grid_wrap = 0
124118
use_parentheses = true
125119
ensure_newline_before_comments = true
126-
line_length = 88
120+
line_length = 88

tests/unit_tests/test_llm_providers.py

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,6 @@
2020

2121
from .mocks import MockAsyncOpenAILlm, MockOpenAILlm
2222

23-
# def test_openai_callable_retries_on_retryable_errors(mocker):
24-
# llm = MockCustomLlm()
25-
# fail_retryable_spy = mocker.spy(llm, "fail_retryable")
26-
#
27-
# arbitrary_callable = ArbitraryCallable(llm.fail_retryable, prompt="Hello")
28-
# response = arbitrary_callable()
29-
#
30-
# assert fail_retryable_spy.call_count == 2
31-
# assert isinstance(response, LLMResponse) is True
32-
# assert response.output == "Hello world!"
33-
# assert response.prompt_token_count is None
34-
# assert response.response_token_count is None
35-
3623

3724
@pytest.mark.skipif(not OPENAI_VERSION.startswith("0"), reason="OpenAI v0 only")
3825
def test_openai_callable_does_not_retry_on_non_retryable_errors(mocker):
@@ -65,22 +52,6 @@ def test_openai_callable_does_not_retry_on_success(mocker):
6552
assert response.response_token_count is None
6653

6754

68-
# @pytest.mark.asyncio
69-
# async def test_async_openai_callable_retries_on_retryable_errors(mocker):
70-
# llm = MockAsyncCustomLlm()
71-
# fail_retryable_spy = mocker.spy(llm, "fail_retryable")
72-
#
73-
# arbitrary_callable = AsyncArbitraryCallable(llm.fail_retryable, prompt="Hello")
74-
# response = await arbitrary_callable()
75-
#
76-
# assert fail_retryable_spy.call_count == 2
77-
# assert isinstance(response, LLMResponse) is True
78-
# assert response.output == "Hello world!"
79-
# assert response.prompt_token_count is None
80-
# assert response.response_token_count is None
81-
82-
83-
# Passing
8455
@pytest.mark.skipif(not OPENAI_VERSION.startswith("0"), reason="OpenAI v0 only")
8556
@pytest.mark.asyncio
8657
async def test_async_openai_callable_does_not_retry_on_non_retryable_errors(mocker):
@@ -664,19 +635,19 @@ def test_get_llm_ask_cohere():
664635

665636

666637
@pytest.mark.skipif(
667-
not importlib.util.find_spec("anthropic.resources"),
668-
reason="antrhopic is not installed",
638+
not importlib.util.find_spec("anthropic"),
639+
reason="anthropic is not installed",
669640
)
670641
def test_get_llm_ask_anthropic():
671-
from anthropic import Anthropic
672-
673-
from guardrails.llm_providers import AnthropicCallable
642+
if importlib.util.find_spec("anthropic"):
643+
from anthropic import Anthropic
674644

675-
anthropic_client = Anthropic(api_key="my_api_key")
645+
from guardrails.llm_providers import AnthropicCallable
676646

677-
prompt_callable = get_llm_ask(anthropic_client.completions.create)
647+
anthropic_client = Anthropic(api_key="my_api_key")
648+
prompt_callable = get_llm_ask(anthropic_client.completions.create)
678649

679-
assert isinstance(prompt_callable, AnthropicCallable)
650+
assert isinstance(prompt_callable, AnthropicCallable)
680651

681652

682653
@pytest.mark.skipif(

0 commit comments

Comments
 (0)