-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat:Add thinking property alongside tool_choice in OpenAPI specification #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughA new property named Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API (OpenAPI Spec)
Client->>API (OpenAPI Spec): Send request with/without 'thinking' property
API (OpenAPI Spec)-->>Client: Responds according to updated schema
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Poem
Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/libs/Cohere/openapi.yaml(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
src/libs/Cohere/openapi.yaml
[error] 7486-7486: trailing spaces
(trailing-spaces)
| format: float | ||
| x-fern-audiences: | ||
| - public | ||
| thinking: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix YAML lint: remove trailing whitespace after key.
The yamllint error is due to the trailing space after thinking:. This will fail CI if linting is enforced.
Apply this diff:
- thinking:
+ thinking:🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 7486-7486: trailing spaces
(trailing-spaces)
🤖 Prompt for AI Agents
In src/libs/Cohere/openapi.yaml at line 7486, there is trailing whitespace after
the key `thinking:` which causes YAML linting errors. Remove the trailing space
immediately following `thinking:` to fix the lint issue and ensure the file
passes CI checks.
🛠️ Refactor suggestion
Define the schema for thinking (type, description, defaults).
Right now thinking: has no schema attributes. In OpenAPI this becomes an unconstrained/“any” type, which hurts validation and codegen.
Consider one of these options:
- If it’s a boolean flag:
- thinking:
+ thinking:
+ type: boolean
+ description: Enable model internal thinking behavior; thinking content is not returned.
+ default: false
+ x-fern-audiences:
+ - public- If it’s a string mode:
- thinking:
+ thinking:
+ type: string
+ description: Controls the model's thinking behavior.
+ enum: [disabled, enabled, auto]
+ default: disabled
+ x-fern-audiences:
+ - publicConfirm the intended semantics and I can update the spec accordingly.
Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 7486-7486: trailing spaces
(trailing-spaces)
🤖 Prompt for AI Agents
In src/libs/Cohere/openapi.yaml at line 7486, the `thinking` property lacks a
defined schema, making it an unconstrained type that impairs validation and code
generation. Determine whether `thinking` is intended as a boolean flag or a
string mode, then update its schema accordingly by specifying the type (boolean
or string), adding a description, and setting any default values if applicable.
| thinking: | ||
| tool_choice: | ||
| enum: | ||
| - REQUIRED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
❓ Verification inconclusive
Verify placement/indentation: ensure thinking is under the correct properties node.
Given the nearby format: float and x-fern-audiences, double‑check that thinking is a sibling property (e.g., alongside tool_choice) and not accidentally nested under another property like temperature. A small indent mistake will change the schema meaning and may pass YAML parse while breaking the OpenAPI structure.
Run structural validation and confirm thinking has a defined type:
Also update the required: array if thinking must be mandatory for this schema.
🏁 Script executed:
#!/bin/bash
set -euo pipefail
pip install --quiet "openapi-spec-validator>=0.7" "pyyaml>=6"
python - <<'PY'
from openapi_spec_validator import validate_spec
from openapi_spec_validator.readers import read_from_filename
fn = "src/libs/Cohere/openapi.yaml"
spec_dict, _ = read_from_filename(fn)
validate_spec(spec_dict)
print("OpenAPI spec structurally valid.")
# Walk the spec to find 'thinking' and report its path and type.
def walk(obj, path):
if isinstance(obj, dict):
for k, v in obj.items():
new_path = path + [k]
if k == "thinking" and isinstance(v, dict):
t = v.get("type")
print("Found 'thinking' at path:", ".".join(new_path), "type:", t)
# Basic guard that it's under a 'properties' subtree
if "properties" not in new_path:
print("WARNING: 'thinking' is not under a 'properties' mapping.")
walk(v, new_path)
elif isinstance(obj, list):
for i, v in enumerate(obj):
walk(v, path + [str(i)])
walk(spec_dict, [])
PYLength of output: 85182
Fix thinking property indentation and type declaration
The OpenAPI spec is failing validation because thinking is defined as null. It must be a sibling under properties (alongside temperature, tool_choice, etc.) and include a type. For example:
• File: src/libs/Cohere/openapi.yaml (around lines 7486–7489)
• Under the POST /v2/chat requestBody schema → properties
Suggested diff:
temperature:
maximum: 1
minimum: 0
type: number
format: float
x-fern-audiences: ['public']
- thinking:
+ thinking:
+ type: boolean
+ description: "<brief description of what thinking represents>"
+ x-fern-audiences: ['public']
tool_choice:
enum:
- REQUIRED
- NONE
description: "…"If thinking must be mandatory, add "thinking" to the schema’s required: array.
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 7486-7486: trailing spaces
(trailing-spaces)
🤖 Prompt for AI Agents
In src/libs/Cohere/openapi.yaml around lines 7486 to 7489, the `thinking`
property is incorrectly defined as null and not properly indented under
`properties` in the POST `/v2/chat` requestBody schema. Move `thinking` to be a
sibling under `properties` alongside `temperature` and `tool_choice`, define its
`type` explicitly (e.g., string or boolean as appropriate), and if `thinking` is
mandatory, add it to the schema's `required` array.
Summary by CodeRabbit