[gpt-oss] Small bug fixes for frontend (#22512)
Signed-off-by: Chen Zhang <zhangch99@outlook.com>
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
import os
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
from openai_harmony import Message
|
||||
|
||||
from vllm.logger import init_logger
|
||||
|
||||
@@ -70,7 +72,16 @@ class HarmonyPythonTool(Tool):
|
||||
"gpt_oss is not installed, code interpreter is disabled")
|
||||
return
|
||||
|
||||
self.python_tool = PythonTool()
|
||||
# NOTE (Chen): as of gpt-oss 0.0.2, there is a bug in _make_response
|
||||
# and we do the following monkey patch to fix it.
|
||||
class PatchedGptOssPythonTool(PythonTool):
|
||||
|
||||
def _make_response(self,
|
||||
output: str,
|
||||
channel: Optional[str] = None) -> Message:
|
||||
return super()._make_response(output)
|
||||
|
||||
self.python_tool = PatchedGptOssPythonTool()
|
||||
logger.info_once("Code interpreter tool initialized")
|
||||
|
||||
async def get_result(self, context: "ConversationContext") -> Any:
|
||||
|
||||
Reference in New Issue
Block a user