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

feat: Provide typed model parameters in LLM Module Config #424

Merged
merged 18 commits into from
Jan 10, 2025

Conversation

shibeshduw
Copy link
Contributor

Context

SAP/ai-sdk-js-backlog#83.

@shibeshduw shibeshduw marked this pull request as draft January 3, 2025 13:16
@shibeshduw shibeshduw changed the title Model params convenience feat: Provide typed model parameters in LLM Module Config Jan 3, 2025
/**
* Model parameters should accept known typed parameters and arbitrary parameters.
*/
expectType<LlmModelParams>({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently this is not allowed. The TS compiler performs the excess property check before & Record<string, any> is read so it considers this type to be "too wide"? Would like some suggestions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem is not that it doesnt read Record<string, any> but rather that tsd expectType does strict type assertions -> https://github.com/tsdjs/tsd?tab=readme-ov-file#strict-type-assertions.
As suggested used expectAssignable instead

@shibeshduw shibeshduw marked this pull request as ready for review January 7, 2025 10:41
@shibeshduw shibeshduw merged commit 1476584 into main Jan 10, 2025
10 checks passed
@shibeshduw shibeshduw deleted the model-params-convenience branch January 10, 2025 10:53
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.

3 participants