Skip to content

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Aug 20, 2025

Summary by CodeRabbit

  • New Features

    • Model details now include rich metadata where available: description, context length, max tokens, pricing, and tags for easier comparison and selection.
  • API

    • Model responses now include an optional metadata field providing the above attributes. This is backward-compatible and will appear only when metadata is available.

@coderabbitai
Copy link

coderabbitai bot commented Aug 20, 2025

Walkthrough

A 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

Cohort / File(s) Summary
OpenAPI schemas
src/libs/DeepInfra/openapi.yaml
Added ModelMetadata schema (required: description, context_length, max_tokens, pricing, tags). Updated ModelOut to include optional metadata: $ref to ModelMetadata.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my ears at fields anew,
Metadata hops into view—
Tags and tokens, priced just right,
Context lengths in morning light.
With schema carrots neatly stacked,
Our models now return exact.
Thump-thump! Another spec intact.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bot/update-openapi_202508200629

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@HavenDV HavenDV enabled auto-merge (squash) August 20, 2025 06:30
@HavenDV HavenDV merged commit 80ceb3a into main Aug 20, 2025
3 of 4 checks passed
@HavenDV HavenDV deleted the bot/update-openapi_202508200629 branch August 20, 2025 06:32
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Add ModelMetadata schema and update ModelOut with optional metadata Aug 20, 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 (2)
src/libs/DeepInfra/openapi.yaml (2)

5940-5968: New ModelMetadata schema added — consider clarifying semantics and tightening constraints

Good 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 mismatch

Two 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 metadata

If 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.

📥 Commits

Reviewing files that changed from the base of the PR and between a051b7b and a5ee900.

⛔ Files ignored due to path filters (6)
  • src/libs/DeepInfra/Generated/DeepInfra.JsonSerializerContextTypes.g.cs is excluded by !**/generated/**
  • src/libs/DeepInfra/Generated/DeepInfra.Models.ModelMetadata.Json.g.cs is excluded by !**/generated/**
  • src/libs/DeepInfra/Generated/DeepInfra.Models.ModelMetadata.g.cs is excluded by !**/generated/**
  • src/libs/DeepInfra/Generated/DeepInfra.Models.ModelMetadataPricing.Json.g.cs is excluded by !**/generated/**
  • src/libs/DeepInfra/Generated/DeepInfra.Models.ModelMetadataPricing.g.cs is excluded by !**/generated/**
  • src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIModelOut.g.cs is 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

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