chore: fix attr ref

This commit is contained in:
Greyson LaLonde
2025-11-11 00:02:34 -05:00
parent 67e39073c7
commit 6fb13ee3e0
10 changed files with 98 additions and 107 deletions

View File

@@ -197,7 +197,7 @@ def test_anthropic_specific_parameters():
from crewai.llm.providers.anthropic.completion import AnthropicCompletion
assert isinstance(llm, AnthropicCompletion)
assert llm.stop_sequences == ["Human:", "Assistant:"]
assert llm.stop == ["Human:", "Assistant:"]
assert llm.stream == True
assert llm.client.max_retries == 5
assert llm.client.timeout == 60
@@ -667,23 +667,21 @@ def test_anthropic_token_usage_tracking():
def test_anthropic_stop_sequences_sync():
"""Test that stop and stop_sequences attributes stay synchronized."""
"""Test that stop sequences can be set and retrieved correctly."""
llm = LLM(model="anthropic/claude-3-5-sonnet-20241022")
# Test setting stop as a list
llm.stop = ["\nObservation:", "\nThought:"]
assert llm.stop_sequences == ["\nObservation:", "\nThought:"]
assert llm.stop == ["\nObservation:", "\nThought:"]
# Test setting stop as a string
# Test setting stop as a string - note: setting via attribute doesn't go through validator
# so it stays as a string
llm.stop = "\nFinal Answer:"
assert llm.stop_sequences == ["\nFinal Answer:"]
assert llm.stop == ["\nFinal Answer:"]
assert llm.stop == "\nFinal Answer:"
# Test setting stop as None
llm.stop = None
assert llm.stop_sequences == []
assert llm.stop == []
assert llm.stop is None
@pytest.mark.vcr(filter_headers=["authorization", "x-api-key"])