Skip to content
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

allow user to override ChatConfig when creating LanguageModel for LMStudio (openAiCompatible) Provider #5262

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Sewdn
Copy link

@Sewdn Sewdn commented Mar 18, 2025

See discussion in #5197 (comment)

This PR now allows to optionally override languageModel configuration properties defaultObjectGenerationMode and supportStructuredOutputs.

When setting supportStructuredOutputs to true, this will now make the openAiCompatible provider add the schema to the request when generating objects (and when a schema was provided).

This is how this change can be used:

const lmstudio = createOpenAICompatible({
    name: 'lmstudio',
    baseURL: 'http://localhost:1234/v1',
});
model = lmstudio('mistral-nemo-instruct-2407', undefined, {
    supportsStructuredOutputs: true,
});

It is not ideal to have to add an undefined settings, since the extra config that was added to the function's signature is added as last optional parameter, to allow for backwards compatibility.

Better would be to add overloaded function signatures to allow for all possible construction methods:

model = lmstudio('mistral-nemo-instruct-2407');
model2 = lmstudio({
  modelId: 'mistral-nemo-instruct-2407', 
  config: {
    supportsStructuredOutputs: true,
  }
});

Sewdn added 2 commits March 18, 2025 13:03

Verified

This commit was signed with the committer’s verified signature.
kdawgwilk Kaden Wilkinson
@Sewdn
Copy link
Author

Sewdn commented Mar 18, 2025

@lgrammel Can you review or assign reviewer? Thanks!

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.

None yet

1 participant