-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat:Add ModelMetadata schema and update ModelOut with optional metadata #213
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 ModelMetadata schema was added to src/libs/DeepInfra/openapi.yaml. The ModelOut schema was updated to include an optional metadata property referencing ModelMetadata. ModelMetadata defines required fields: description, context_length, max_tokens, pricing, and tags. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Client
participant API as DeepInfra API
participant S as Schema: ModelOut
C->>API: GET /models/{id}
API-->>C: 200 OK<br/>Body: ModelOut
Note over S: ModelOut now may include<br/>metadata: ModelMetadata
rect rgba(220,245,255,0.5)
Note right of API: If present, metadata includes<br/>description, context_length,<br/>max_tokens, pricing, tags
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
✨ 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/Issue comments)Type 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: 0
🧹 Nitpick comments (2)
src/libs/DeepInfra/openapi.yaml (2)
5940-5968: New ModelMetadata schema added — consider clarifying semantics and tightening constraintsGood addition. Two refinements to reduce ambiguity and future churn:
- Naming and overlap: ModelMeta already exists; ModelMetadata is easy to confuse. Consider renaming or documenting differences clearly.
- Field alignment: You require both context_length and max_tokens. Elsewhere, OpenRouterModelData uses context_length and max_output_length; ModelOut uses max_tokens for context size. If both are kept, document semantics or relax required fields to account for provider differences.
- Pricing shape: Here it’s a free-form number map, while other parts use strongly typed ModelPricing* schemas. If this metadata will be consumed broadly, consider aligning or at least documenting intended keys/units.
Minimal, non-breaking hardening (constraints + descriptions) within this block:
ModelMetadata: @@ properties: description: title: Description type: string context_length: title: Context Length type: integer + minimum: 1 max_tokens: title: Max Tokens type: integer + minimum: 0 pricing: title: Pricing type: object + description: Free-form pricing map for provider-specific metadata (e.g., per-token rates) additionalProperties: type: number tags: title: Tags type: array items: type: string + description: Classification tags for the model
6779-6781: metadata added to OpenAIModelOut — mark nullable and fix summary mismatchTwo points:
- The PR summary claims ModelOut gained metadata, but the code adds it under OpenAIModelOut. Please confirm intent and adjust summary or schemas accordingly.
- If the server may omit or return null for metadata, mark it nullable. Also avoid placing siblings next to $ref in OAS 3.0 by using allOf.
Apply:
- metadata: - $ref: '#/components/schemas/ModelMetadata' + metadata: + allOf: + - $ref: '#/components/schemas/ModelMetadata' + nullable: true + description: Optional model metadataIf the goal was to expose metadata on ModelOut as well, say the word and I can propose a targeted snippet consistent with existing pricing/max_tokens semantics.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (6)
src/libs/DeepInfra/Generated/DeepInfra.JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.ModelMetadata.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.ModelMetadata.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.ModelMetadataPricing.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.ModelMetadataPricing.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIModelOut.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/DeepInfra/openapi.yaml(2 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
Summary by CodeRabbit
New Features
API