Skip to content

Commit 32862a2

Browse files
chore(internal): codegen related update (#111)
1 parent cf51b70 commit 32862a2

File tree

9 files changed

+33
-14
lines changed

9 files changed

+33
-14
lines changed

.github/workflows/release-doctor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ jobs:
1919
bash ./bin/check-release-environment
2020
env:
2121
NPM_TOKEN: ${{ secrets.GROQ_NPM_TOKEN || secrets.NPM_TOKEN }}
22+

bin/check-release-environment

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ if [[ lenErrors -gt 0 ]]; then
1919
fi
2020

2121
echo "The environment is ready to push releases!"
22+

bin/publish-npm

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,24 @@
22

33
set -eux
44

5-
npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
5+
npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"
66

7+
# Build the project
78
yarn build
9+
10+
# Navigate to the dist directory
811
cd dist
9-
yarn publish --access public
12+
13+
# Get the version from package.json
14+
VERSION="$(node -p "require('./package.json').version")"
15+
16+
# Extract the pre-release tag if it exists
17+
if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then
18+
# Extract the part before any dot in the pre-release identifier
19+
TAG="${BASH_REMATCH[1]}"
20+
else
21+
TAG="latest"
22+
fi
23+
24+
# Publish with the appropriate tag
25+
yarn publish --access public --tag "$TAG"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build; fi",
2222
"tsn": "ts-node -r tsconfig-paths/register",
2323
"lint": "./scripts/lint",
24-
"fix": "eslint --fix --ext ts,js ."
24+
"fix": "./scripts/format"
2525
},
2626
"dependencies": {
2727
"@types/node": "^18.11.18",

scripts/format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ set -e
55
cd "$(dirname "$0")/.."
66

77
echo "==> Running eslint --fix"
8-
./node_modules/.bin/eslint --fix --ext ts,js .
8+
ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --fix --ext ts,js .

scripts/lint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ set -e
55
cd "$(dirname "$0")/.."
66

77
echo "==> Running eslint"
8-
./node_modules/.bin/eslint --ext ts,js .
8+
ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --ext ts,js .

scripts/mock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}"
2121

2222
# Run prism mock on the given spec
2323
if [ "$1" == "--daemon" ]; then
24-
npm exec --package=@stainless-api/[email protected].4 -- prism mock "$URL" &> .prism.log &
24+
npm exec --package=@stainless-api/[email protected].5 -- prism mock "$URL" &> .prism.log &
2525

2626
# Wait for server to come online
2727
echo -n "Waiting for server"
@@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then
3737

3838
echo
3939
else
40-
npm exec --package=@stainless-api/[email protected].4 -- prism mock "$URL"
40+
npm exec --package=@stainless-api/[email protected].5 -- prism mock "$URL"
4141
fi

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ export class Groq extends Core.APIClient {
154154
}
155155

156156
static Groq = this;
157+
static DEFAULT_TIMEOUT = 60000; // 1 minute
157158

158159
static GroqError = Errors.GroqError;
159160
static APIError = Errors.APIError;

tests/api-resources/chat/completions.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ describe('resource completions', () => {
3030
frequency_penalty: -2,
3131
function_call: 'none',
3232
functions: [
33-
{ description: 'description', name: 'name', parameters: { foo: 'bar' } },
34-
{ description: 'description', name: 'name', parameters: { foo: 'bar' } },
35-
{ description: 'description', name: 'name', parameters: { foo: 'bar' } },
33+
{ name: 'name', description: 'description', parameters: { foo: 'bar' } },
34+
{ name: 'name', description: 'description', parameters: { foo: 'bar' } },
35+
{ name: 'name', description: 'description', parameters: { foo: 'bar' } },
3636
],
3737
logit_bias: { foo: 0 },
3838
logprobs: true,
3939
max_tokens: 0,
4040
n: 1,
4141
parallel_tool_calls: true,
4242
presence_penalty: -2,
43-
response_format: { type: 'json_object' },
43+
response_format: { type: 'text' },
4444
seed: 0,
4545
stop: '\n',
4646
stream: true,
@@ -49,16 +49,16 @@ describe('resource completions', () => {
4949
tool_choice: 'none',
5050
tools: [
5151
{
52+
function: { name: 'name', description: 'description', parameters: { foo: 'bar' } },
5253
type: 'function',
53-
function: { description: 'description', name: 'name', parameters: { foo: 'bar' } },
5454
},
5555
{
56+
function: { name: 'name', description: 'description', parameters: { foo: 'bar' } },
5657
type: 'function',
57-
function: { description: 'description', name: 'name', parameters: { foo: 'bar' } },
5858
},
5959
{
60+
function: { name: 'name', description: 'description', parameters: { foo: 'bar' } },
6061
type: 'function',
61-
function: { description: 'description', name: 'name', parameters: { foo: 'bar' } },
6262
},
6363
],
6464
top_logprobs: 0,

0 commit comments

Comments
 (0)