Skip to content

Commit 0be565e

Browse files
release: 0.19.0 (#213)
Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 8799c79 commit 0be565e

File tree

11 files changed

+209
-32
lines changed

11 files changed

+209
-32
lines changed

.github/workflows/stale.yaml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.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.18.0"
2+
".": "0.19.0"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 16
1+
configured_endpoints: 17
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/groqcloud%2Fgroqcloud-8d531e091886f4bb814247a78a6323f6f12351881269a4e8cf68223b9245c64f.yml
33
openapi_spec_hash: 418d99cedb3b70fbd0615eed3ceb2872
4-
config_hash: dd20374dfa31ce00f3b6dd0a6dfbe802
4+
config_hash: 6b1c374dcc1ffa3165dd22f52a77ff89

CHANGELOG.md

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

3+
## 0.19.0 (2025-04-02)
4+
5+
Full Changelog: [v0.18.0...v0.19.0](https://github.com/groq/groq-typescript/compare/v0.18.0...v0.19.0)
6+
7+
### Features
8+
9+
* **api:** add batch cancel ([0b0681f](https://github.com/groq/groq-typescript/commit/0b0681ff484dadce7a3f9ab8b5205683e96297fa))
10+
11+
12+
### Chores
13+
14+
* **internal:** skip broken binary tests ([#217](https://github.com/groq/groq-typescript/issues/217)) ([6ad103f](https://github.com/groq/groq-typescript/commit/6ad103f2207357f876734b423c8224d48162c1f6))
15+
316
## 0.18.0 (2025-04-01)
417

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

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,14 @@ Types:
102102
- <code><a href="./src/resources/batches.ts">BatchCreateResponse</a></code>
103103
- <code><a href="./src/resources/batches.ts">BatchRetrieveResponse</a></code>
104104
- <code><a href="./src/resources/batches.ts">BatchListResponse</a></code>
105+
- <code><a href="./src/resources/batches.ts">BatchCancelResponse</a></code>
105106

106107
Methods:
107108

108109
- <code title="post /openai/v1/batches">client.batches.<a href="./src/resources/batches.ts">create</a>({ ...params }) -> BatchCreateResponse</code>
109110
- <code title="get /openai/v1/batches/{batch_id}">client.batches.<a href="./src/resources/batches.ts">retrieve</a>(batchId) -> BatchRetrieveResponse</code>
110111
- <code title="get /openai/v1/batches">client.batches.<a href="./src/resources/batches.ts">list</a>() -> BatchListResponse</code>
112+
- <code title="post /openai/v1/batches/{batch_id}/cancel">client.batches.<a href="./src/resources/batches.ts">cancel</a>(batchId) -> BatchCancelResponse</code>
111113

112114
# Files
113115

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.18.0",
3+
"version": "0.19.0",
44
"description": "The official TypeScript library for the Groq API",
55
"author": "Groq <[email protected]>",
66
"types": "dist/index.d.ts",

src/resources/batches.ts

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ export class Batches extends APIResource {
2424
list(options?: Core.RequestOptions): Core.APIPromise<BatchListResponse> {
2525
return this._client.get('/openai/v1/batches', options);
2626
}
27+
28+
/**
29+
* Cancels a batch.
30+
*/
31+
cancel(batchId: string, options?: Core.RequestOptions): Core.APIPromise<BatchCancelResponse> {
32+
return this._client.post(`/openai/v1/batches/${batchId}/cancel`, options);
33+
}
2734
}
2835

2936
export interface BatchCreateResponse {
@@ -514,6 +521,166 @@ export namespace BatchListResponse {
514521
}
515522
}
516523

524+
export interface BatchCancelResponse {
525+
id: string;
526+
527+
/**
528+
* The time frame within which the batch should be processed.
529+
*/
530+
completion_window: string;
531+
532+
/**
533+
* The Unix timestamp (in seconds) for when the batch was created.
534+
*/
535+
created_at: number;
536+
537+
/**
538+
* The API endpoint used by the batch.
539+
*/
540+
endpoint: string;
541+
542+
/**
543+
* The ID of the input file for the batch.
544+
*/
545+
input_file_id: string;
546+
547+
/**
548+
* The object type, which is always `batch`.
549+
*/
550+
object: 'batch';
551+
552+
/**
553+
* The current status of the batch.
554+
*/
555+
status:
556+
| 'validating'
557+
| 'failed'
558+
| 'in_progress'
559+
| 'finalizing'
560+
| 'completed'
561+
| 'expired'
562+
| 'cancelling'
563+
| 'cancelled';
564+
565+
/**
566+
* The Unix timestamp (in seconds) for when the batch was cancelled.
567+
*/
568+
cancelled_at?: number;
569+
570+
/**
571+
* The Unix timestamp (in seconds) for when the batch started cancelling.
572+
*/
573+
cancelling_at?: number;
574+
575+
/**
576+
* The Unix timestamp (in seconds) for when the batch was completed.
577+
*/
578+
completed_at?: number;
579+
580+
/**
581+
* The ID of the file containing the outputs of requests with errors.
582+
*/
583+
error_file_id?: string;
584+
585+
errors?: BatchCancelResponse.Errors;
586+
587+
/**
588+
* The Unix timestamp (in seconds) for when the batch expired.
589+
*/
590+
expired_at?: number;
591+
592+
/**
593+
* The Unix timestamp (in seconds) for when the batch will expire.
594+
*/
595+
expires_at?: number;
596+
597+
/**
598+
* The Unix timestamp (in seconds) for when the batch failed.
599+
*/
600+
failed_at?: number;
601+
602+
/**
603+
* The Unix timestamp (in seconds) for when the batch started finalizing.
604+
*/
605+
finalizing_at?: number;
606+
607+
/**
608+
* The Unix timestamp (in seconds) for when the batch started processing.
609+
*/
610+
in_progress_at?: number;
611+
612+
/**
613+
* Set of key-value pairs that can be attached to an object. This can be useful for
614+
* storing additional information about the object in a structured format.
615+
*/
616+
metadata?: unknown | null;
617+
618+
/**
619+
* The ID of the file containing the outputs of successfully executed requests.
620+
*/
621+
output_file_id?: string;
622+
623+
/**
624+
* The request counts for different statuses within the batch.
625+
*/
626+
request_counts?: BatchCancelResponse.RequestCounts;
627+
}
628+
629+
export namespace BatchCancelResponse {
630+
export interface Errors {
631+
data?: Array<Errors.Data>;
632+
633+
/**
634+
* The object type, which is always `list`.
635+
*/
636+
object?: string;
637+
}
638+
639+
export namespace Errors {
640+
export interface Data {
641+
/**
642+
* An error code identifying the error type.
643+
*/
644+
code?: string;
645+
646+
/**
647+
* The line number of the input file where the error occurred, if applicable.
648+
*/
649+
line?: number | null;
650+
651+
/**
652+
* A human-readable message providing more details about the error.
653+
*/
654+
message?: string;
655+
656+
/**
657+
* The name of the parameter that caused the error, if applicable.
658+
*/
659+
param?: string | null;
660+
}
661+
}
662+
663+
/**
664+
* The request counts for different statuses within the batch.
665+
*/
666+
export interface RequestCounts {
667+
/**
668+
* Number of requests that have been completed successfully.
669+
*/
670+
completed: number;
671+
672+
/**
673+
* Number of requests that have failed.
674+
*/
675+
failed: number;
676+
677+
/**
678+
* Total number of requests in the batch.
679+
*/
680+
total: number;
681+
}
682+
}
683+
517684
export interface BatchCreateParams {
518685
/**
519686
* The time frame within which the batch should be processed. Currently only `24h`
@@ -548,6 +715,7 @@ export declare namespace Batches {
548715
type BatchCreateResponse as BatchCreateResponse,
549716
type BatchRetrieveResponse as BatchRetrieveResponse,
550717
type BatchListResponse as BatchListResponse,
718+
type BatchCancelResponse as BatchCancelResponse,
551719
type BatchCreateParams as BatchCreateParams,
552720
};
553721
}

src/resources/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export {
77
type BatchCreateResponse,
88
type BatchRetrieveResponse,
99
type BatchListResponse,
10+
type BatchCancelResponse,
1011
type BatchCreateParams,
1112
} from './batches';
1213
export { Chat } from './chat/chat';

src/version.ts

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

tests/api-resources/audio/speech.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const client = new Groq({
88
});
99

1010
describe('resource speech', () => {
11-
test('create: required and optional params', async () => {
11+
// binary tests are currently broken
12+
test.skip('create: required and optional params', async () => {
1213
const response = await client.audio.speech.create({
1314
input: 'input',
1415
model: 'model',

tests/api-resources/batches.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,22 @@ describe('resource batches', () => {
6868
Groq.NotFoundError,
6969
);
7070
});
71+
72+
test('cancel', async () => {
73+
const responsePromise = client.batches.cancel('batch_id');
74+
const rawResponse = await responsePromise.asResponse();
75+
expect(rawResponse).toBeInstanceOf(Response);
76+
const response = await responsePromise;
77+
expect(response).not.toBeInstanceOf(Response);
78+
const dataAndResponse = await responsePromise.withResponse();
79+
expect(dataAndResponse.data).toBe(response);
80+
expect(dataAndResponse.response).toBe(rawResponse);
81+
});
82+
83+
test('cancel: request options instead of params are passed correctly', async () => {
84+
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
85+
await expect(client.batches.cancel('batch_id', { path: '/_stainless_unknown_path' })).rejects.toThrow(
86+
Groq.NotFoundError,
87+
);
88+
});
7189
});

0 commit comments

Comments
 (0)