mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-17 00:26:01 +00:00
test(test_completion.py): fix claude test
This commit is contained in:
@@ -35,9 +35,7 @@ class AnthropicTextConfig:
|
||||
to pass metadata to anthropic, it's {"user_id": "any-relevant-information"}
|
||||
"""
|
||||
|
||||
max_tokens_to_sample: Optional[int] = (
|
||||
litellm.max_tokens
|
||||
) # anthropic requires a default
|
||||
max_tokens: Optional[int] = litellm.max_tokens # anthropic requires a default
|
||||
stop_sequences: Optional[list] = None
|
||||
temperature: Optional[int] = None
|
||||
top_p: Optional[int] = None
|
||||
@@ -46,7 +44,7 @@ class AnthropicTextConfig:
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
max_tokens_to_sample: Optional[int] = 256, # anthropic requires a default
|
||||
max_tokens: Optional[int] = 256, # anthropic requires a default
|
||||
stop_sequences: Optional[list] = None,
|
||||
temperature: Optional[int] = None,
|
||||
top_p: Optional[int] = None,
|
||||
|
||||
@@ -56,7 +56,7 @@ def test_completion_custom_provider_model_name():
|
||||
def test_completion_claude():
|
||||
litellm.set_verbose = True
|
||||
litellm.cache = None
|
||||
litellm.AnthropicTextConfig(max_tokens_to_sample=200, metadata={"user_id": "1224"})
|
||||
litellm.AnthropicTextConfig(max_tokens=200, metadata={"user_id": "1224"})
|
||||
messages = [
|
||||
{
|
||||
"role": "system",
|
||||
@@ -67,7 +67,7 @@ def test_completion_claude():
|
||||
try:
|
||||
# test without max tokens
|
||||
response = completion(
|
||||
model="claude-instant-1",
|
||||
model="claude-instant-1.2",
|
||||
messages=messages,
|
||||
request_timeout=10,
|
||||
max_tokens=10,
|
||||
|
||||
Reference in New Issue
Block a user