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

feat(api): add service tier argument for chat completions #900

Merged
merged 1 commit into from
Jun 18, 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
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 64
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-5cb1810135c35c5024698f3365626471a04796e26e393aefe1aa0ba3c0891919.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-8fe357c6b5a425d810d731e4102a052d8e38c5e2d66950e6de1025415160bf88.yml
25 changes: 25 additions & 0 deletions src/resources/chat/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ export interface ChatCompletion {
*/
object: 'chat.completion';

/**
* The service tier used for processing the request. This field is only included if
* the `service_tier` parameter is specified in the request.
*/
service_tier?: 'scale' | 'default' | null;

/**
* This fingerprint represents the backend configuration that the model runs with.
*
Expand Down Expand Up @@ -205,6 +211,12 @@ export interface ChatCompletionChunk {
*/
object: 'chat.completion.chunk';

/**
* The service tier used for processing the request. This field is only included if
* the `service_tier` parameter is specified in the request.
*/
service_tier?: 'scale' | 'default' | null;

/**
* This fingerprint represents the backend configuration that the model runs with.
* Can be used in conjunction with the `seed` request parameter to understand when
Expand Down Expand Up @@ -800,6 +812,19 @@ export interface ChatCompletionCreateParamsBase {
*/
seed?: number | null;

/**
* Specifies the latency tier to use for processing the request. This parameter is
* relevant for customers subscribed to the scale tier service:
*
* - If set to 'auto', the system will utilize scale tier credits until they are
* exhausted.
* - If set to 'default', the request will be processed in the shared cluster.
*
* When this parameter is set, the response body will include the `service_tier`
* utilized.
*/
service_tier?: 'auto' | 'default' | null;

/**
* Up to 4 sequences where the API will stop generating further tokens.
*/
Expand Down
1 change: 1 addition & 0 deletions tests/api-resources/chat/completions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe('resource completions', () => {
presence_penalty: -2,
response_format: { type: 'json_object' },
seed: -9223372036854776000,
service_tier: 'auto',
stop: 'string',
stream: false,
stream_options: { include_usage: true },
Expand Down