Unverified Commit 4da8bf20 authored by Chen Zhang's avatar Chen Zhang Committed by GitHub
Browse files

[Tool] Fix auto tool call (#22434)


Signed-off-by: default avatarChen Zhang <zhangch99@outlook.com>
parent 7e0b1218
...@@ -132,9 +132,6 @@ class OpenAIServingResponses(OpenAIServing): ...@@ -132,9 +132,6 @@ class OpenAIServingResponses(OpenAIServing):
"\"auto\" tool choice has been enabled please note that while" "\"auto\" tool choice has been enabled please note that while"
" the parallel_tool_calls client option is preset for " " the parallel_tool_calls client option is preset for "
"compatibility reasons, it will be ignored.") "compatibility reasons, it will be ignored.")
if not self.use_harmony:
raise NotImplementedError("Auto tool choice is not supported "
"yet unless using Harmony")
# HACK(woosuk): This is a hack. We should use a better store. # HACK(woosuk): This is a hack. We should use a better store.
# FIXME: If enable_store=True, this may cause a memory leak since we # FIXME: If enable_store=True, this may cause a memory leak since we
...@@ -212,8 +209,8 @@ class OpenAIServingResponses(OpenAIServing): ...@@ -212,8 +209,8 @@ class OpenAIServingResponses(OpenAIServing):
await self._make_request(request, prev_response, await self._make_request(request, prev_response,
tokenizer)) tokenizer))
except (ValueError, TypeError, RuntimeError, except (ValueError, TypeError, RuntimeError, jinja2.TemplateError,
jinja2.TemplateError) as e: NotImplementedError) as e:
logger.exception("Error in preprocessing prompt inputs") logger.exception("Error in preprocessing prompt inputs")
return self.create_error_response(f"{e} {e.__cause__}") return self.create_error_response(f"{e} {e.__cause__}")
...@@ -313,6 +310,9 @@ class OpenAIServingResponses(OpenAIServing): ...@@ -313,6 +310,9 @@ class OpenAIServingResponses(OpenAIServing):
prev_response: Optional[ResponsesResponse], prev_response: Optional[ResponsesResponse],
tokenizer: AnyTokenizer, tokenizer: AnyTokenizer,
): ):
if len(request.tools) > 0:
raise NotImplementedError(
"Tool use is not supported in Responses API without Harmony")
# Construct the input messages. # Construct the input messages.
messages = self._construct_input_messages(request, prev_response) messages = self._construct_input_messages(request, prev_response)
_, request_prompts, engine_prompts = await self._preprocess_chat( _, request_prompts, engine_prompts = await self._preprocess_chat(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment