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

[OpenAI-Assistant] Rename some method and model names. #27456

Merged
merged 2 commits into from
Jan 19, 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 specification/ai/OpenAI.Assistants/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ title: OpenAIAssistants
clear-output-folder: false
guessResourceKey: true
isAzureSpec: true
namespace: azure.openai.assistants
namespace: azure.ai.openai.assistants
14 changes: 7 additions & 7 deletions specification/ai/OpenAI.Assistants/assistants/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Azure.AI.OpenAI.Assistants;
using TypeSpec.Versioning;

@doc("Represents an assistant that can call the model and use tools.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model Assistant {
@doc("The identifier, which can be referenced in API endpoints.")
id: string;
Expand Down Expand Up @@ -46,7 +46,7 @@ model Assistant {
}

@doc("The request details to use when creating a new assistant.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model AssistantCreationOptions {
@doc("The ID of the model to use.")
`model`: string;
Expand Down Expand Up @@ -75,8 +75,8 @@ model AssistantCreationOptions {
}

@doc("The request details to use when modifying an existing assistant.")
@added(ServiceApiVersions.v2023_02_15_preview)
model AssistantModificationOptions {
@added(ServiceApiVersions.v2024_02_15_preview)
model UpdateAssistantOptions {
@doc("The ID of the model to use.")
`model`?: string;

Expand Down Expand Up @@ -104,7 +104,7 @@ model AssistantModificationOptions {

#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "https://github.com/Azure/autorest.csharp/issues/4041"
@doc("The status of an assistant deletion operation.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model AssistantDeletionStatus {
...DeletionStatus;

Expand All @@ -113,7 +113,7 @@ model AssistantDeletionStatus {
}

@doc("Information about a file attached to an assistant, as used by tools that can read files.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model AssistantFile {
@doc("The identifier, which can be referenced in API endpoints.")
id: string;
Expand All @@ -133,7 +133,7 @@ model AssistantFile {

#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "https://github.com/Azure/autorest.csharp/issues/4041"
@doc("The status of an assistant file deletion operation.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model AssistantFileDeletionStatus {
...DeletionStatus;

Expand Down
22 changes: 11 additions & 11 deletions specification/ai/OpenAI.Assistants/assistants/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Azure.AI.OpenAI.Assistants;
#suppress "@azure-tools/typespec-azure-core/no-operation-id" "non-standard operations"
#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned"
@post
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
@route("/assistants")
op createAssistant(...AssistantCreationOptions): Assistant;

Expand All @@ -32,7 +32,7 @@ op createAssistant(...AssistantCreationOptions): Assistant;
#suppress "@azure-tools/typespec-azure-core/no-operation-id" "non-standard operations"
#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned"
@get
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
@route("/assistants")
op listAssistants(...OpenAIListRequestOptions): OpenAIPageableListOf<Assistant>;

Expand All @@ -48,7 +48,7 @@ op listAssistants(...OpenAIListRequestOptions): OpenAIPageableListOf<Assistant>;
#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API name parity"
@get
@route("/assistants/{assistantId}")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
op getAssistant(@path assistantId: string): Assistant;

/**
Expand All @@ -63,10 +63,10 @@ op getAssistant(@path assistantId: string): Assistant;
#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned"
@post
@route("/assistants/{assistantId}")
@added(ServiceApiVersions.v2023_02_15_preview)
op modifyAssistant(
@added(ServiceApiVersions.v2024_02_15_preview)
op updateAssistant(
@path assistantId: string,
@body modificationOptions: AssistantModificationOptions,
@body updateAssistantOptions: UpdateAssistantOptions,
): Assistant;

/**
Expand All @@ -80,7 +80,7 @@ op modifyAssistant(
#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned"
@delete
@route("/assistants/{assistantId}")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
op deleteAssistant(@path assistantId: string): AssistantDeletionStatus;

/**
Expand All @@ -95,7 +95,7 @@ op deleteAssistant(@path assistantId: string): AssistantDeletionStatus;
#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned"
@post
@route("assistants/{assistantId}/files")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
op createAssistantFile(
@path assistantId: string,
@projectedName("json", "file_id") fileId: string,
Expand All @@ -113,7 +113,7 @@ op createAssistantFile(
#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned"
@get
@route("assistants/{assistantId}/files")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
op listAssistantFiles(
@path assistantId: string,
...OpenAIListRequestOptions,
Expand All @@ -132,7 +132,7 @@ op listAssistantFiles(
#suppress "@azure-tools/typespec-azure-core/use-standard-names" "mirrored API name parity"
@get
@route("assistants/{assistantId}/files/{fileId}")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
op getAssistantFile(
@path assistantId: string,
@path fileId: string,
Expand All @@ -151,7 +151,7 @@ op getAssistantFile(
#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned"
@delete
@route("assistants/{assistantId}/files/{fileId}")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
op deleteAssistantFile(
@path assistantId: string,
@path fileId: string,
Expand Down
1 change: 0 additions & 1 deletion specification/ai/OpenAI.Assistants/client.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ namespace Azure.AI.OpenAI.Assistants;
"OverrideInstructions"
);
@@projectedName(CreateAndRunThreadOptions.tools, "csharp", "OverrideTools");
@@projectedName(createFile, "csharp", "UploadFile");
// From https://platform.openai.com/docs/assistants/how-it-works
// "Note that deleting an AssistantFile doesn’t delete the original File object, it simply deletes the association
// between that File and the Assistant."
Expand Down
2 changes: 1 addition & 1 deletion specification/ai/OpenAI.Assistants/common/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using TypeSpec.Versioning;
namespace Azure.AI.OpenAI.Assistants;

@doc("The possible values for roles attributed to messages in a thread.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
enum MessageRole {
@doc("The role representing the end-user.")
user: "user",
Expand Down
8 changes: 4 additions & 4 deletions specification/ai/OpenAI.Assistants/files/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using TypeSpec.Versioning;

#suppress "@azure-tools/typespec-azure-core/casing-style" "OpenAI is a case-sensitive name"
@doc("Represents an assistant that can call the model and use tools.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model OpenAIFile {
@doc("The object type, which is always 'file'.")
object: "file";
Expand All @@ -30,7 +30,7 @@ model OpenAIFile {
}

@doc("The possible values denoting the intended usage of a file.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
enum FilePurpose {
@doc("Indicates a file is used for fine tuning input.")
fineTune: "fine-tune",
Expand All @@ -46,7 +46,7 @@ enum FilePurpose {
}

@doc("The response data from a file list operation.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model FileListResponse {
@doc("The object type, which is always 'list'.")
object: "list";
Expand All @@ -57,7 +57,7 @@ model FileListResponse {

#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "https://github.com/Azure/autorest.csharp/issues/4041"
@doc("A status response from a file deletion operation.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model FileDeletionStatus {
...DeletionStatus;

Expand Down
8 changes: 4 additions & 4 deletions specification/ai/OpenAI.Assistants/files/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Azure.AI.OpenAI.Assistants;
#suppress "@azure-tools/typespec-azure-core/no-operation-id" "non-standard operations"
#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned"
@get
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
@route("/files")
op listFiles(@query purpose?: FilePurpose): FileListResponse;

Expand All @@ -38,9 +38,9 @@ op listFiles(@query purpose?: FilePurpose): FileListResponse;
#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "not yet versioned"
#suppress "@azure-tools/typespec-azure-core/byos" "mirrored API"
@post
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
@route("/files")
op createFile(
op uploadFile(
@header contentType: "multipart/form-data",
@projectedName("csharp", "Data") file: bytes,
purpose: FilePurpose,
Expand Down Expand Up @@ -75,7 +75,7 @@ op deleteFile(
@get
@route("/files/{fileId}")
@doc("Returns information about a specific file. Does not retrieve file content.")
op retrieveFile(
op getFile(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as a bread crumb: I started a conversation to discuss which approach we want to take between keeping the operation ID fully consistent (OpenAI's /files API is "retrieveFile" even as the new surface includes "getAssistantFile") vs. consistent within the selectively merged surface we're creating for e2e Assistants use. I think either is good (though I have a slight preference in favor of your change) but it'd be great to get further feedback and/or add a quick note that we're intentionally changing the name here.

@doc("The ID of the file to retrieve.")
@path
@projectedName("json", "file_id")
Expand Down
2 changes: 1 addition & 1 deletion specification/ai/OpenAI.Assistants/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ namespace Azure.AI.OpenAI.Assistants;
enum ServiceApiVersions {
@useDependency(Azure.Core.Versions.v1_0_Preview_1)
@doc("The initial, beta version of assistants associated with OpenAI's 11/06/23 model releases.")
v2023_02_15_preview: "2024-02-15-preview",
v2024_02_15_preview: "2024-02-15-preview",
}
28 changes: 14 additions & 14 deletions specification/ai/OpenAI.Assistants/messages/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Azure.AI.OpenAI.Assistants;
using TypeSpec.Versioning;

@doc("A single message within an assistant thread, as provided during that thread's creation for its initial state.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model ThreadInitializationMessage {
@doc("The role associated with the assistant thread message. Currently, only 'user' is supported when providing initial messages to a new thread.")
role: MessageRole;
Expand All @@ -24,7 +24,7 @@ model ThreadInitializationMessage {
}

@doc("A single, existing message within an assistant thread.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model ThreadMessage {
@doc("The identifier, which can be referenced in API endpoints.")
id: string;
Expand Down Expand Up @@ -69,14 +69,14 @@ model ThreadMessage {

@discriminator("type")
@doc("An abstract representation of a single item of thread message content.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model MessageContent {
@doc("The object type.")
type: string;
}

@doc("A representation of a textual item of thread message content.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model MessageTextContent extends MessageContent {
@doc("The object type, which is always 'text'.")
type: "text";
Expand All @@ -86,7 +86,7 @@ model MessageTextContent extends MessageContent {
}

@doc("A representation of image file content in a thread message.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model MessageImageFileContent extends MessageContent {
@doc("The object type, which is always 'image_file'.")
type: "image_file";
Expand All @@ -99,7 +99,7 @@ model MessageImageFileContent extends MessageContent {
// Text content details

@doc("The text and associated annotations for a single item of assistant thread message content.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model MessageTextDetails {
@doc("The text data.")
value: string;
Expand All @@ -112,7 +112,7 @@ model MessageTextDetails {

@discriminator("type")
@doc("An abstract representation of an annotation to text thread message content.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model MessageTextAnnotation {
@doc("The object type.")
type: string;
Expand All @@ -132,7 +132,7 @@ model MessageTextAnnotation {
// File citation annotation + details

@doc("A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the 'retrieval' tool to search files.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model MessageFileCitationTextAnnotation extends MessageTextAnnotation {
@doc("The object type, which is always 'file_citation'.")
type: "file_citation";
Expand All @@ -146,7 +146,7 @@ model MessageFileCitationTextAnnotation extends MessageTextAnnotation {
}

@doc("A representation of a file-based text citation, as used in a file-based annotation of text thread message content.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model MessageTextFileCitationDetails {
@projectedName("json", "file_id")
@doc("The ID of the file associated with this citation.")
Expand All @@ -159,7 +159,7 @@ model MessageTextFileCitationDetails {
// File path annotation + details

@doc("A citation within the message that points to a file located at a specific path.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model MessageFilePathTextAnnotation extends MessageTextAnnotation {
@doc("The object type, which is always 'file_path'.")
type: "file_path";
Expand All @@ -170,7 +170,7 @@ model MessageFilePathTextAnnotation extends MessageTextAnnotation {
}

@doc("An encapsulation of an image file ID, as used by message image content.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model MessageFilePathDetails {
@doc("The ID of the specific file that the citation is from.")
@projectedName("json", "file_id")
Expand All @@ -180,15 +180,15 @@ model MessageFilePathDetails {
// Image file content details

@doc("An image reference, as represented in thread message content.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model MessageImageFileDetails {
@projectedName("json", "file_id")
@doc("The ID for the file associated with this image.")
fileId: MessageImageFileIdDetails;
}

@doc("An encapsulation of an image file ID, as used by message image content.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model MessageImageFileIdDetails {
@doc("The ID of the specific image file.")
@projectedName("json", "file_id")
Expand All @@ -198,7 +198,7 @@ model MessageImageFileIdDetails {
// Assistant message file representation, used for message "list files" route responses

@doc("Information about a file attached to an assistant thread message.")
@added(ServiceApiVersions.v2023_02_15_preview)
@added(ServiceApiVersions.v2024_02_15_preview)
model MessageFile {
@doc("The identifier, which can be referenced in API endpoints.")
id: string;
Expand Down
Loading
Loading