diff --git a/.github/workflows/build_publish.yaml b/.github/workflows/build_publish.yaml index 0d00f6a..05e579f 100644 --- a/.github/workflows/build_publish.yaml +++ b/.github/workflows/build_publish.yaml @@ -69,6 +69,7 @@ jobs: run: | echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc npm version ${{ github.ref_name }} + sed -i '' -e 's/VERSION = '\''0.0.1'\''/VERSION = '\''${{ github.ref_name }}'\''/g' src/client.js npm publish \ No newline at end of file diff --git a/src/client.js b/src/client.js index fa2a990..9b0b429 100644 --- a/src/client.js +++ b/src/client.js @@ -1,5 +1,9 @@ let isNode = false; +const VERSION = '0.0.3'; +const RETRY_STATUS_CODES = [429, 500, 502, 503, 504]; +const ENDPOINT = 'https://api.mistral.ai'; + /** * Initialize fetch * @return {Promise} @@ -17,9 +21,6 @@ async function initializeFetch() { initializeFetch(); -const RETRY_STATUS_CODES = [429, 500, 502, 503, 504]; -const ENDPOINT = 'https://api.mistral.ai'; - /** * MistralAPIError * @return {MistralAPIError} @@ -74,6 +75,7 @@ class MistralClient { const options = { method: method, headers: { + 'User-Agent': `mistral-client-js/${VERSION}`, 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': `Bearer ${this.apiKey}`,