refac
This commit is contained in:
1 parent
93931efaa7
commit
6116c6dca0
2 files changed
+13
-4
No files matched your search
@@ -2198,7 +2198,9 @@ def process_messages_with_output(
|
|||||||
if message.get('role') == 'assistant' and message.get('output'):
|
if message.get('role') == 'assistant' and message.get('output'):
|
||||||
# Use output items for clean OpenAI-format messages
|
# Use output items for clean OpenAI-format messages
|
||||||
output_messages = convert_output_to_messages(
|
output_messages = convert_output_to_messages(
|
||||||
message['output'], raw=True, reasoning_format=reasoning_format,
|
message['output'],
|
||||||
|
raw=True,
|
||||||
|
reasoning_format=reasoning_format,
|
||||||
)
|
)
|
||||||
if output_messages:
|
if output_messages:
|
||||||
processed.extend(output_messages)
|
processed.extend(output_messages)
|
||||||
@@ -4766,10 +4768,14 @@ async def streaming_chat_response_handler(response, ctx):
|
|||||||
system_message = get_system_message(form_data['messages'])
|
system_message = get_system_message(form_data['messages'])
|
||||||
new_form_data['messages'] = (
|
new_form_data['messages'] = (
|
||||||
[system_message] if system_message else []
|
[system_message] if system_message else []
|
||||||
) + convert_output_to_messages(output, raw=True, reasoning_format=get_reasoning_format(model))
|
) + convert_output_to_messages(
|
||||||
|
output, raw=True, reasoning_format=get_reasoning_format(model)
|
||||||
|
)
|
||||||
new_form_data['previous_response_id'] = last_response_id
|
new_form_data['previous_response_id'] = last_response_id
|
||||||
else:
|
else:
|
||||||
tool_messages = convert_output_to_messages(output, raw=True, reasoning_format=get_reasoning_format(model))
|
tool_messages = convert_output_to_messages(
|
||||||
|
output, raw=True, reasoning_format=get_reasoning_format(model)
|
||||||
|
)
|
||||||
|
|
||||||
# Chat Completions providers don't support multimodal
|
# Chat Completions providers don't support multimodal
|
||||||
# tool messages. Extract images into a user message.
|
# tool messages. Extract images into a user message.
|
||||||
@@ -4989,7 +4995,9 @@ async def streaming_chat_response_handler(response, ctx):
|
|||||||
'metadata': metadata,
|
'metadata': metadata,
|
||||||
'messages': [
|
'messages': [
|
||||||
*form_data['messages'],
|
*form_data['messages'],
|
||||||
*convert_output_to_messages(output, raw=True, reasoning_format=get_reasoning_format(model)),
|
*convert_output_to_messages(
|
||||||
|
output, raw=True, reasoning_format=get_reasoning_format(model)
|
||||||
|
),
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -295,6 +295,7 @@ def get_parsed_and_base_url(server_url) -> tuple[urllib.parse.ParseResult, str]:
|
|||||||
@dataclass
|
@dataclass
|
||||||
class ProtectedResourceMetadata:
|
class ProtectedResourceMetadata:
|
||||||
"""RFC 9728 Protected Resource Metadata fields relevant to OAuth flows."""
|
"""RFC 9728 Protected Resource Metadata fields relevant to OAuth flows."""
|
||||||
|
|
||||||
resource: str | None = None
|
resource: str | None = None
|
||||||
authorization_servers: list[str] = field(default_factory=list)
|
authorization_servers: list[str] = field(default_factory=list)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user