Skip to content

Commit

Permalink
chore(api): update docs (#703)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Mar 13, 2024
1 parent 18d9cb7 commit c21ef88
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 26 deletions.
9 changes: 3 additions & 6 deletions src/resources/audio/speech.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ export interface SpeechCreateParams {
voice: 'alloy' | 'echo' | 'fable' | 'onyx' | 'nova' | 'shimmer';

/**
* The format to return audio in. Supported formats are `mp3`, `opus`, `aac`,
* `flac`, `pcm`, and `wav`.
*
* The `pcm` audio format, similar to `wav` but without a header, utilizes a 24kHz
* sample rate, mono channel, and 16-bit depth in signed little-endian format.
* The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`,
* `wav`, and `pcm`.
*/
response_format?: 'mp3' | 'opus' | 'aac' | 'flac' | 'pcm' | 'wav';
response_format?: 'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm';

/**
* The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
Expand Down
18 changes: 14 additions & 4 deletions src/resources/audio/transcriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ export class Transcriptions extends APIResource {
}
}

/**
* Represents a transcription response returned by model, based on the provided
* input.
*/
export interface Transcription {
/**
* The transcribed text.
*/
text: string;
}

Expand All @@ -26,7 +33,8 @@ export interface TranscriptionCreateParams {
file: Uploadable;

/**
* ID of the model to use. Only `whisper-1` is currently available.
* ID of the model to use. Only `whisper-1` (which is powered by our open source
* Whisper V2 model) is currently available.
*/
model: (string & {}) | 'whisper-1';

Expand Down Expand Up @@ -61,9 +69,11 @@ export interface TranscriptionCreateParams {
temperature?: number;

/**
* The timestamp granularities to populate for this transcription. Any of these
* options: `word`, or `segment`. Note: There is no additional latency for segment
* timestamps, but generating word timestamps incurs additional latency.
* The timestamp granularities to populate for this transcription.
* `response_format` must be set `verbose_json` to use timestamp granularities.
* Either or both of these options are supported: `word`, or `segment`. Note: There
* is no additional latency for segment timestamps, but generating word timestamps
* incurs additional latency.
*/
timestamp_granularities?: Array<'word' | 'segment'>;
}
Expand Down
3 changes: 2 additions & 1 deletion src/resources/audio/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export interface TranslationCreateParams {
file: Uploadable;

/**
* ID of the model to use. Only `whisper-1` is currently available.
* ID of the model to use. Only `whisper-1` (which is powered by our open source
* Whisper V2 model) is currently available.
*/
model: (string & {}) | 'whisper-1';

Expand Down
4 changes: 2 additions & 2 deletions src/resources/beta/threads/runs/runs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ export namespace Run {
*/
export interface LastError {
/**
* One of `server_error` or `rate_limit_exceeded`.
* One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`.
*/
code: 'server_error' | 'rate_limit_exceeded';
code: 'server_error' | 'rate_limit_exceeded' | 'invalid_prompt';

/**
* A human-readable description of the error.
Expand Down
14 changes: 9 additions & 5 deletions src/resources/chat/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,9 @@ export interface ChatCompletionTokenLogprob {
bytes: Array<number> | null;

/**
* The log probability of this token.
* The log probability of this token, if it is within the top 20 most likely
* tokens. Otherwise, the value `-9999.0` is used to signify that the token is very
* unlikely.
*/
logprob: number;

Expand Down Expand Up @@ -574,7 +576,9 @@ export namespace ChatCompletionTokenLogprob {
bytes: Array<number> | null;

/**
* The log probability of this token.
* The log probability of this token, if it is within the top 20 most likely
* tokens. Otherwise, the value `-9999.0` is used to signify that the token is very
* unlikely.
*/
logprob: number;
}
Expand Down Expand Up @@ -827,9 +831,9 @@ export interface ChatCompletionCreateParamsBase {
tools?: Array<ChatCompletionTool>;

/**
* An integer between 0 and 5 specifying the number of most likely tokens to return
* at each token position, each with an associated log probability. `logprobs` must
* be set to `true` if this parameter is used.
* An integer between 0 and 20 specifying the number of most likely tokens to
* return at each token position, each with an associated log probability.
* `logprobs` must be set to `true` if this parameter is used.
*/
top_logprobs?: number | null;

Expand Down
9 changes: 6 additions & 3 deletions src/resources/images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ export interface ImageCreateVariationParams {

/**
* The format in which the generated images are returned. Must be one of `url` or
* `b64_json`.
* `b64_json`. URLs are only valid for 60 minutes after the image has been
* generated.
*/
response_format?: 'url' | 'b64_json' | null;

Expand Down Expand Up @@ -131,7 +132,8 @@ export interface ImageEditParams {

/**
* The format in which the generated images are returned. Must be one of `url` or
* `b64_json`.
* `b64_json`. URLs are only valid for 60 minutes after the image has been
* generated.
*/
response_format?: 'url' | 'b64_json' | null;

Expand Down Expand Up @@ -176,7 +178,8 @@ export interface ImageGenerateParams {

/**
* The format in which the generated images are returned. Must be one of `url` or
* `b64_json`.
* `b64_json`. URLs are only valid for 60 minutes after the image has been
* generated.
*/
response_format?: 'url' | 'b64_json' | null;

Expand Down
8 changes: 3 additions & 5 deletions src/resources/moderations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as ModerationsAPI from 'openai/resources/moderations';

export class Moderations extends APIResource {
/**
* Classifies if text violates OpenAI's Content Policy
* Classifies if text is potentially harmful.
*/
create(
body: ModerationCreateParams,
Expand All @@ -28,8 +28,7 @@ export interface Moderation {
category_scores: Moderation.CategoryScores;

/**
* Whether the content violates
* [OpenAI's usage policies](/policies/usage-policies).
* Whether any of the below categories are flagged.
*/
flagged: boolean;
}
Expand Down Expand Up @@ -170,8 +169,7 @@ export namespace Moderation {
}

/**
* Represents policy compliance report by OpenAI's content moderation model against
* a given input.
* Represents if a given text input is potentially harmful.
*/
export interface ModerationCreateResponse {
/**
Expand Down

0 comments on commit c21ef88

Please sign in to comment.