Skip to content

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Sep 19, 2025

Summary by CodeRabbit

  • New Features
    • Added support for reasoning_text outputs.
    • Introduced summary_text content for concise model summaries.
    • Unified output message content to enable richer, structured responses.
  • Refactor
    • Standardized output content modeling for greater consistency across responses.
  • Documentation
    • Clarified content type descriptions and properties.
    • Added example identifiers (e.g., cuo_123, conv_123, fc_123).
    • Updated cURL/SDK samples with improved formatting.

@coderabbitai
Copy link

coderabbitai bot commented Sep 19, 2025

Walkthrough

Adds new public schemas (OutputMessageContent, ReasoningTextContent, Summary), updates OutputItem.content to use OutputMessageContent, expands allowed output content types to include reasoning_text, wraps an output field in anyOf, and makes minor documentation and example ID updates in src/libs/tryAGI.OpenAI/openapi.yaml.

Changes

Cohort / File(s) Summary of Changes
New content schemas
src/libs/tryAGI.OpenAI/openapi.yaml
Added OutputMessageContent (discriminator wrapper), ReasoningTextContent (reasoning_text), and Summary (summary_text) schemas.
Content reference refactor
src/libs/tryAGI.OpenAI/openapi.yaml
Replaced OutputItem.content items from OutputContent to OutputMessageContent.
Allowed content set broadened
src/libs/tryAGI.OpenAI/openapi.yaml
anyOf for output content now includes ReasoningTextContent.
Output field structure change
src/libs/tryAGI.OpenAI/openapi.yaml
Output field redefined via anyOf wrapper for constraints (maxLength/type/description).
Docs and examples
src/libs/tryAGI.OpenAI/openapi.yaml
Updated descriptions; added example IDs (e.g., cuo_123, conv_123, fc_123); minor curl/SDK formatting tweaks.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant API as OpenAI-compatible API
  participant Model

  Client->>API: Request completion/run
  API->>Model: Invoke model with inputs
  Model-->>API: Output content items
  note over Model,API: Output variants:<br/>- OutputTextContent<br/>- RefusalContent<br/>- ReasoningTextContent<br/>- Summary (summary_text)
  API-->>Client: Response with OutputItem.content[] as OutputMessageContent anyOf

  rect rgba(200,230,255,0.25)
  note right of API: Changed: OutputItem.content now uses<br/>OutputMessageContent discriminator.
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

I nibble specs with whiskered cheer,
New schemas bloom, their types made clear.
Reasoning whispers, summaries chime,
A tidy wrapper right on time.
In YAML fields I hop and play—
Content aligned, we ship today! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title "feat:@coderabbitai" is not descriptive and does not summarize the PR's main changes (which add new OpenAPI schemas like OutputMessageContent, ReasoningTextContent, and Summary and refactor output content references); it reads like a bot/label rather than a concise sentence a reviewer can scan to understand the primary change. Please rename the PR to a concise, informative title that highlights the main change, for example: "Add OutputMessageContent, ReasoningTextContent, and Summary to OpenAPI schema; update OutputItem content references."
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bot/update-openapi_202509190623

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@HavenDV HavenDV merged commit dc37867 into main Sep 19, 2025
2 of 4 checks passed
@HavenDV HavenDV deleted the bot/update-openapi_202509190623 branch September 19, 2025 06:24
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Add public schemas; update OutputItem.content; allow reasoning_text Sep 19, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (4)
src/libs/tryAGI.OpenAI/openapi.yaml (4)

10441-10441: Consider adding a pattern/format for conversation IDs.

Optional: add a pattern like '^[a-z]+_[A-Za-z0-9]+' or a shared schema to enforce ID shape.


15689-15693: anyOf with a single branch adds complexity without value.

If no other branch is intended yet, inline the string schema instead of wrapping it in anyOf. If you plan multiple shapes, keep anyOf but add all intended variants now (e.g., also allow null/object).


24771-24788: Add minimal constraints for text fields.

Optional: enforce non-empty reasoning text via minLength: 1.

       properties:
         text:
           type: string
           description: The reasoning text from the model.
+          minLength: 1

28312-28329: Avoid duplicating Summary vs SummaryTextContent; reuse one schema.

These shapes appear identical; duplication hurts codegen and docs. Prefer a single schema and reference it where needed.

Apply either approach:

  • Replace uses of Summary with SummaryTextContent and remove Summary, or
  • Make Summary a $ref alias to SummaryTextContent.

Example (aliasing Summary to SummaryTextContent):

-    Summary:
-      title: Summary text
-      required:
-        - type
-        - text
-      type: object
-      properties:
-        text:
-          type: string
-          description: A summary of the reasoning output from the model so far.
-        type:
-          enum:
-            - summary_text
-          type: string
-          description: The type of the object. Always `summary_text`.
-          default: summary_text
-          x-stainless-const: true
-      description: A summary text from the model.
+    Summary:
+      $ref: '#/components/schemas/SummaryTextContent'

And at Line 24762:

-            $ref: '#/components/schemas/Summary'
+            $ref: '#/components/schemas/SummaryTextContent'
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d9f058 and 78040e1.

⛔ Files ignored due to path filters (28)
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI..JsonSerializerContext.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ContentItem.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.OutputContent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.OutputMessageContent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ReasoningTextContentType.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.ReasoningTextContentTypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.SummaryType.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.SummaryTypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonSerializerContextTypes.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ComputerCallOutputItemParam.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ContentItem.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ConversationParam.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.FunctionCallOutputItemParam.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.OutputContent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.OutputMessage.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.OutputMessageContent.Json.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.OutputMessageContent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.OutputMessageContentDiscriminator.Json.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.OutputMessageContentDiscriminator.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ReasoningItem.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ReasoningTextContent.Json.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ReasoningTextContent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ReasoningTextContentType.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.Summary.Json.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.Summary.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.SummaryTextContent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.SummaryTextContentType.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.SummaryType.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/tryAGI.OpenAI/openapi.yaml (13 hunks)
🔇 Additional comments (7)
src/libs/tryAGI.OpenAI/openapi.yaml (7)

17765-17765: Adding ReasoningTextContent here is good—ensure it’s reachable via message unions.

If reasoning content is meant to appear inside OutputItem.content, confirm OutputMessageContent’s union includes it (see comments below on duplicate defs).


18840-18840: LGTM pending union fix.

Referencing OutputMessageContent from OutputItem.content aligns the model message shape.

Ensure the union above is de-duplicated so codegen resolves this ref correctly.


24743-24744: LGTM.

Reasoning content array correctly references ReasoningTextContent.


24762-24763: LGTM.

Reasoning summary array added as intended.


28339-28345: LGTM.

Doc tweaks for SummaryTextContent look good.


9976-9976: Confirm 'cuo_' ID prefix consistency.
Single occurrence at src/libs/tryAGI.OpenAI/openapi.yaml:9976 (example: cuo_123). The spec otherwise uses prefixes like conv_, resp_, msg_, fc_, event_. Confirm cuo_ is intentional or align the example to the established prefix for this object.


18804-18810: Incorrect — no duplicate OutputMessageContent found.

Single definition exists at src/libs/tryAGI.OpenAI/openapi.yaml:18866; no second definition or conflicting omission of ReasoningTextContent was observed.

Likely an incorrect or invalid review comment.

examples:
request:
curl: "curl -X POST https://api.openai.com/v1/fine_tuning/alpha/graders/run \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"grader\": {\n \"type\": \"score_model\",\n \"name\": \"Example score model grader\",\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": \"Score how close the reference answer is to the model answer. Score 1.0 if they are the same and 0.0 if they are different. Return just a floating point score\\n\\nReference answer: {{item.reference_answer}}\\n\\nModel answer: {{sample.output_text}}\"\n }\n ],\n \"model\": \"gpt-4o-2024-08-06\",\n \"sampling_params\": {\n \"temperature\": 1,\n \"top_p\": 1,\n \"seed\": 42\n }\n },\n \"item\": {\n \"reference_answer\": \"fuzzy wuzzy was a bear\"\n },\n \"model_sample\": \"fuzzy wuzzy was a bear\"\n }'\n"
curl: "curl -X POST https://api.openai.com/v1/fine_tuning/alpha/graders/run \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -d '{\n \"grader\": {\n \"type\": \"score_model\",\n \"name\": \"Example score model grader\",\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": \"Score how close the reference answer is to the model\nanswer. Score 1.0 if they are the same and 0.0 if they are different. Return just a floating point score\\n\\nReference answer: {{item.reference_answer}}\\n\\nModel answer: {{sample.output_text}}\"\n }\n ],\n \"model\": \"gpt-4o-2024-08-06\",\n \"sampling_params\": {\n \"temperature\": 1,\n \"top_p\": 1,\n \"seed\": 42\n }\n },\n \"item\": {\n \"reference_answer\": \"fuzzy wuzzy was a bear\"\n },\n \"model_sample\": \"fuzzy wuzzy was a bear\"\n }'\n"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

🧩 Analysis chain

cURL example may embed an unescaped newline inside JSON.

Ensure the "content" string in the curl -d body uses escaped "\n" rather than a literal line break; otherwise the JSON becomes invalid in copy/paste contexts.

Run to sanity-check the JSON payload extracted from the example:


🏁 Script executed:

#!/bin/bash
# Extract the curl example and validate JSON bodies it contains
rg -nA2 -C0 'fine_tuning/alpha/graders/run' src/libs/tryAGI.OpenAI/openapi.yaml
# Manually copy the -d '{ ... }' snippet from the output and run:
python - <<'PY'
import json,sys,re
s=sys.stdin.read()
# Grab the JSON between the single quotes after -d
m=re.search(r"-d\s*'(\{.*\})'", s, re.S)
if not m: 
  print("No JSON found"); sys.exit(1)
try:
  json.loads(m.group(1))
  print("OK: JSON parses")
except Exception as e:
  print("Invalid JSON:", e)
PY

Length of output: 1017


Escape literal newline in the curl JSON example

The curl -d body in src/libs/tryAGI.OpenAI/openapi.yaml (endpoint /fine_tuning/alpha/graders/run, around line 2331) contains a literal line break inside the "content" string; replace the literal break with an escaped "\n" so the JSON parses when copied.

🤖 Prompt for AI Agents
In src/libs/tryAGI.OpenAI/openapi.yaml around line 2331, the curl -d JSON
example for the /fine_tuning/alpha/graders/run endpoint contains a literal
newline inside the "content" string; replace that literal line break with an
escaped "\\n" sequence so the JSON remains a single-line string and parses
correctly when copied into a shell command, ensuring any other internal newlines
in JSON examples are similarly escaped.

Comment on lines 15694 to 15695
type: 'null'
nullable: true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

🧩 Analysis chain

Check OpenAPI version before using type: 'null'.

type: null is valid in OAS 3.1, not 3.0 (which uses nullable: true). Ensure the spec header is 3.1 or adjust accordingly.


🏁 Script executed:

#!/bin/bash
rg -nP '^openapi:\s*3\.\d+\.\d+' src/libs/tryAGI.OpenAI/openapi.yaml

Length of output: 16


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE=src/libs/tryAGI.OpenAI/openapi.yaml

echo "OpenAPI header (file + match):"
rg -nP '^openapi:\s*3\.\d+\.\d+' "$FILE" || true
echo

echo "Matches for lines with 'type:' that mention 'null' (with 2 lines context):"
rg -nP -n -C2 '^\s*type:\s*[^#]*null' "$FILE" || true
echo

echo "Repository-wide 'type:' lines mentioning 'null' (file:line):"
rg -nP '^\s*type:\s*[^#]*null' || true

Length of output: 5055


Fix invalid use of type: 'null' — upgrade to OpenAPI 3.1 or replace with nullable: true.

openapi header is 3.0.4; OAS 3.0 does not support type: 'null' — either set the spec header to 3.1.0 or remove all type: 'null' usages and use nullable: true with an appropriate base type. File: src/libs/tryAGI.OpenAI/openapi.yaml (multiple occurrences; e.g. lines 7643, 8959, 15694).

🤖 Prompt for AI Agents
In src/libs/tryAGI.OpenAI/openapi.yaml around lines 7643, 8959, 15694 (and other
occurrences), the spec uses type: 'null' which is invalid for OpenAPI 3.0.4;
either update the openapi header to "3.1.0" if you want native null types, or
(preferred for minimal change) remove type: 'null' entries and instead declare
the property with the appropriate base type (e.g., string, integer, object) and
add nullable: true; apply this change consistently across all occurrences in the
file so the spec validates under OpenAPI 3.0.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants