-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat:Add new API endpoints for Lora model upload and deletion in DeepApi #88
Conversation
WalkthroughThe changes introduce new API endpoints to the DeepApi OpenAPI specification. Two endpoints are added: Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
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: 1
🧹 Outside diff range and nitpick comments (2)
src/libs/DeepInfra/openapi.yaml (2)
795-831
: Consider enhancing the endpoint documentation and error responses.The POST
/lora-model
endpoint could benefit from the following improvements:
- Add a detailed description explaining the purpose and behavior of the Lora model upload.
- Include additional standard response codes:
- 401 for unauthorized access attempts
- 403 for forbidden access (e.g., rate limiting)
- 409 for potential naming conflicts
Apply this diff to enhance the endpoint:
/lora-model: post: summary: Upload Lora Model + description: Upload a new Lora model to be used with a base model. The Lora model must be compatible with the specified base model. operationId: upload_lora_model_lora_model_post parameters: - name: xi-api-key in: header schema: title: Xi-Api-Key type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/LoraModelUploadIn' required: true responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/ModelOut' '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/DeepError' + '401': + description: Unauthorized - Invalid or missing API key + content: + application/json: + schema: + $ref: '#/components/schemas/DeepError' + '403': + description: Forbidden - Rate limit exceeded or insufficient permissions + content: + application/json: + schema: + $ref: '#/components/schemas/DeepError' + '409': + description: Conflict - Lora model name already exists + content: + application/json: + schema: + $ref: '#/components/schemas/DeepError' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError'
832-867
: Enhance the delete endpoint documentation and error responses.The DELETE
/lora-model/{lora_model_name}
endpoint could benefit from the following improvements:
- Add a detailed description explaining the deletion behavior and its implications.
- Include additional standard response codes:
- 401 for unauthorized access attempts
- 404 for non-existent Lora models
Apply this diff to enhance the endpoint:
'/lora-model/{lora_model_name}': delete: summary: Delete Lora Model + description: Permanently delete a Lora model. This operation cannot be undone. Ensure the model is not being used by any active deployments before deletion. operationId: delete_lora_model_lora_model__lora_model_name__delete parameters: - name: lora_model_name in: path required: true schema: title: Lora Model Name type: string + description: The unique name of the Lora model to delete - name: xi-api-key in: header schema: title: Xi-Api-Key type: string responses: '200': description: Successful Response content: application/json: schema: { } '400': description: Bad Request content: application/json: schema: $ref: '#/components/schemas/DeepError' + '401': + description: Unauthorized - Invalid or missing API key + content: + application/json: + schema: + $ref: '#/components/schemas/DeepError' + '404': + description: Not Found - Lora model does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/DeepError' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError'
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (9)
src/libs/DeepInfra/Generated/DeepInfra.DeepInfraApi.DeleteLoraModel.g.cs
is excluded by!**/generated/**
src/libs/DeepInfra/Generated/DeepInfra.DeepInfraApi.UploadLoraModel.g.cs
is excluded by!**/generated/**
src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraApi.DeleteLoraModel.g.cs
is excluded by!**/generated/**
src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraApi.UploadLoraModel.g.cs
is excluded by!**/generated/**
src/libs/DeepInfra/Generated/DeepInfra.Models.DeleteLoraModelLoraModelLoraModelNameDeleteResponse.Json.g.cs
is excluded by!**/generated/**
src/libs/DeepInfra/Generated/DeepInfra.Models.DeleteLoraModelLoraModelLoraModelNameDeleteResponse.g.cs
is excluded by!**/generated/**
src/libs/DeepInfra/Generated/DeepInfra.Models.LoraModelUploadIn.Json.g.cs
is excluded by!**/generated/**
src/libs/DeepInfra/Generated/DeepInfra.Models.LoraModelUploadIn.g.cs
is excluded by!**/generated/**
src/libs/DeepInfra/Generated/JsonSerializerContextTypes.g.cs
is excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/DeepInfra/openapi.yaml
(2 hunks)
LoraModelUploadIn: | ||
title: LoraModelUploadIn | ||
required: | ||
- hf_model_name | ||
- lora_model_name | ||
type: object | ||
properties: | ||
hf_model_name: | ||
title: Hf Model Name | ||
type: string | ||
hf_token: | ||
title: Hf Token | ||
type: string | ||
lora_model_name: | ||
title: Lora Model Name | ||
type: string |
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.
🛠️ Refactor suggestion
Enhance the LoraModelUploadIn schema with descriptions and validations.
The schema definition could benefit from the following improvements:
- Add descriptive field documentation
- Add pattern validation for model names
- Include examples for better understanding
Apply this diff to enhance the schema:
LoraModelUploadIn:
title: LoraModelUploadIn
+ description: Schema for uploading a Lora model that can be used with a base model for fine-tuning.
required:
- hf_model_name
- lora_model_name
type: object
properties:
hf_model_name:
title: Hf Model Name
type: string
+ description: The Hugging Face model name in the format 'username/model-name'
+ pattern: '^[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+$'
+ example: 'username/my-lora-model'
hf_token:
title: Hf Token
type: string
+ description: Optional Hugging Face access token for private models
+ format: password
lora_model_name:
title: Lora Model Name
type: string
+ description: A unique name for the Lora model in the format 'name-version'
+ pattern: '^[a-zA-Z0-9][a-zA-Z0-9_-]*$'
+ example: 'my-lora-v1'
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
LoraModelUploadIn: | |
title: LoraModelUploadIn | |
required: | |
- hf_model_name | |
- lora_model_name | |
type: object | |
properties: | |
hf_model_name: | |
title: Hf Model Name | |
type: string | |
hf_token: | |
title: Hf Token | |
type: string | |
lora_model_name: | |
title: Lora Model Name | |
type: string | |
LoraModelUploadIn: | |
title: LoraModelUploadIn | |
description: Schema for uploading a Lora model that can be used with a base model for fine-tuning. | |
required: | |
- hf_model_name | |
- lora_model_name | |
type: object | |
properties: | |
hf_model_name: | |
title: Hf Model Name | |
type: string | |
description: The Hugging Face model name in the format 'username/model-name' | |
pattern: '^[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+$' | |
example: 'username/my-lora-model' | |
hf_token: | |
title: Hf Token | |
type: string | |
description: Optional Hugging Face access token for private models | |
format: password | |
lora_model_name: | |
title: Lora Model Name | |
type: string | |
description: A unique name for the Lora model in the format 'name-version' | |
pattern: '^[a-zA-Z0-9][a-zA-Z0-9_-]*$' | |
example: 'my-lora-v1' |
Summary by CodeRabbit
These updates significantly expand the capabilities of the DeepApi, providing users with more control over Lora models.