Skip to content

Commit

Permalink
[OpenAI] [Assistants] Add fileIds to Thread messages (#29500)
Browse files Browse the repository at this point in the history
Fix #29473 

### Packages impacted by this PR
@azure/openai-assistants

### Issues associated with this PR
#29473 

### Describe the problem that is addressed by this PR
Add fileIds to Thread messages

### What are the possible designs available to address the problem? If
there are more than one possible design, why was the one in this PR
chosen?


### Are there test cases added in this PR? _(If not, why?)_


### Provide a list of related PRs _(if any)_


### Command used to generate this PR:**_(Applicable only to SDK release
request PRs)_

### Checklists
- [ ] Added impacted package name to the issue description
- [ ] Does this PR needs any fixes in the SDK Generator?** _(If so,
create an Issue in the
[Autorest/typescript](https://github.com/Azure/autorest.typescript)
repository and link it here)_
- [ ] Added a changelog (if necessary)
  • Loading branch information
glharper committed Apr 29, 2024
1 parent 9e3fe17 commit a81dcbe
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ export interface AssistantThread {

// @public
export interface AssistantThreadCreationOptions {
messages?: {
role: string;
content: string;
}[];
messages?: ThreadInitializationMessage[];
metadata?: Record<string, string>;
}

Expand Down Expand Up @@ -502,7 +499,7 @@ export interface ThreadDeletionStatus extends DeletionStatus {
export interface ThreadInitializationMessage {
content: string;
fileIds?: string[];
metadata: Record<string, string> | null;
metadata?: Record<string, string> | null;
role: MessageRole;
}

Expand Down
13 changes: 9 additions & 4 deletions sdk/openai/openai-assistants/review/openai-assistants.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,7 @@ export interface AssistantThread {

// @public
export interface AssistantThreadCreationOptions {
messages?: {
role: string;
content: string;
}[];
messages?: ThreadInitializationMessage[];
metadata?: Record<string, string>;
}

Expand Down Expand Up @@ -551,6 +548,14 @@ export interface SubmitToolOutputsToRunOptions extends OperationOptions {
export interface ThreadDeletionStatus extends DeletionStatus {
}

// @public
export interface ThreadInitializationMessage {
content: string;
fileIds?: string[];
metadata?: Record<string, string> | null;
role: MessageRole;
}

// @public
export interface ThreadMessage {
assistantId?: string;
Expand Down
1 change: 1 addition & 0 deletions sdk/openai/openai-assistants/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export {
GetMessageFileOptions,
GetMessageOptions,
ThreadRun,
ThreadInitializationMessage,
CancelRunOptions,
CreateRunOptions,
CreateRunRequestOptions,
Expand Down
9 changes: 2 additions & 7 deletions sdk/openai/openai-assistants/src/models/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,7 @@ export interface AssistantFileDeletionStatus extends DeletionStatus {}
/** The details used to create a new assistant thread. */
export interface AssistantThreadCreationOptions {
/** The messages to associate with the new thread. */
messages?: {
/** The role associated with the assistant thread message. */
role: string;
/** The list of content items associated with the assistant thread message. */
content: string;
}[];
messages?: ThreadInitializationMessage[];
/** A set of key/value pairs used to store additional information about the object. */
metadata?: Record<string, string>;
}
Expand All @@ -145,7 +140,7 @@ export interface ThreadInitializationMessage {
*/
fileIds?: string[];
/** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */
metadata: Record<string, string> | null;
metadata?: Record<string, string> | null;
}

/** Information about a single thread associated with an assistant. */
Expand Down

0 comments on commit a81dcbe

Please sign in to comment.