-
-
Notifications
You must be signed in to change notification settings - Fork 14
feat:Update OpenAPI: add federation metadata, format oneOf, thinking, tools #142
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe 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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
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: 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 inlinedResponseFormatschemas 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
⛔ Files ignored due to path filters (33)
src/libs/Ollama/Generated/Ollama..JsonSerializerContext.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.IChatClient.GenerateChatCompletion.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.ICompletionsClient.GenerateCompletion.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestFormatEnum.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestFormatEnumNullable.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestThink.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestThinkNullable.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestFormatEnum.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestFormatEnumNullable.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestThink.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestThinkNullable.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.JsonConverters.OneOf2.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestFormatEnum.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestFormatEnum2.Json.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestFormatEnum2.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestThink.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestFormatEnum.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestFormatEnum2.Json.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestFormatEnum2.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestThink.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionResponse.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.Models.Message.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.Models.Model.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.Models.ModelInfo.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/Ollama.Models.ToolCallFunction.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/OneOf.2.Json.g.csis excluded by!**/generated/**src/libs/Ollama/Generated/OneOf.2.g.csis 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.
Summary by CodeRabbit