Skip to content

feat(lm-studio): add native model discovery and capability detection - #1652

Draft
AnishSarkar22 wants to merge 9 commits into
MODSetter:devfrom
AnishSarkar22:fix/lm-studio-connection
Draft

feat(lm-studio): add native model discovery and capability detection#1652
AnishSarkar22 wants to merge 9 commits into
MODSetter:devfrom
AnishSarkar22:fix/lm-studio-connection

Conversation

@AnishSarkar22

@AnishSarkar22 AnishSarkar22 commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Description

  • Discover models through LM Studio’s native /api/v1/models endpoint.
  • Fall back to legacy v0 and OpenAI-compatible discovery when unavailable.
  • Detect chat, vision, embedding, tool-use, and context-length capabilities.
  • Preserve user capability overrides during rediscovery and frontend filtering.
  • Add explicit authentication, malformed-response, and connection error handling.
  • Add focused backend unit tests.

Motivation and Context

FIX #

Screenshots

API Changes

  • This PR includes API changes

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation
  • Dependency/Build system
  • Breaking change
  • Other (specify):

Testing Performed

  • Tested locally
  • Manual/QA verification

Checklist

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

High-level PR Summary

This PR implements a custom model discovery mechanism for LM Studio connections by adding support for LM Studio's native API endpoints (/api/v1/models and /api/v0/models) with fallback to OpenAI-compatible discovery. The changes include a new discovery strategy in the provider registry, comprehensive parsing logic for LM Studio's model metadata including capabilities like vision and tool support, robust error handling, and a frontend capability override mechanism to respect user-defined model capabilities.

⏱️ Estimated Review Time: 15-30 minutes

💡 Review Order Suggestion
Order File Path
1 surfsense_backend/app/services/provider_registry.py
2 surfsense_backend/app/services/model_connection_service.py
3 surfsense_backend/tests/unit/services/test_lm_studio_discovery.py
4 surfsense_web/components/settings/model-connections/model-utils.ts

Need help? Join our Discord

@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

@AnishSarkar22 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6c701232-ecf2-4456-afe5-86a1e24693c9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@AnishSarkar22 AnishSarkar22 changed the title Fix/lm studio connection feat(lm-studio): add native model discovery and capability detection Jul 31, 2026
@AnishSarkar22
AnishSarkar22 marked this pull request as ready for review July 31, 2026 15:01
…odel discovery by raising ModelDiscoveryError with specific upgrade instructions
@AnishSarkar22
AnishSarkar22 marked this pull request as draft July 31, 2026 16:12
…e assertions to reflect error handling for unavailable native APIs
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.

1 participant