Private
Public Access
Fix: Return NormalizedResponse from send_openai_compatible
This resolves the issue where calling 'send_openai_compatible' discarded the NormalizedResponse details, resulting in an AttributeError when accessing 'raw_response' inside the tool loop.
This commit is contained in:
+6
-1
@@ -732,7 +732,12 @@ def run_with_tool_loop(
|
||||
def _default_send(_round_idx: int) -> NormalizedResponse:
|
||||
from src.openai_compatible import send_openai_compatible as _send_oc
|
||||
assert capabilities is not None, "capabilities required when send_func is not provided"
|
||||
return _send_oc(client, request_builder(_round_idx), capabilities=capabilities)
|
||||
res = _send_oc(client, request_builder(_round_idx), capabilities=capabilities)
|
||||
if not res.ok:
|
||||
if res.errors and res.errors[0].original:
|
||||
raise res.errors[0].original
|
||||
raise RuntimeError(res.errors[0].message if res.errors else "Unknown OpenAI error")
|
||||
return res.data
|
||||
request_builder: Callable[[int], OpenAICompatibleRequest] = (request if callable(request) else (lambda _i: request))
|
||||
dispatch_send: Callable[[int], NormalizedResponse] = send_func or _default_send
|
||||
response_text: str = ""
|
||||
|
||||
Reference in New Issue
Block a user