Skip to content

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Oct 15, 2025

Summary by CodeRabbit

  • New Features

    • Added JSON response mode and schema-based response formatting.
    • Introduced adjustable thinking controls (boolean or high/medium/low).
    • Exposed federated source metadata (remote model and host) in model and generation responses.
    • Expanded model creation options (source, files, adapters, template, system, parameters).
    • Added tool metadata: tool name on messages and index for tool call ordering.
  • Improvements

    • Increased flexibility with nullable fields across requests/responses.
    • Consistent support for remote model metadata across chat, generate, and embedding workflows.

@HavenDV HavenDV enabled auto-merge (squash) October 15, 2025 15:25
@coderabbitai
Copy link

coderabbitai bot commented Oct 15, 2025

Walkthrough

OpenAPI schema in src/libs/Ollama/openapi.yaml was updated: response format now uses oneOf and supports JSON/object with nullability; “think” controls were generalized; federated metadata fields (remote_model, remote_host) were added across requests/responses/models; CreateModelRequest gained several nullable properties; tool metadata fields were added; various descriptions updated.

Changes

Cohort / File(s) Summary
Response format schema
src/libs/Ollama/openapi.yaml
Replaced single $ref for ResponseFormat with oneOf (enum json or object schema), and made fields nullable across generate/chat schemas.
Thinking controls
src/libs/Ollama/openapi.yaml
Updated think to accept boolean or enum (high/medium/low); added nullable think fields plus truncate/shift fields with revised descriptions in generate/chat flows.
Federated/remote metadata
src/libs/Ollama/openapi.yaml
Added nullable remote_model and remote_host to responses and model-related schemas (e.g., GenerateCompletionResponse, GenerateChatCompletionResponse, Model, ModelDetails, and related).
CreateModelRequest expansion
src/libs/Ollama/openapi.yaml
modelfile made nullable; added from, files, adapters, template, system, parameters (all nullable) to support richer model creation.
Tooling metadata
src/libs/Ollama/openapi.yaml
Added tool_name to Message; added index to ToolCallFunctionArgs and ToolCallFunction for tool call sequencing.
Embedding schemas (where applicable)
src/libs/Ollama/openapi.yaml
Propagated remote_model/remote_host fields to embedding-related request/response areas (nullable).

Sequence Diagram(s)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I twitch my whiskers at YAML lines,
New fields sprout up like springtime signs—
Remote burrows, tools in queue,
Thinky hops: high, medium, low too.
Models built from bits that flow,
OneOf trails where schemas go.
Thump! Approved—onward we go. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title “feat:@coderabbitai” does not describe any of the schema enhancements made in this pull request and is unrelated to the actual updates in the OpenAPI specification. It fails to convey the primary changes such as adding nullable remote_model and remote_host fields, tool metadata, and generalized response formatting. As a result, it provides no meaningful context to reviewers scanning the project history. Please revise the pull request title to clearly summarize the main changes, for example “feat(openapi): add federated model metadata and enrich response formatting support”.
✅ 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_202510151525

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.

@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:OpenAPI: oneOf responses, nullable JSON, federated and tool metadata 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

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

313-329: Unify and harden the think union; add DRY schema and validate codegen.

  • Mixed boolean|string enum unions can trip some generators. Consider a shared component to keep consistency, and add examples.
  • Add notes on precedence if both boolean and string are provided by clients (server behavior).

Suggested component and reuse:

@@
+    ThinkOption:
+      nullable: true
+      oneOf:
+        - type: boolean
+        - type: string
+          enum: [high, medium, low]
+      description: "Controls whether thinking/reasoning models will think before responding."
@@ GenerateCompletionRequest.properties
-        think:
-          oneOf:
-            - type: boolean
-            - enum:
-                - high
-                - medium
-                - low
-              type: string
-          description: "Controls whether thinking/reasoning models will think before responding.\nCan be:\n- boolean: true/false to enable/disable thinking\n- string: \"high\", \"medium\", \"low\" to set thinking intensity level\n"
-          nullable: true
+        think:
+          $ref: '#/components/schemas/ThinkOption'
@@ GenerateChatCompletionRequest.properties
-        think:
-          oneOf:
-            - type: boolean
-            - enum:
-                - high
-                - medium
-                - low
-              type: string
-          description: "Controls whether thinking/reasoning models will think before responding.\nCan be:\n- boolean: true/false to enable/disable thinking\n- string: \"high\", \"medium\", \"low\" to set thinking intensity level\n"
-          nullable: true
+        think:
+          $ref: '#/components/schemas/ThinkOption'

Please verify your generators (e.g., openapi-generator, swagger-codegen) handle boolean|string oneOf as expected.

Also applies to: 594-610


543-551: Remote metadata: add URI format and consider a reusable mixin.

  • remote_host should use format: uri and ideally include examples.
  • Consider a small component (e.g., RemoteMetadata with remote_model/remote_host) and allOf compose it where needed to avoid drift.

Example tweak:

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

Optionally:

RemoteMetadata:
  type: object
  properties:
    remote_model:
      type: string
      nullable: true
      description: Name of the upstream remote model
    remote_host:
      type: string
      format: uri
      nullable: true
      description: URL of the upstream Ollama host

Then use allOf: [ { $ref: '#/components/schemas/RemoteMetadata' }, { ...existing schema... } ].

Also applies to: 665-673, 912-919, 1095-1102


716-719: tool_name conditionality.

Consider expressing (if feasible) that tool_name is required when role=tool. In OAS 3.0 this is awkward; a pragmatic alternative is to add guidance and an example. If you move to OAS 3.1, you can use dependentRequired or if/then/else.


769-772: Constrain index and add example.

Add minimum: 0 and clarify zero-based indexing; optionally add example for streaming order.

         index:
           type: integer
+          minimum: 0
           description: The index of the tool call in the list of tool calls
📜 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 3c89a75.

⛔ Files ignored due to path filters (42)
  • 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.IModelsClient.CreateModel.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.CreateModelRequest.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestAdapters.Json.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestAdapters.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestFiles.Json.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestFiles.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestParameters.Json.g.cs is excluded by !**/generated/**
  • src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestParameters.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/Ollama.ModelsClient.CreateModel.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 (12 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 (3)
src/libs/Ollama/openapi.yaml (3)

287-287: LGTM: clarified raw description.

Good clarification; no functional/schema impact.


823-823: Require at least one source in CreateModelRequest schema
Add an anyOf under CreateModelRequest to enforce presence of one of modelfile, path, from, files, or adapters, matching server expectations.


468-475: DRY response format via $ref; relocate default from oneOf subschema

  • Replace duplicated inline schemas with $ref: '#/components/schemas/ResponseFormat'.
  • Although OpenAPI allows default in a oneOf branch, many generators ignore it—move the default to the parent format property or component and validate with your target generator(s).

Also applies to lines 289–299 and 572–581.

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