Add manual opener tool calls to Assistant model and API
- Introduced `manual_opener_tool_calls` field in the Assistant model to support custom tool calls. - Updated AssistantBase and AssistantUpdate schemas to include the new field. - Implemented normalization and migration logic for handling manual opener tool calls in the API. - Enhanced runtime metadata to include manual opener tool calls in responses. - Updated tests to validate the new functionality and ensure proper handling of tool calls. - Refactored tool ID normalization to support legacy tool names for backward compatibility.
This commit is contained in:
@@ -280,6 +280,7 @@ class AssistantBase(BaseModel):
|
||||
name: str
|
||||
firstTurnMode: str = "bot_first"
|
||||
opener: str = ""
|
||||
manualOpenerToolCalls: List[Dict[str, Any]] = []
|
||||
generatedOpenerEnabled: bool = False
|
||||
openerAudioEnabled: bool = False
|
||||
prompt: str = ""
|
||||
@@ -310,6 +311,7 @@ class AssistantUpdate(BaseModel):
|
||||
name: Optional[str] = None
|
||||
firstTurnMode: Optional[str] = None
|
||||
opener: Optional[str] = None
|
||||
manualOpenerToolCalls: Optional[List[Dict[str, Any]]] = None
|
||||
generatedOpenerEnabled: Optional[bool] = None
|
||||
openerAudioEnabled: Optional[bool] = None
|
||||
prompt: Optional[str] = None
|
||||
@@ -350,6 +352,7 @@ class AssistantRuntimeMetadata(BaseModel):
|
||||
firstTurnMode: str = "bot_first"
|
||||
greeting: str = ""
|
||||
generatedOpenerEnabled: bool = False
|
||||
manualOpenerToolCalls: List[Dict[str, Any]] = Field(default_factory=list)
|
||||
output: Dict[str, Any] = Field(default_factory=dict)
|
||||
bargeIn: Dict[str, Any] = Field(default_factory=dict)
|
||||
services: Dict[str, Dict[str, Any]] = Field(default_factory=dict)
|
||||
|
||||
Reference in New Issue
Block a user