agentscope-ai / agentscope-ai/QwenPaw

[Feature]: Support OpenAI response format

Aperta
#5,489 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Python
Stelle
34.9k
Fork
3.1k
Merge medio
1g 15h
PR unite (30g)
225

Descrizione

## Summary

Support OpenAI-style response-format messages in the existing message flow.

## Component(s) Affected

- [x] Core / Backend (app, agents, config, providers, utils, local_models)
- [ ] Console (frontend web UI)
- [ ] Channels (DingTalk, Feishu, QQ, Discord, iMessage, etc.)
- [ ] Skills
- [ ] CLI
- [ ] Documentation (website)
- [x] Tests
- [ ] CI/CD
- [ ] Scripts / Deploy

## Problem / Motivation

The current message flow is mainly based on traditional chat messages. However, OpenAI-style response objects can contain structured output such as text items, tool calls, reasoning items, status, usage, and metadata.

If these responses are flattened into plain chat messages too early, useful structured fields may be lost. This makes it harder to support providers or workflows that follow the OpenAI response format.

## Proposed Solution

Add support for OpenAI-style response-format messages.

The implementation should:

- accept response-format messages where message input/output is handled
- preserve structured fields instead of flattening them too early
- keep existing chat message compatibility
- convert to plain text only when required by a downstream component
- add tests for response-format messages, tool calls, and backward compatibility

## Alternatives Considered

- Flatten response-format messages into plain text immediately.
- Handle response objects separately in each provider or workflow.
- Define a custom protocol instead of following the OpenAI response format.

## Additional Context

The goal is to follow the OpenAI response format directly and make it work cleanly with the existing message flow.

## Willing to Contribute

- [x] I am willing to open a PR for this feature (after discussion).

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.