diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 59bbc0f..4fa4b6b 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -19,3 +19,4 @@ jobs: bash ./bin/check-release-environment env: NPM_TOKEN: ${{ secrets.GROQ_NPM_TOKEN || secrets.NPM_TOKEN }} + diff --git a/bin/check-release-environment b/bin/check-release-environment index 47417cf..4f78924 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -19,3 +19,4 @@ if [[ lenErrors -gt 0 ]]; then fi echo "The environment is ready to push releases!" + diff --git a/bin/publish-npm b/bin/publish-npm index 4d6c9f3..4c21181 100644 --- a/bin/publish-npm +++ b/bin/publish-npm @@ -2,8 +2,24 @@ set -eux -npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN +npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN" +# Build the project yarn build + +# Navigate to the dist directory cd dist -yarn publish --access public + +# Get the version from package.json +VERSION="$(node -p "require('./package.json').version")" + +# Extract the pre-release tag if it exists +if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then + # Extract the part before any dot in the pre-release identifier + TAG="${BASH_REMATCH[1]}" +else + TAG="latest" +fi + +# Publish with the appropriate tag +yarn publish --access public --tag "$TAG" diff --git a/package.json b/package.json index 6dba1ad..b7fe24d 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build; fi", "tsn": "ts-node -r tsconfig-paths/register", "lint": "./scripts/lint", - "fix": "eslint --fix --ext ts,js ." + "fix": "./scripts/format" }, "dependencies": { "@types/node": "^18.11.18", diff --git a/scripts/format b/scripts/format index d297e76..a6bb9d0 100755 --- a/scripts/format +++ b/scripts/format @@ -5,4 +5,4 @@ set -e cd "$(dirname "$0")/.." echo "==> Running eslint --fix" -./node_modules/.bin/eslint --fix --ext ts,js . +ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --fix --ext ts,js . diff --git a/scripts/lint b/scripts/lint index 6b0e5dc..4af1de0 100755 --- a/scripts/lint +++ b/scripts/lint @@ -5,4 +5,4 @@ set -e cd "$(dirname "$0")/.." echo "==> Running eslint" -./node_modules/.bin/eslint --ext ts,js . +ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --ext ts,js . diff --git a/scripts/mock b/scripts/mock index f586157..d2814ae 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then - npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log & # Wait for server to come online echo -n "Waiting for server" @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" fi diff --git a/src/index.ts b/src/index.ts index 9ecd177..7d3b226 100644 --- a/src/index.ts +++ b/src/index.ts @@ -154,6 +154,7 @@ export class Groq extends Core.APIClient { } static Groq = this; + static DEFAULT_TIMEOUT = 60000; // 1 minute static GroqError = Errors.GroqError; static APIError = Errors.APIError; diff --git a/tests/api-resources/chat/completions.test.ts b/tests/api-resources/chat/completions.test.ts index b832713..eae9614 100644 --- a/tests/api-resources/chat/completions.test.ts +++ b/tests/api-resources/chat/completions.test.ts @@ -30,9 +30,9 @@ describe('resource completions', () => { frequency_penalty: -2, function_call: 'none', functions: [ - { description: 'description', name: 'name', parameters: { foo: 'bar' } }, - { description: 'description', name: 'name', parameters: { foo: 'bar' } }, - { description: 'description', name: 'name', parameters: { foo: 'bar' } }, + { name: 'name', description: 'description', parameters: { foo: 'bar' } }, + { name: 'name', description: 'description', parameters: { foo: 'bar' } }, + { name: 'name', description: 'description', parameters: { foo: 'bar' } }, ], logit_bias: { foo: 0 }, logprobs: true, @@ -40,7 +40,7 @@ describe('resource completions', () => { n: 1, parallel_tool_calls: true, presence_penalty: -2, - response_format: { type: 'json_object' }, + response_format: { type: 'text' }, seed: 0, stop: '\n', stream: true, @@ -49,16 +49,16 @@ describe('resource completions', () => { tool_choice: 'none', tools: [ { + function: { name: 'name', description: 'description', parameters: { foo: 'bar' } }, type: 'function', - function: { description: 'description', name: 'name', parameters: { foo: 'bar' } }, }, { + function: { name: 'name', description: 'description', parameters: { foo: 'bar' } }, type: 'function', - function: { description: 'description', name: 'name', parameters: { foo: 'bar' } }, }, { + function: { name: 'name', description: 'description', parameters: { foo: 'bar' } }, type: 'function', - function: { description: 'description', name: 'name', parameters: { foo: 'bar' } }, }, ], top_logprobs: 0,