[Mistral Grammar] Fix tool and reasoning parsing (#39217)
Signed-off-by: juliendenize <julien.denize@mistral.ai>
This commit is contained in:
@@ -11,7 +11,7 @@ from openai.types.chat.chat_completion_audio import (
|
||||
ChatCompletionAudio as OpenAIChatCompletionAudio,
|
||||
)
|
||||
from openai.types.chat.chat_completion_message import Annotation as OpenAIAnnotation
|
||||
from pydantic import Field, model_validator
|
||||
from pydantic import Field, PrivateAttr, model_validator
|
||||
|
||||
from vllm.config import ModelConfig
|
||||
from vllm.config.utils import replace
|
||||
@@ -398,6 +398,9 @@ class ChatCompletionRequest(OpenAIBaseModel):
|
||||
msg["tool_calls"] = list(tool_calls)
|
||||
return self
|
||||
|
||||
_grammar_from_tool_parser: bool = PrivateAttr(default=False)
|
||||
"""CAUTION: Should only be set by ``ToolParser.adjust_request``."""
|
||||
|
||||
def build_chat_params(
|
||||
self,
|
||||
default_template: str | None,
|
||||
@@ -822,13 +825,6 @@ class ChatCompletionRequest(OpenAIBaseModel):
|
||||
|
||||
return data
|
||||
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def set_include_reasoning_for_none_effort(cls, data: Any) -> Any:
|
||||
if data.get("reasoning_effort") == "none":
|
||||
data["include_reasoning"] = False
|
||||
return data
|
||||
|
||||
|
||||
class BatchChatCompletionRequest(OpenAIBaseModel):
|
||||
"""Request model for the /v1/chat/completions/batch endpoint.
|
||||
|
||||
Reference in New Issue
Block a user