mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2026-04-06 15:13:38 +00:00
API: Add Anthropic-compatible /v1/messages endpoint
This commit is contained in:
parent
f0e3997f37
commit
0216893475
3 changed files with 600 additions and 4 deletions
|
|
@ -144,7 +144,7 @@ class CompletionResponse(BaseModel):
|
|||
|
||||
|
||||
class ChatCompletionRequestParams(BaseModel):
|
||||
messages: List[dict]
|
||||
messages: List[dict] = Field(..., min_length=1)
|
||||
model: str | None = Field(default=None, description="Unused parameter. To change the model, use the /v1/internal/model/load endpoint.")
|
||||
frequency_penalty: float | None = shared.args.frequency_penalty
|
||||
function_call: str | dict | None = Field(default=None, description="Unused parameter.")
|
||||
|
|
@ -282,6 +282,25 @@ class LoadLorasRequest(BaseModel):
|
|||
lora_names: List[str]
|
||||
|
||||
|
||||
class AnthropicRequestParams(BaseModel):
|
||||
model: str | None = None
|
||||
messages: List[dict] = Field(..., min_length=1)
|
||||
max_tokens: int
|
||||
system: str | list | None = None
|
||||
temperature: float | None = shared.args.temperature
|
||||
top_p: float | None = shared.args.top_p
|
||||
stop_sequences: list[str] | None = None
|
||||
stream: bool = False
|
||||
tools: list[dict] | None = None
|
||||
tool_choice: dict | None = None
|
||||
thinking: dict | None = None
|
||||
metadata: dict | None = None
|
||||
|
||||
|
||||
class AnthropicRequest(GenerationOptions, AnthropicRequestParams):
|
||||
pass
|
||||
|
||||
|
||||
class ImageGenerationRequest(BaseModel):
|
||||
"""Image-specific parameters for generation."""
|
||||
prompt: str
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue