Skip to content

Commit

Permalink
feat(types): remove footgun with streaming params (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored and RobertCraigie committed Aug 23, 2023
1 parent c783604 commit 3ed67b6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/resources/completions.ts
Expand Up @@ -16,7 +16,7 @@ export class Completions extends APIResource {
options?: Core.RequestOptions,
): APIPromise<Stream<Completion>>;
create(
body: CompletionCreateParams,
body: CompletionCreateParamsBase,
options?: Core.RequestOptions,
): APIPromise<Stream<Completion> | Completion>;
create(
Expand Down Expand Up @@ -52,7 +52,9 @@ export interface Completion {
stop_reason: string;
}

export interface CompletionCreateParams {
export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming;

export interface CompletionCreateParamsBase {
/**
* The maximum number of tokens to generate before stopping.
*
Expand Down Expand Up @@ -158,7 +160,7 @@ export namespace CompletionCreateParams {
export type CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;
}

export interface CompletionCreateParamsNonStreaming extends CompletionCreateParams {
export interface CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase {
/**
* Whether to incrementally stream the response using server-sent events.
*
Expand All @@ -169,7 +171,7 @@ export interface CompletionCreateParamsNonStreaming extends CompletionCreatePara
stream?: false;
}

export interface CompletionCreateParamsStreaming extends CompletionCreateParams {
export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
/**
* Whether to incrementally stream the response using server-sent events.
*
Expand Down

0 comments on commit 3ed67b6

Please sign in to comment.