Skip to content

Commit 4c58ba0

Browse files
committed
add python tool patch
Signed-off-by: Chen Zhang <[email protected]>
1 parent 61bc522 commit 4c58ba0

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

vllm/entrypoints/tool.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
33
import os
44
from abc import ABC, abstractmethod
5-
from typing import TYPE_CHECKING, Any
5+
from typing import TYPE_CHECKING, Any, Optional
6+
7+
from openai_harmony import Message
68

79
from vllm.logger import init_logger
810

@@ -70,7 +72,16 @@ def __init__(self):
7072
"gpt_oss is not installed, code interpreter is disabled")
7173
return
7274

73-
self.python_tool = PythonTool()
75+
# NOTE (Chen): as of gpt-oss 0.0.2, there is a bug in _make_response
76+
# and we do the following monkey patch to fix it.
77+
class PatchedGptOssPythonToolPatch(PythonTool):
78+
79+
def _make_response(self,
80+
output: str,
81+
channel: Optional[str] = None) -> Message:
82+
return super()._make_response(output)
83+
84+
self.python_tool = PatchedGptOssPythonToolPatch()
7485
logger.info_once("Code interpreter tool initialized")
7586

7687
async def get_result(self, context: "ConversationContext") -> Any:

0 commit comments

Comments
 (0)