Fix ollama model for plan/agent mode#3480
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug introduced in PR #2782 where the Ollama provider was passing the wrong variable type to byokKnownModelsToAPIInfo. The issue prevented Ollama models from working correctly in plan/agent mode.
Changes:
- Fixed the
getAllModelsmethod inOllamaLMProviderto pass the correctknownModelsvariable instead of the rawmodelsarray
|
@ctrysbita could you accept CLA to give a go to this PR 🙏 |
|
@microsoft-github-policy-service agree |
CristianVGdev
left a comment
There was a problem hiding this comment.
Corrects the input to byokKnownModelsToAPIInfo.
/api/tags is a listing endpoint and was being treated as a normalized model definition. Passing knownModels instead matches the actual data contract and avoids relying on incomplete Ollama metadata.
This is consistent with the function signature, which explicitly expects a BYOKKnownModels map:
export function byokKnownModelsToAPIInfo(
providerName: string,
knownModels: BYOKKnownModels | undefined
): LanguageModelChatInformation[] {
if (!knownModels) {
return [];
}
return Object.entries(knownModels).map(([id, capabilities]) =>
byokKnownModelToAPIInfo(providerName, id, capabilities)
);
}There was a problem hiding this comment.
@ctrysbita Suggestion: avoid bind + permanent no-op for usage
Current:
usage = this.forward(this._wrapped.usage?.bind(this._wrapped) || (() => { }));Proposal:
usage = this.forward((...args: any[]) => this._wrapped.usage?.apply(this._wrapped, args));Reason:
- Fixes the original problem (
bindonundefined) while maintaining the behavior offlush()throughforward. - Avoids capturing a null operation at build time (if
usageis added later in some implementations/flags, this will start working without rebuilding the flow). - Preserves the correct
thiswithoutbind.
If this causes any strange behavior in downstream flow, I think your original patch would remain. This is primarily a “worth trying” improvement for optional proxy methods.
|
Facing the same issue. Is there a work around i can use till the fix is propagated to release? |
|
@hediet Hi, could you have a review on this? |
The more you push into the pipeline, the more reviews will be required, and you need two. |
|
Fixed on #3566 |
Actually it always need one reviewer with write permission. |
Good, let's keep track on that PR. |
This PR fixes microsoft/vscode#293071
PR #2782 introduces the issue by passing the wrong variable (the raw model list) into
byokKnownModelsToAPIInfo, this PR fixes it by passing the correctknownModelsBy the way, this PR also fixes crash on undefined
usagewhen using ollama models