Repository navigation
fix: switch local LM Studio configs from LMStudio to OpenAILike - #194
Merged
Merged
Conversation
The llama_index LMStudio CustomLLM adapter uses PydanticOutputParser which injects the Pydantic schema as text into the user message. It never sends response_format:json_schema in the HTTP request. Small models receive the schema as text and echo it back, causing structured output failures. Fix: switch to OpenAILike with should_use_structured_outputs=true. This triggers OpenAI._prepare_schema() which sends response_format:json_schema directly in the API request, enabling grammar-enforced structured output in LM Studio (llama.cpp grammar for GGUF, Outlines for MLX). Also updates field names: model_name→model, base_url→api_base, request_timeout→timeout, num_output→max_tokens, adds api_key and is_chat_model required by OpenAILike.
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.
Single change:
llm_config/local.jsonSwitches all local LM Studio model entries from
class: LMStudiotoclass: OpenAILikewithshould_use_structured_outputs: trueinsidearguments.Why:
class: LMStudiosends the JSON schema as text in the user message — no grammar enforcement.class: OpenAILikewithshould_use_structured_outputs: truesends properresponse_format: json_schema, which LM Studio enforces via Outlines grammar. Verified working on tonight's full pipeline run (63 tasks, 0 failures).