Skip to content

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Oct 15, 2025

Summary by CodeRabbit

  • New Features
    • Federation metadata exposed in responses and model info (remote_model, remote_host).
    • Tooling metadata added: tool_name on messages and index on tool call functions/args.
  • Improvements
    • Flexible response formatting: choose simple “json” mode or provide a full JSON Schema.
    • Enhanced thinking controls: think now supports boolean or levels (“high”, “medium”, “low”) and is nullable.
    • New truncate option (nullable) to manage output length.
    • Clarified and nullable shift behavior to better reflect context-window handling.

@coderabbitai
Copy link

coderabbitai bot commented Oct 15, 2025

Walkthrough

The OpenAPI spec was updated to add federation metadata fields (remote_model, remote_host), expand format handling via oneOf for JSON mode or JSON Schema, enhance thinking controls (think, truncate, shift), introduce tool metadata (tool_name, index), and adjust descriptions across related request/response/components.

Changes

Cohort / File(s) Summary
Federation metadata fields
src/libs/Ollama/openapi.yaml
Added nullable remote_model and remote_host to model info, model details, copy/list structures, and to completion/chat/embedding responses.
Format handling updates
src/libs/Ollama/openapi.yaml
Replaced ResponseFormat refs with oneOf supporting "json" enum or JSON Schema object; format fields made nullable; descriptions updated.
Thinking controls
src/libs/Ollama/openapi.yaml
think accepts boolean or enum ("high","medium","low"), now nullable; added truncate (boolean, nullable); updated shift description and nullable status.
Tool metadata and indexing
src/libs/Ollama/openapi.yaml
Added tool_name to Message (nullable); added index to ToolCallFunction and ToolCallFunctionArgs (nullable).
Description/wording refinements
src/libs/Ollama/openapi.yaml
Streamlined descriptions to reflect federation metadata, JSON schema output, and context/think/shift semantics.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant A as API (Ollama)
  participant U as Upstream Model (Federation)

  rect rgb(238,245,255)
    note over C,A: Chat/Completion Request
    C->>A: POST /chat|/generate<br/>params: format(oneOf), think(enum|bool), truncate?, shift?
  end

  alt Federation path
    A->>U: Forward request (model)
    U-->>A: Response tokens + metadata
    A-->>C: Response + remote_model, remote_host
  else Local path
    A-->>C: Response (no remote_* set)
  end

  opt Tools
    A-->>C: tool_calls[index], message.tool_name
    C->>A: Tool results (by index)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I thump the keys with whiskered grace,
New schemas hop through open space—
Remote burrows: host and model found,
JSON blooms where formats abound.
Think high or low, we trim and shift,
Tools in tow, indexes swift—
A federated warren, neat and swift. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title "feat:@coderabbitai" does not reflect any of the changes described in the pull request, which focus on adding federation metadata fields and enhancing format and thinking controls in the OpenAPI specification. It is not specific or clear and does not convey the PR’s main purpose to reviewers. Such a title fails to help a teammate scanning history quickly understand the primary change. Please revise the title to clearly summarize the addition of federation metadata fields and enhancements to format and thinking controls in the OpenAPI spec. For example, “feat(openapi): add remote_model and remote_host fields and enhance format and thinking controls” so reviewers can quickly understand the primary change.
✅ 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 (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bot/update-openapi_202510151255

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 enabled auto-merge (squash) October 15, 2025 12:56
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Update OpenAPI: add federation metadata, format oneOf, thinking, tools Oct 15, 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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/libs/Ollama/openapi.yaml (1)

466-474: Replace inline ResponseFormat definitions with shared component
Remove the inlined ResponseFormat schemas at lines 289–298, 466–474, and 571–579 and replace each with:

$ref: '#/components/schemas/ResponseFormat'
🧹 Nitpick comments (9)
src/libs/Ollama/openapi.yaml (9)

289-298: Deduplicate inline format schema using the shared component.
Avoid drift by referencing ResponseFormat; wrap with allOf to keep nullable at the field level.

Apply:

-        format:
-          oneOf:
-            - enum:
-                - json
-              type: string
-              description: Enable JSON mode
-            - type: object
-              description: JSON schema object for structured output validation
-          description: "The format to return a response in. Can be:\n- \"json\" string to enable JSON mode\n- JSON schema object for structured output validation\n"
-          nullable: true
+        format:
+          allOf:
+            - $ref: '#/components/schemas/ResponseFormat'
+          nullable: true

322-325: Clarify truncate vs shift precedence and defaults.
When both are provided, which wins? Any default behavior? Add a short note to prevent client ambiguity.

Also applies to: 327-329, 602-605, 606-609


542-550: Add URI format to remote_host.
Helps validation and codegen.

Apply:

         remote_host:
           type: string
           description: URL of the upstream Ollama host that served the request (when proxying to remote instances)
+          format: uri
           nullable: true

571-579: Reuse ResponseFormat component here as well.
Same dedupe as in /generate request.

Apply:

-        format:
-          oneOf:
-            - enum:
-                - json
-              type: string
-              description: Enable JSON mode
-            - type: object
-              description: JSON schema object for structured output validation
-          description: "The format to return a response in. Can be:\n- \"json\" string to enable JSON mode\n- JSON schema object for structured output validation\n"
-          nullable: true
+        format:
+          allOf:
+            - $ref: '#/components/schemas/ResponseFormat'
+          nullable: true

663-671: Add URI format to remote_host (chat response).
Consistent with completion response.

Apply:

         remote_host:
           type: string
           description: URL of the upstream Ollama host that served the request (when proxying to remote instances)
+          format: uri
           nullable: true

714-718: Optional: add an example for tool_name.
Improves SDKs and docs.

Apply:

         tool_name:
           type: string
           description: The name of the tool when role is "tool" (used in tool response messages)
           nullable: true
+          example: get_weather

767-770: Constrain index to non-negative.
Tool call indices should be >= 0.

Apply:

         index:
           type: integer
           description: The index of the tool call in the list of tool calls
+          minimum: 0

882-890: Add URI format to remote_host (Model).
Assists validation and client generation.

Apply:

         remote_host:
           type: string
           description: URL of the upstream Ollama host (when model is federated from another instance)
+          format: uri
           nullable: true

1065-1073: Add URI format to remote_host (ModelInfo).
Keep remote_host consistently typed.

Apply:

         remote_host:
           type: string
           description: URL of the upstream Ollama host (when model is federated from another instance)
+          format: uri
           nullable: true
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b176606 and 7ac43ae.

⛔ Files ignored due to path filters (33)
  • src/libs/Ollama/Generated/Ollama..JsonSerializerContext.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.IChatClient.GenerateChatCompletion.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.ICompletionsClient.GenerateCompletion.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestFormatEnum.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestFormatEnumNullable.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestThink.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestThinkNullable.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestFormatEnum.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestFormatEnumNullable.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestThink.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestThinkNullable.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.JsonConverters.OneOf2.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.JsonSerializerContextTypes.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestFormatEnum.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestFormatEnum2.Json.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestFormatEnum2.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestThink.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestFormatEnum.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestFormatEnum2.Json.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestFormatEnum2.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestThink.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionResponse.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.Message.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.Model.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.ModelInfo.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.ToolCallFunction.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/OneOf.2.Json.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/OneOf.2.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/Ollama/openapi.yaml (10 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Test / Build, test and publish
🔇 Additional comments (4)
src/libs/Ollama/openapi.yaml (4)

287-287: Doc tweak looks good.
Clearer raw description.


312-321: LGTM: flexible think control.
Boolean or tiered string is clear; nullable is appropriate.


592-601: LGTM: chat think control.
Matches completion semantics.


775-809: Confirm whether embeddings responses need federation metadata.
If embeddings can be proxied/federated, consider adding remote_model/remote_host for parity. If not, ignore.

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