mistralai / client-js

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

CDN-hosted version of the mistralai JS SDK? #45

Open maudnals opened 8 months ago

maudnals commented 8 months ago

Hi folks! For quick frontend-only experimentation purposes, it would be handy to be able to write code like this:

<script type="importmap">
  {
    "imports": {
      "@mistralai/mistralai": "https://{$CDN_HOSTED_LIB_URL}"
    }
  }
</script>
<script type="module">
  import MistralClient from '@mistralai/mistralai';
  const client = new MistralClient($API_KEY);
  // const chatResponseGen = await client.chat({ ... etc
</script>

It would require a CDN-hosted version of @mistralai/mistralai. Is it an option for you to support something like this?

Note: No server / node component here, so the API key lives in the frontend. Arguably OK for quick local experimentation purposes.

Achintharya commented 1 month ago

you can use skypackcdn to import from, that's what I used on my website. It was working perfectly fine until today. The zod version is not updated so it isnt working currently