mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-03-15 00:07:28 +00:00
API: Default tool call ID and type
Doing this helps reduce the model's burden of generating the tool call ID and type (which is always "function"). Follow mistral's spec for tool call IDs by using a 9 character alphanumeric string. Signed-off-by: kingbri <8082010+kingbri1@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Dict, Literal
|
||||
from uuid import uuid4
|
||||
|
||||
|
||||
class Function(BaseModel):
|
||||
@@ -29,6 +30,6 @@ class Tool(BaseModel):
|
||||
class ToolCall(BaseModel):
|
||||
"""Represents an OAI tool description."""
|
||||
|
||||
id: str
|
||||
id: str = Field(default_factory=lambda: str(uuid4()).replace("-", "")[:9])
|
||||
function: Tool
|
||||
type: Literal["function"]
|
||||
type: Literal["function"] = "function"
|
||||
|
||||
Reference in New Issue
Block a user