linrrzqqq opened a new pull request, #67671:
URL: https://github.com/apache/doris/pull/67671
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
The Responses API returns heterogeneous items in the `output` array. Besides
the final `message`, it may contain `reasoning` and tool-related items.
The previous OpenAI adapter treated every output item as response text. This
caused two problems:
1. An OpenAI-type reasoning item with an empty `content` array was reported
as an
invalid response.
2. An OpenAI-type `reasoning_text` item was incorrectly included in batch
results,
causing errors such as `expected 1 items but got 2`.
This change updates the Responses API parser to:
- Ignore non-`message` output items, including reasoning and tool items.
- Only extract `output_text` parts from message content.
- Preserve validation for malformed message and output-text structures.
- Update the response format comments to match the current API structure.
for example:
```sql
CREATE RESOURCE 'deepseek-responses'
PROPERTIES (
'type'='ai',
'ai.provider_type'='deepseek',
'ai.endpoint'='https://api.deepseek.com/responses',
'ai.model_name' = 'deepseek-v4-flash',
'ai.api_key' = 'sk-xxx'
);
SELECT id, ai_TRANSLATE('deepseek-responses', str_val, tar_language) AS
Result
FROM ai_test WHERE str_val IS NOT NULL;
```
before:
```text
```
now
```text
+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | Result
|
+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 4 | Satz 4, Apache Doris ist ein MPP-basiertes Echtzeit-Data-Warehouse,
das für seine hohe Abfragegeschwindigkeit bekannt ist.
|
| 3 | phrase 3, Apache Doris est un entrepôt de données en temps réel
basé sur MPP, connu pour sa vitesse de requête élevée.
|
| 6 | предложение 6, Apache Doris — это хранилище данных реального
времени на основе MPP, известное высокой скоростью выполнения запросов.
|
| 2 | 句子2:Apache Doris 是一个基于 MPP 的实时数据仓库,以高查询速度著称。
|
| 5 | 文5、Apache DorisはMPPベースのリアルタイムデータウェアハウスであり、高速なクエリ処理で知られています。
|
| 8 | Frase 8, Apache Doris é um data warehouse em tempo real baseado em
MPP, conhecido por sua alta velocidade de consulta.
|
| 9 | 문장 9, Apache Doris는 높은 쿼리 속도로 알려진 MPP 기반 실시간 데이터 웨어하우스입니다.
|
| 1 | sentence 1, Apache Doris is an MPP-based real-time data warehouse
known for its high query speed.
|
| 7 | oración 7, Apache Doris es un almacén de datos en tiempo real
basado en MPP conocido por su alta velocidad de consulta.
|
| 10 | الجملة 10، Apache Doris هو مستودع بيانات في الوقت الفعلي يعتمد على
MPP ويُعرف بسرعته العالية في معالجة الاستعلامات.
|
+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
```
### Release note
Fix parsing of OpenAI-compatible Responses API results containing reasoning
output.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]