merging with upstream#2
Merged
Merged
Conversation
) LM Studio's Local Server speaks the OpenAI-compatible /v1/embeddings protocol, so users running it as their model host (chat plus embedding in one desktop app, GGUF model management) had no clean integration path. Changes: - src/services/provider-lmstudio.ts: new LMStudioEmbeddingProvider wrapping the OpenAI SDK with a custom baseURL (default http://localhost:1234/v1). Sends a placeholder API key to satisfy the OpenAI SDK while LM Studio's Local Server runs without auth by default. Skips the dimensions parameter because LM Studio models have no Matryoshka projection. Forces encoding_format=float to defeat the OpenAI SDK 6.x base64 default, which would otherwise mangle LM Studio's plain-array responses into 1024 zeros. - src/services/embedding-config.ts: extends the EmbeddingProvider union, reads LMSTUDIO_URL and LMSTUDIO_API_KEY, fail-fast validation when EMBEDDING_PROVIDER=lmstudio without EMBEDDING_MODEL or EMBEDDING_DIMENSIONS. - src/services/embedding-provider.ts: factory case for lmstudio with a dynamic import to avoid loading the OpenAI SDK at startup for ollama users. - ensureReady distinguishes "LM Studio unreachable" from "reachable but embedding model not loaded" so the operator knows whether to start the Local Server or load the configured model. - src/services/qdrant.ts: minor refactor to extract the hybrid-search query payload to a local const for readability. - README.md: dedicated LM Studio section, MCP host config example, env-var table entries. - tests/unit/embedding-config.test.ts: 8 new cases (required-env validation, URL default and override, optional API key, context-length override). - tests/unit/embedding-provider.test.ts: 3 new cases (factory wiring, ensureReady error format against a closed port, healthCheck unreachable output). Backward compatible. The lmstudio provider is opt-in via EMBEDDING_PROVIDER=lmstudio. Existing ollama, openai, and google paths are untouched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Type of change
Testing
npm run test:unit)npm run test:integration) — if applicablenpx tsc --noEmit)Checklist
Related issues