8000 Add LM Studio provider and improve OpenAI response parsing by k2kirov · Pull Request #61 · dominicgisler/imap-spam-cleaner · GitHub
[go: up one dir, main page]

Skip to content

Add LM Studio provider and improve OpenAI response parsing - #61

Open
k2kirov wants to merge 1 commit into
dominicgisler:masterfrom
k2kirov:feat/lmstudio-provider
Open

k2kirov wants to merge 1 commit into
dominicgisler:masterfrom
k2kirov:feat/lmstudio-provider

Conversation

@k2kirov
@k2kirov k2kirov commented Sep 23, 2026
Copy link
Copy Markdown

Summary

This PR adds support for LM Studio as an AI provider and improves OpenAI-compatible response parsing.

Changes

  • LM Studio Provider: Added lmstudio provider extending OpenAI, defaulting to http://localhost:1234/v1 and API key lm-studio.
  • Configurable Base URL for OpenAI: Allowed url configuration for openai provider to target custom/local endpoints with optional API key.
  • Reasoning Models Support: Strips </think> tags from model output (useful for reasoning models such as DeepSeek-R1).
  • Flexible Score Parsing: Added regex extraction for digits (\b(\d{1,3})\b) if direct integer parsing fails.
  • Logging: Added info log when analyzing a message and debug log for built prompt length.
  • Config Example: Added LM Studio configuration example to config.example.yml.

- Introduce LM Studio provider with default endpoint and credentials
- Allow custom BaseURL and optional API key in OpenAI provider
- Support reasoning models by stripping </think> tags
- Add regex fallback to parse numeric spam scores from model responses
- Add log statements for message analysis progress and prompt length
@dominicgisler
Copy link
Copy Markdown
Owner

Thanks for your contribution, I really appreciate it.

I have some questions / suggestions though:

Is a dedicated provider really necessary if it just sets default values for an existing one?
I understand the extension of the openapi provider to allow custom endpoints and make the apikey optional, but I prefer an other approach.

My suggestion would be: add a new provider "openai-compatible", which can extend the existing openai provider, which allows to set a custom url and has an optional api key.
The existing openapi provider could stay almost untouched (with the small changes you implemented, which are completely fine).

This would allow to support any openapi compatible endpoint without introducing one provider for each.
Please tell me your thoughts if you have an other opinion.

This branch has not been deployed

No deployments
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

0