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

docs(api): improve docstrings #435

Merged
merged 1 commit into from
Nov 6, 2023
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ You can import in Deno via:
<!-- x-release-please-start-version -->

```ts
import OpenAI from 'https://deno.land/x/openai@4.15.4/mod.ts';
import OpenAI from 'https://deno.land/x/openai@4.16.0/mod.ts';
```

<!-- x-release-please-end -->
Expand Down
2 changes: 1 addition & 1 deletion build-deno
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This is a build produced from https://github.com/openai/openai-node – please g
Usage:

\`\`\`ts
import OpenAI from "$(echo 'https://deno.land/x/openai@4.15.4/mod.ts' | sed -E s/@\.+\\//@"$PACKAGE_VERSION"\\//)";
import OpenAI from "$(echo 'https://deno.land/x/openai@4.16.0/mod.ts' | sed -E s/@\.+\\//@"$PACKAGE_VERSION"\\//)";

const client = new OpenAI();
\`\`\`
Expand Down
54 changes: 27 additions & 27 deletions src/resources/beta/assistants/assistants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class Assistants extends APIResource {
files: FilesAPI.Files = new FilesAPI.Files(this.client);

/**
* Create an Assistant with a model and instructions.
* Create an assistant with a model and instructions.
*/
create(body: AssistantCreateParams, options?: Core.RequestOptions): Core.APIPromise<Assistant> {
return this.post('/assistants', {
Expand All @@ -22,7 +22,7 @@ export class Assistants extends APIResource {
}

/**
* Retrieves an Assistant.
* Retrieves an assistant.
*/
retrieve(assistantId: string, options?: Core.RequestOptions): Core.APIPromise<Assistant> {
return this.get(`/assistants/${assistantId}`, {
Expand All @@ -32,7 +32,7 @@ export class Assistants extends APIResource {
}

/**
* Modifies an Assistant.
* Modifies an assistant.
*/
update(
assistantId: string,
Expand All @@ -47,7 +47,7 @@ export class Assistants extends APIResource {
}

/**
* Returns a list of Assistants.
* Returns a list of assistants.
*/
list(
query?: AssistantListParams,
Expand All @@ -69,7 +69,7 @@ export class Assistants extends APIResource {
}

/**
* Delete an Assistant.
* Delete an assistant.
*/
del(assistantId: string, options?: Core.RequestOptions): Core.APIPromise<AsssitantDeleted> {
return this.delete(`/assistants/${assistantId}`, {
Expand All @@ -82,7 +82,7 @@ export class Assistants extends APIResource {
export class AssistantsPage extends CursorPage<Assistant> {}

/**
* Represents an `Assistant` that can call the model and use tools.
* Represents an `assistant` that can call the model and use tools.
*/
export interface Assistant {
/**
Expand All @@ -91,24 +91,24 @@ export interface Assistant {
id: string;

/**
* The Unix timestamp (in seconds) for when the Assistant was created.
* The Unix timestamp (in seconds) for when the assistant was created.
*/
created_at: number;

/**
* The description of the Assistant. The maximum length is 512 characters.
* The description of the assistant. The maximum length is 512 characters.
*/
description: string | null;

/**
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs
* attached to this Assistant. There can be a maximum of 20 files attached to the
* Assistant. Files are ordered by their creation date in ascending order.
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs
* attached to this assistant. There can be a maximum of 20 files attached to the
* assistant. Files are ordered by their creation date in ascending order.
*/
file_ids: Array<string>;

/**
* The system instructions that the Assistant uses. The maximum length is 32768
* The system instructions that the assistant uses. The maximum length is 32768
* characters.
*/
instructions: string | null;
Expand All @@ -131,7 +131,7 @@ export interface Assistant {
model: string;

/**
* The name of the Assistant. The maximum length is 256 characters.
* The name of the assistant. The maximum length is 256 characters.
*/
name: string | null;

Expand All @@ -141,7 +141,7 @@ export interface Assistant {
object: 'assistant';

/**
* A list of tool enabled on the Assistant. There can be a maximum of 128 tools per
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`.
*/
tools: Array<Assistant.CodeInterpreter | Assistant.Retreival | Assistant.Function>;
Expand Down Expand Up @@ -225,19 +225,19 @@ export interface AssistantCreateParams {
model: string;

/**
* The description of the Assistant. The maximum length is 512 characters.
* The description of the assistant. The maximum length is 512 characters.
*/
description?: string | null;

/**
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs
* attached to this Assistant. There can be a maximum of 20 files attached to the
* Assistant. Files are ordered by their creation date in ascending order.
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs
* attached to this assistant. There can be a maximum of 20 files attached to the
* assistant. Files are ordered by their creation date in ascending order.
*/
file_ids?: Array<string>;

/**
* The system instructions that the Assistant uses. The maximum length is 32768
* The system instructions that the assistant uses. The maximum length is 32768
* characters.
*/
instructions?: string | null;
Expand All @@ -251,12 +251,12 @@ export interface AssistantCreateParams {
metadata?: unknown | null;

/**
* The name of the Assistant. The maximum length is 256 characters.
* The name of the assistant. The maximum length is 256 characters.
*/
name?: string | null;

/**
* A list of tool enabled on the Assistant. There can be a maximum of 128 tools per
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`.
*/
tools?: Array<
Expand Down Expand Up @@ -327,21 +327,21 @@ export namespace AssistantCreateParams {

export interface AssistantUpdateParams {
/**
* The description of the Assistant. The maximum length is 512 characters.
* The description of the assistant. The maximum length is 512 characters.
*/
description?: string | null;

/**
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs
* attached to this Assistant. There can be a maximum of 20 files attached to the
* Assistant. Files are ordered by their creation date in ascending order. If a
* attached to this assistant. There can be a maximum of 20 files attached to the
* assistant. Files are ordered by their creation date in ascending order. If a
* file was previosuly attached to the list but does not show up in the list, it
* will be deleted from the assistant.
*/
file_ids?: Array<string>;

/**
* The system instructions that the Assistant uses. The maximum length is 32768
* The system instructions that the assistant uses. The maximum length is 32768
* characters.
*/
instructions?: string | null;
Expand All @@ -364,12 +364,12 @@ export interface AssistantUpdateParams {
model?: string;

/**
* The name of the Assistant. The maximum length is 256 characters.
* The name of the assistant. The maximum length is 256 characters.
*/
name?: string | null;

/**
* A list of tool enabled on the Assistant. There can be a maximum of 128 tools per
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`.
*/
tools?: Array<
Expand Down
18 changes: 9 additions & 9 deletions src/resources/beta/assistants/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { CursorPage, type CursorPageParams } from 'openai/pagination';

export class Files extends APIResource {
/**
* Create an Assistant File by attaching a
* Create an assistant file by attaching a
* [File](https://platform.openai.com/docs/api-reference/files) to an
* [Assistant](https://platform.openai.com/docs/api-reference/assistants).
* [assistant](https://platform.openai.com/docs/api-reference/assistants).
*/
create(
assistantId: string,
Expand Down Expand Up @@ -39,7 +39,7 @@ export class Files extends APIResource {
}

/**
* Returns a list of Assistant Files.
* Returns a list of assistant files.
*/
list(
assistantId: string,
Expand All @@ -66,7 +66,7 @@ export class Files extends APIResource {
}

/**
* Delete an Assistant File.
* Delete an assistant file.
*/
del(
assistantId: string,
Expand All @@ -84,7 +84,7 @@ export class AssistantFilesPage extends CursorPage<AssistantFile> {}

/**
* A list of [Files](https://platform.openai.com/docs/api-reference/files) attached
* to an `Assistant`.
* to an `assistant`.
*/
export interface AssistantFile {
/**
Expand All @@ -93,12 +93,12 @@ export interface AssistantFile {
id: string;

/**
* The Assistant ID that the File is attached to.
* The assistant ID that the file is attached to.
*/
assistant_id: string;

/**
* The Unix timestamp (in seconds) for when the Assistant File was created.
* The Unix timestamp (in seconds) for when the assistant file was created.
*/
created_at: number;

Expand All @@ -109,7 +109,7 @@ export interface AssistantFile {
}

/**
* Deletes the association between the Assistant and the File, but does not delete
* Deletes the association between the assistant and the file, but does not delete
* the [File](https://platform.openai.com/docs/api-reference/files) object itself.
*/
export interface FileDeleteResponse {
Expand All @@ -123,7 +123,7 @@ export interface FileDeleteResponse {
export interface FileCreateParams {
/**
* A [File](https://platform.openai.com/docs/api-reference/files) ID (with
* `purpose="assistants"`) that the Assistant should use. Useful for tools like
* `purpose="assistants"`) that the assistant should use. Useful for tools like
* `retrieval` and `code_interpreter` that can access files.
*/
file_id: string;
Expand Down
10 changes: 5 additions & 5 deletions src/resources/beta/threads/messages/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { CursorPage, type CursorPageParams } from 'openai/pagination';

export class Files extends APIResource {
/**
* Retrieves a Message File.
* Retrieves a message file.
*/
retrieve(
threadId: string,
Expand All @@ -23,7 +23,7 @@ export class Files extends APIResource {
}

/**
* Returns a list of Message Files.
* Returns a list of message files.
*/
list(
threadId: string,
Expand Down Expand Up @@ -56,7 +56,7 @@ export class Files extends APIResource {
export class MessageFilesPage extends CursorPage<MessageFile> {}

/**
* A list of Files attached to a `Message`.
* A list of files attached to a `message`.
*/
export interface MessageFile {
/**
Expand All @@ -65,12 +65,12 @@ export interface MessageFile {
id: string;

/**
* The Unix timestamp (in seconds) for when the Message File was created.
* The Unix timestamp (in seconds) for when the message file was created.
*/
created_at: number;

/**
* The ID of the [Message](https://platform.openai.com/docs/api-reference/messages)
* The ID of the [message](https://platform.openai.com/docs/api-reference/messages)
* that the [File](https://platform.openai.com/docs/api-reference/files) is
* attached to.
*/
Expand Down
Loading