[Bugfix] Bound Anthropic stop sequences (#51997)
Signed-off-by: Taneem Ibrahim <taneem.ibrahim@gmail.com>
This commit is contained in:
@@ -3,10 +3,12 @@
|
|||||||
"""Pydantic models for Anthropic API protocol"""
|
"""Pydantic models for Anthropic API protocol"""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from typing import Any, Literal
|
from typing import Annotated, Any, Literal
|
||||||
|
|
||||||
from pydantic import BaseModel, Field, field_validator, model_validator
|
from pydantic import BaseModel, Field, field_validator, model_validator
|
||||||
|
|
||||||
|
import vllm.envs as envs
|
||||||
|
|
||||||
|
|
||||||
class AnthropicError(BaseModel):
|
class AnthropicError(BaseModel):
|
||||||
"""Error structure for Anthropic API"""
|
"""Error structure for Anthropic API"""
|
||||||
@@ -123,7 +125,9 @@ class AnthropicMessagesRequest(BaseModel):
|
|||||||
max_tokens: int
|
max_tokens: int
|
||||||
metadata: dict[str, Any] | None = None
|
metadata: dict[str, Any] | None = None
|
||||||
output_config: AnthropicOutputConfig | None = None
|
output_config: AnthropicOutputConfig | None = None
|
||||||
stop_sequences: list[str] | None = None
|
stop_sequences: (
|
||||||
|
Annotated[list[str], Field(max_length=envs.VLLM_MAX_STOP_STRINGS)] | None
|
||||||
|
) = None
|
||||||
stream: bool | None = False
|
stream: bool | None = False
|
||||||
system: str | list[AnthropicContentBlock] | None = None
|
system: str | list[AnthropicContentBlock] | None = None
|
||||||
temperature: float | None = None
|
temperature: float | None = None
|
||||||
|
|||||||
Reference in New Issue
Block a user