Skip to content

Commit d9c22f0

Browse files
release: 0.20.0 (#220)
Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 1543aeb commit d9c22f0

File tree

18 files changed

+143
-52
lines changed

18 files changed

+143
-52
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ jobs:
1212
lint:
1313
name: lint
1414
runs-on: ubuntu-latest
15-
16-
1715
steps:
1816
- uses: actions/checkout@v4
1917

@@ -31,8 +29,9 @@ jobs:
3129
build:
3230
name: build
3331
runs-on: ubuntu-latest
34-
35-
32+
permissions:
33+
contents: read
34+
id-token: write
3635
steps:
3736
- uses: actions/checkout@v4
3837

@@ -46,10 +45,24 @@ jobs:
4645

4746
- name: Check build
4847
run: ./scripts/build
48+
49+
- name: Get GitHub OIDC Token
50+
if: github.repository == 'stainless-sdks/groqcloud-node'
51+
id: github-oidc
52+
uses: actions/github-script@v6
53+
with:
54+
script: core.setOutput('github_token', await core.getIDToken());
55+
56+
- name: Upload tarball
57+
if: github.repository == 'stainless-sdks/groqcloud-node'
58+
env:
59+
URL: https://pkg.stainless.com/s
60+
AUTH: ${{ steps.github-oidc.outputs.github_token }}
61+
SHA: ${{ github.sha }}
62+
run: ./scripts/utils/upload-artifact.sh
4963
test:
5064
name: test
5165
runs-on: ubuntu-latest
52-
5366
steps:
5467
- uses: actions/checkout@v4
5568

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.19.0"
2+
".": "0.20.0"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 17
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/groqcloud%2Fgroqcloud-8d531e091886f4bb814247a78a6323f6f12351881269a4e8cf68223b9245c64f.yml
3-
openapi_spec_hash: 418d99cedb3b70fbd0615eed3ceb2872
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/groqcloud%2Fgroqcloud-37498d19ece87c6866fe2460cef019b42d73c598d3489925375484812ce9b5a5.yml
3+
openapi_spec_hash: 009dde3080daf9a27d5165245e4ad11d
44
config_hash: 6b1c374dcc1ffa3165dd22f52a77ff89

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# Changelog
22

3+
## 0.20.0 (2025-04-22)
4+
5+
Full Changelog: [v0.19.0...v0.20.0](https://github.com/groq/groq-typescript/compare/v0.19.0...v0.20.0)
6+
7+
### Features
8+
9+
* **api:** api update ([00b8a36](https://github.com/groq/groq-typescript/commit/00b8a36b9101235badc0a5cf3b19287aaa9e38e3))
10+
* **api:** api update ([b728dc4](https://github.com/groq/groq-typescript/commit/b728dc48b6a7686982dab67238d746276f223602))
11+
* **api:** api update ([055b41b](https://github.com/groq/groq-typescript/commit/055b41bb1ca5e9d64833a3bc54c3afa1f0f16faa))
12+
* **api:** api update ([74fea29](https://github.com/groq/groq-typescript/commit/74fea29aca74cf761a20d0cb4c51b522624a491b))
13+
* **api:** api update ([970e970](https://github.com/groq/groq-typescript/commit/970e970e959ce756dd5194b9f758c10bed4b0485))
14+
* **api:** api update ([cc72162](https://github.com/groq/groq-typescript/commit/cc72162da8f83deb1b8f5d65743c91b5f2fbd7d7))
15+
* **api:** api update ([a945491](https://github.com/groq/groq-typescript/commit/a945491da14e55416dee482f1aac26f1daecfb01))
16+
17+
18+
### Bug Fixes
19+
20+
* **api:** improve type resolution when importing as a package ([#222](https://github.com/groq/groq-typescript/issues/222)) ([45bea8e](https://github.com/groq/groq-typescript/commit/45bea8e84f6dfe75e599aec2b4a5268497914923))
21+
* **client:** send `X-Stainless-Timeout` in seconds ([#219](https://github.com/groq/groq-typescript/issues/219)) ([49bc9d2](https://github.com/groq/groq-typescript/commit/49bc9d2621ff8fe5261c7f22d2283c67ff2883be))
22+
* **mcp:** remove unused tools.ts ([#223](https://github.com/groq/groq-typescript/issues/223)) ([ac43270](https://github.com/groq/groq-typescript/commit/ac43270a148a19cce434c3c3fe7602fbf1b4eccc))
23+
24+
25+
### Chores
26+
27+
* **client:** minor internal fixes ([bfebc04](https://github.com/groq/groq-typescript/commit/bfebc041673e0d23d287601cd694b572aa662b64))
28+
* GitHub Terraform: Create/Update .github/workflows/stale.yaml [skip ci] ([1543aeb](https://github.com/groq/groq-typescript/commit/1543aeb885e0938b5289e477b34fb962754fffa0))
29+
* **internal:** add aliases for Record and Array ([#221](https://github.com/groq/groq-typescript/issues/221)) ([b4d3b51](https://github.com/groq/groq-typescript/commit/b4d3b5143d4cfa6cffd6b2424797feacac3e9229))
30+
* **internal:** reduce CI branch coverage ([48fbdca](https://github.com/groq/groq-typescript/commit/48fbdca40c7127697544df18d6e91bdd52d2ebc9))
31+
* **internal:** upload builds and expand CI branch coverage ([4bbba67](https://github.com/groq/groq-typescript/commit/4bbba6700d7dc0bd03dfa67940e0cc4b293a0213))
32+
* **tests:** improve enum examples ([#224](https://github.com/groq/groq-typescript/issues/224)) ([3639c3b](https://github.com/groq/groq-typescript/commit/3639c3b255fa6e7f97c7a8d747297bc06e58f3f6))
33+
334
## 0.19.0 (2025-04-02)
435

536
Full Changelog: [v0.18.0...v0.19.0](https://github.com/groq/groq-typescript/compare/v0.18.0...v0.19.0)

api.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,12 @@ Types:
118118
- <code><a href="./src/resources/files.ts">FileCreateResponse</a></code>
119119
- <code><a href="./src/resources/files.ts">FileListResponse</a></code>
120120
- <code><a href="./src/resources/files.ts">FileDeleteResponse</a></code>
121-
- <code><a href="./src/resources/files.ts">FileContentResponse</a></code>
122121
- <code><a href="./src/resources/files.ts">FileInfoResponse</a></code>
123122

124123
Methods:
125124

126125
- <code title="post /openai/v1/files">client.files.<a href="./src/resources/files.ts">create</a>({ ...params }) -> FileCreateResponse</code>
127126
- <code title="get /openai/v1/files">client.files.<a href="./src/resources/files.ts">list</a>() -> FileListResponse</code>
128127
- <code title="delete /openai/v1/files/{file_id}">client.files.<a href="./src/resources/files.ts">delete</a>(fileId) -> FileDeleteResponse</code>
129-
- <code title="get /openai/v1/files/{file_id}/content">client.files.<a href="./src/resources/files.ts">content</a>(fileId) -> string</code>
128+
- <code title="get /openai/v1/files/{file_id}/content">client.files.<a href="./src/resources/files.ts">content</a>(fileId) -> Response</code>
130129
- <code title="get /openai/v1/files/{file_id}">client.files.<a href="./src/resources/files.ts">info</a>(fileId) -> FileInfoResponse</code>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "groq-sdk",
3-
"version": "0.19.0",
3+
"version": "0.20.0",
44
"description": "The official TypeScript library for the Groq API",
55
"author": "Groq <[email protected]>",
66
"types": "dist/index.d.ts",

scripts/utils/upload-artifact.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -exuo pipefail
3+
4+
RESPONSE=$(curl -X POST "$URL" \
5+
-H "Authorization: Bearer $AUTH" \
6+
-H "Content-Type: application/json")
7+
8+
SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url')
9+
10+
if [[ "$SIGNED_URL" == "null" ]]; then
11+
echo -e "\033[31mFailed to get signed URL.\033[0m"
12+
exit 1
13+
fi
14+
15+
UPLOAD_RESPONSE=$(tar -cz dist | curl -v -X PUT \
16+
-H "Content-Type: application/gzip" \
17+
--data-binary @- "$SIGNED_URL" 2>&1)
18+
19+
if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
20+
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
21+
echo -e "\033[32mInstallation: npm install 'https://pkg.stainless.com/s/groqcloud-node/$SHA'\033[0m"
22+
else
23+
echo -e "\033[31mFailed to upload artifact.\033[0m"
24+
exit 1
25+
fi

src/core.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@ export {
3434

3535
export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;
3636

37+
/**
38+
* An alias to the builtin `Array` type so we can
39+
* easily alias it in import statements if there are name clashes.
40+
*/
41+
type _Array<T> = Array<T>;
42+
43+
/**
44+
* An alias to the builtin `Record` type so we can
45+
* easily alias it in import statements if there are name clashes.
46+
*/
47+
type _Record<K extends keyof any, T> = Record<K, T>;
48+
49+
export type { _Array as Array, _Record as Record };
50+
3751
type PromiseOrValue<T> = T | Promise<T>;
3852

3953
type APIResponseProps = {
@@ -296,10 +310,10 @@ export abstract class APIClient {
296310
}
297311

298312
buildRequest<Req>(
299-
options: FinalRequestOptions<Req>,
313+
inputOptions: FinalRequestOptions<Req>,
300314
{ retryCount = 0 }: { retryCount?: number } = {},
301315
): { req: RequestInit; url: string; timeout: number } {
302-
options = { ...options };
316+
const options = { ...inputOptions };
303317
const { method, path, query, headers: headers = {} } = options;
304318

305319
const body =
@@ -327,8 +341,8 @@ export abstract class APIClient {
327341
}
328342

329343
if (this.idempotencyHeader && method !== 'get') {
330-
if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey();
331-
headers[this.idempotencyHeader] = options.idempotencyKey;
344+
if (!inputOptions.idempotencyKey) inputOptions.idempotencyKey = this.defaultIdempotencyKey();
345+
headers[this.idempotencyHeader] = inputOptions.idempotencyKey;
332346
}
333347

334348
const reqHeaders = this.buildHeaders({ options, headers, contentLength, retryCount });
@@ -385,7 +399,7 @@ export abstract class APIClient {
385399
getHeader(headers, 'x-stainless-timeout') === undefined &&
386400
options.timeout
387401
) {
388-
reqHeaders['x-stainless-timeout'] = String(options.timeout);
402+
reqHeaders['x-stainless-timeout'] = String(Math.trunc(options.timeout / 1000));
389403
}
390404

391405
this.validateHeaders(reqHeaders, headers);

src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
Embeddings,
2121
} from './resources/embeddings';
2222
import {
23-
FileContentResponse,
2423
FileCreateParams,
2524
FileCreateResponse,
2625
FileDeleteResponse,
@@ -245,7 +244,6 @@ export declare namespace Groq {
245244
type FileCreateResponse as FileCreateResponse,
246245
type FileListResponse as FileListResponse,
247246
type FileDeleteResponse as FileDeleteResponse,
248-
type FileContentResponse as FileContentResponse,
249247
type FileInfoResponse as FileInfoResponse,
250248
type FileCreateParams as FileCreateParams,
251249
};

src/resources/audio/speech.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class Speech extends APIResource {
1212
return this._client.post('/openai/v1/audio/speech', {
1313
body,
1414
...options,
15-
headers: { Accept: 'application/octet-stream', ...options?.headers },
15+
headers: { Accept: 'audio/wav', ...options?.headers },
1616
__binaryResponse: true,
1717
});
1818
}
@@ -25,19 +25,20 @@ export interface SpeechCreateParams {
2525
input: string;
2626

2727
/**
28-
* One of the available TTS models
28+
* One of the [available TTS models](/docs/text-to-speech).
2929
*/
3030
model: string;
3131

3232
/**
33-
* The voice to use when generating the audio.
33+
* The voice to use when generating the audio. List of voices can be found
34+
* [here](/docs/text-to-speech).
3435
*/
3536
voice: string;
3637

3738
/**
38-
* The format to audio in. Supported formats are `wav`.
39+
* The format to audio in. Supported formats are `wav, mp3`.
3940
*/
40-
response_format?: 'wav';
41+
response_format?: 'wav' | 'mp3';
4142

4243
/**
4344
* The speed of the generated audio. 1.0 is the only supported value.

src/resources/batches.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import * as Core from '../core';
55

66
export class Batches extends APIResource {
77
/**
8-
* Creates and executes a batch from an uploaded file of requests
8+
* Creates and executes a batch from an uploaded file of requests.
9+
* [Learn more](/docs/batch).
910
*/
1011
create(body: BatchCreateParams, options?: Core.RequestOptions): Core.APIPromise<BatchCreateResponse> {
1112
return this._client.post('/openai/v1/batches', { body, ...options });
@@ -683,10 +684,10 @@ export namespace BatchCancelResponse {
683684

684685
export interface BatchCreateParams {
685686
/**
686-
* The time frame within which the batch should be processed. Currently only `24h`
687-
* is supported.
687+
* The time frame within which the batch should be processed. Durations from `24h`
688+
* to `7d` are supported.
688689
*/
689-
completion_window: '24h';
690+
completion_window: string;
690691

691692
/**
692693
* The endpoint to be used for all requests in the batch. Currently

src/resources/chat/completions.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ export namespace ChatCompletionChunk {
256256
* number of tokens specified in the request was reached, `tool_calls` if the model
257257
* called a tool, or `function_call` (deprecated) if the model called a function.
258258
*/
259-
finish_reason: 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call' | null;
259+
finish_reason: 'stop' | 'length' | 'tool_calls' | 'function_call' | null;
260260

261261
/**
262262
* The index of the choice in the list of choices.
@@ -804,9 +804,16 @@ export interface ChatCompletionCreateParamsBase {
804804

805805
/**
806806
* ID of the model to use. For details on which models are compatible with the Chat
807-
* API, see available [models](/docs/models)
807+
* API, see available [models](https://console.groq.com/docs/models)
808808
*/
809-
model: (string & {}) | 'gemma-7b-it' | 'llama3-70b-8192' | 'llama3-8b-8192' | 'mixtral-8x7b-32768';
809+
model:
810+
| (string & {})
811+
| 'gemma2-9b-it'
812+
| 'llama-3.3-70b-versatile'
813+
| 'llama-3.1-8b-instant'
814+
| 'llama-guard-3-8b'
815+
| 'llama3-70b-8192'
816+
| 'llama3-8b-8192';
810817

811818
/**
812819
* Number between -2.0 and 2.0. Positive values penalize new tokens based on their
@@ -863,6 +870,11 @@ export interface ChatCompletionCreateParamsBase {
863870
*/
864871
max_tokens?: number | null;
865872

873+
/**
874+
* This parameter is not currently supported.
875+
*/
876+
metadata?: Record<string, string> | null;
877+
866878
/**
867879
* How many chat completion choices to generate for each input message. Note that
868880
* the current moment, only n=1 is supported. Other values will result in a 400
@@ -921,6 +933,11 @@ export interface ChatCompletionCreateParamsBase {
921933
*/
922934
stop?: string | null | Array<string>;
923935

936+
/**
937+
* This parameter is not currently supported.
938+
*/
939+
store?: boolean | null;
940+
924941
/**
925942
* If set, partial message deltas will be sent. Tokens will be sent as data-only
926943
* [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)
@@ -933,7 +950,7 @@ export interface ChatCompletionCreateParamsBase {
933950
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
934951
* make the output more random, while lower values like 0.2 will make it more
935952
* focused and deterministic. We generally recommend altering this or top_p but not
936-
* both
953+
* both.
937954
*/
938955
temperature?: number | null;
939956

src/resources/files.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { APIResource } from '../resource';
44
import * as Core from '../core';
5+
import { type Response } from '../_shims/index';
56

67
export class Files extends APIResource {
78
/**
@@ -33,8 +34,12 @@ export class Files extends APIResource {
3334
/**
3435
* Returns the contents of the specified file.
3536
*/
36-
content(fileId: string, options?: Core.RequestOptions): Core.APIPromise<string> {
37-
return this._client.get(`/openai/v1/files/${fileId}/content`, options);
37+
content(fileId: string, options?: Core.RequestOptions): Core.APIPromise<Response> {
38+
return this._client.get(`/openai/v1/files/${fileId}/content`, {
39+
...options,
40+
headers: { Accept: 'application/octet-stream', ...options?.headers },
41+
__binaryResponse: true,
42+
});
3843
}
3944

4045
/**
@@ -133,8 +138,6 @@ export interface FileDeleteResponse {
133138
object: 'file';
134139
}
135140

136-
export type FileContentResponse = string;
137-
138141
/**
139142
* The `File` object represents a document that has been uploaded.
140143
*/
@@ -189,7 +192,6 @@ export declare namespace Files {
189192
type FileCreateResponse as FileCreateResponse,
190193
type FileListResponse as FileListResponse,
191194
type FileDeleteResponse as FileDeleteResponse,
192-
type FileContentResponse as FileContentResponse,
193195
type FileInfoResponse as FileInfoResponse,
194196
type FileCreateParams as FileCreateParams,
195197
};

src/resources/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export {
2323
type FileCreateResponse,
2424
type FileListResponse,
2525
type FileDeleteResponse,
26-
type FileContentResponse,
2726
type FileInfoResponse,
2827
type FileCreateParams,
2928
} from './files';

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const VERSION = '0.19.0'; // x-release-please-version
1+
export const VERSION = '0.20.0'; // x-release-please-version

0 commit comments

Comments
 (0)