Skip to content

feat: support non-factory LanguageModelV2 class exports in dynamic provider loader#16794

Open
coconutbird wants to merge 3 commits intoanomalyco:devfrom
coconutbird:feat/languagemodelv2-class-loader
Open

feat: support non-factory LanguageModelV2 class exports in dynamic provider loader#16794
coconutbird wants to merge 3 commits intoanomalyco:devfrom
coconutbird:feat/languagemodelv2-class-loader

Conversation

@coconutbird
Copy link

@coconutbird coconutbird commented Mar 9, 2026

Issue for this PR

Closes #16793

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds a fallback in the dynamic provider loader for npm packages that export a LanguageModelV2 class instead of a create* factory (e.g. @augmentcode/auggie-sdk). The loader tries create* first, then falls back to duck-typing classes by checking for doGenerate/doStream on the prototype. Constructor assumption is new Class(modelId, options) — same convention risk as the existing create* path.

How did you verify your code works?

Configured @augmentcode/auggie-sdk as a custom provider in opencode.json and verified all 8 Augment models load and respond correctly via opencode run -m augment/<model> "say hello".

Screenshots / recordings

N/A — no UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Mar 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@coconutbird coconutbird marked this pull request as ready for review March 9, 2026 19:39
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.

[FEATURE]: Support non-factory LanguageModelV2 class exports in dynamic provider loader

1 participant