26 lines
671 B
Python
26 lines
671 B
Python
from typing import Any, Dict, List, Optional, Union
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class ChatRequest(BaseModel):
|
|
|
|
prompt: List[str] = Field(
|
|
...,
|
|
min_length=1,
|
|
description="The user's prompt, where the first element is the system prompt.",
|
|
)
|
|
|
|
temperature: float = 0.7
|
|
|
|
top_p: float = 0.9
|
|
|
|
max_tokens: int = 2048
|
|
|
|
# 是否启用网络搜索功能,可选项
|
|
# 可以是一个布尔值或一个包含详细配置的字典
|
|
# 例如:{"enable": True, "max_results": 5}
|
|
web_search: Optional[Union[bool, Dict[str, Any]]] = Field(
|
|
None, description="Enable or configure web search capabilities."
|
|
)
|