mistralai / client-js

JS Client library for Mistral AI platform
Apache License 2.0
185 stars 46 forks source link

Version 001 Refactor for Typescript & Microbundle #40

Closed pBread closed 9 months ago

pBread commented 9 months ago

Hi All,

I was playing around with the JS client and ran into a few environment compatibility issues, e.g. a conflict to do w/JS’s lovely module declaration rules.

I started writing a fix and, well, I ended up refactoring most it. It should be completely backward compatible, i.e. the methods are named the same and behave the same.

I’ve managed other NPM libraries before, all for employers, and I believe this is a more solid foundation than what had been originally undertaken. It's in the v001-rewrite-ts-microbundle branch of my fork pbread/client-js.

Note: As I write this, I have the client rewritten but I still need to port over the tests and examples. I'll be doing that now but there might be some minor bugs I need to work through.

Here are the major enhancements: Native Typescript Support It’s quite tedious to make a native JS compatible with TS. Going from TS to JS is easier and you benefit from type-safety.

Microbundle: Microbundle is wonderful. There almost zero configuration and it takes care of polyfill, minification, cross environment compatibility, TS declaration generation, etc. etc.

Microbundle solves the original problem I ran into. And, it will immediately add functionality, such as producing the UMD files necessary for browser Githubissues.

  • Githubissues is a development platform for aggregating issues.