Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(internal): codegen related update #111

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ jobs:
bash ./bin/check-release-environment
env:
NPM_TOKEN: ${{ secrets.GROQ_NPM_TOKEN || secrets.NPM_TOKEN }}

1 change: 1 addition & 0 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ if [[ lenErrors -gt 0 ]]; then
fi

echo "The environment is ready to push releases!"

20 changes: 18 additions & 2 deletions bin/publish-npm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion scripts/format
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
2 changes: 1 addition & 1 deletion scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
4 changes: 2 additions & 2 deletions scripts/mock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions tests/api-resources/chat/completions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ 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,
max_tokens: 0,
n: 1,
parallel_tool_calls: true,
presence_penalty: -2,
response_format: { type: 'json_object' },
response_format: { type: 'text' },
seed: 0,
stop: '\n',
stream: true,
Expand All @@ -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,
Expand Down