API: Add tool_call_id for role = tool
If a message with role = tool is present, the tool_call_id should also be given to the template. Signed-off-by: kingbri <8082010+kingbri1@users.noreply.github.com>
This commit is contained in:
parent
1c3f84151f
commit
3dfa965019
2 changed files with 1 additions and 5 deletions
|
|
@ -1,5 +1,4 @@
|
|||
from pydantic import AliasChoices, BaseModel, Field, field_validator
|
||||
from pydantic.json_schema import SkipJsonSchema
|
||||
from time import time
|
||||
from typing import Literal, Union, List, Optional, Dict
|
||||
from uuid import uuid4
|
||||
|
|
@ -32,7 +31,7 @@ class ChatCompletionMessage(BaseModel):
|
|||
role: str = "user"
|
||||
content: Optional[Union[str, List[ChatCompletionMessagePart]]] = None
|
||||
tool_calls: Optional[List[ToolCall]] = None
|
||||
tool_calls_json: SkipJsonSchema[Optional[str]] = None
|
||||
tool_call_id: Optional[str] = None
|
||||
|
||||
|
||||
class ChatCompletionRespChoice(BaseModel):
|
||||
|
|
|
|||
|
|
@ -237,9 +237,6 @@ async def format_messages_with_template(
|
|||
# Convert the message content into a concatenated string
|
||||
message.content = concatenated_content
|
||||
|
||||
if message.tool_calls:
|
||||
message.tool_calls_json = ToolCallProcessor.to_json(message.tool_calls)
|
||||
|
||||
message_dicts.append(message.model_dump(exclude_none=True))
|
||||
|
||||
# Get all special tokens
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue