From f07a83068eeb3121dba63a55340f96fb7f19053b Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Mon, 12 Feb 2024 15:07:03 -0800 Subject: [PATCH] Replace `@projectedName("json"` -> `@encodedName("application/json"` (#27740) --- specification/ai/ImageAnalysis/models.tsp | 18 ++++---- .../OpenAI.Assistants/assistants/models.tsp | 12 +++--- .../OpenAI.Assistants/assistants/routes.tsp | 2 +- .../ai/OpenAI.Assistants/common/models.tsp | 6 +-- .../ai/OpenAI.Assistants/files/models.tsp | 2 +- .../ai/OpenAI.Assistants/files/routes.tsp | 4 +- .../ai/OpenAI.Assistants/messages/models.tsp | 34 +++++++-------- .../ai/OpenAI.Assistants/messages/routes.tsp | 2 +- .../ai/OpenAI.Assistants/run_steps/models.tsp | 26 ++++++------ .../ai/OpenAI.Assistants/runs/models.tsp | 32 +++++++-------- .../ai/OpenAI.Assistants/runs/routes.tsp | 2 +- .../ai/OpenAI.Assistants/threads/models.tsp | 2 +- .../ai/OpenAI.Assistants/tools/models.tsp | 6 +-- .../models/audio/audio_transcription.tsp | 8 ++-- .../models/audio/audio_translation.tsp | 8 ++-- .../completions/azure_content_filtering.tsp | 16 ++++---- .../models/completions/chat_completions.tsp | 41 ++++++------------- .../models/completions/chat_messages.tsp | 12 +++--- .../models/completions/common.tsp | 6 +-- .../models/completions/completions_create.tsp | 41 ++++++------------- .../models/embeddings_create.tsp | 6 +-- .../OpenAI.Inference/models/images/images.tsp | 8 ++-- .../LoadTestService/models.tsp | 2 +- 23 files changed, 129 insertions(+), 167 deletions(-) diff --git a/specification/ai/ImageAnalysis/models.tsp b/specification/ai/ImageAnalysis/models.tsp index 5731d45f9ec4..8216950a6abf 100644 --- a/specification/ai/ImageAnalysis/models.tsp +++ b/specification/ai/ImageAnalysis/models.tsp @@ -15,12 +15,12 @@ model ImageBoundingBox { @doc("Width of the area, in pixels.") @minValue(0) - @projectedName("json", "w") + @encodedName("application/json", "w") width: int32; @doc("Height of the area, in pixels.") @minValue(0) - @projectedName("json", "h") + @encodedName("application/json", "h") height: int32; } @@ -166,14 +166,14 @@ model DetectedTextBlock { @doc("Represents the outcome of an Image Analysis operation.") model ImageAnalysisResult { @doc("The generated phrase that describes the content of the analyzed image.") - @projectedName("json", "captionResult") + @encodedName("application/json", "captionResult") caption?: CaptionResult; @doc(""" The up to 10 generated phrases, the first describing the content of the whole image, and the others describing the content of different regions of the image. """) - @projectedName("json", "denseCaptionsResult") + @encodedName("application/json", "denseCaptionsResult") denseCaptions?: DenseCaptionsResult; @doc("Metadata associated with the analyzed image.") @@ -183,26 +183,26 @@ model ImageAnalysisResult { modelVersion: string; @doc("A list of detected physical objects in the analyzed image, and their location.") - @projectedName("json", "objectsResult") + @encodedName("application/json", "objectsResult") objects?: ObjectsResult; @doc("A list of detected people in the analyzed image, and their location.") - @projectedName("json", "peopleResult") + @encodedName("application/json", "peopleResult") people?: PeopleResult; @doc("The extracted printed and hand-written text in the analyze image. Also knows as OCR.") - @projectedName("json", "readResult") + @encodedName("application/json", "readResult") read?: ReadResult; @doc(""" A list of crop regions at the desired as aspect ratios (if provided) that can be used as image thumbnails. These regions preserve as much content as possible from the analyzed image, with priority given to detected faces. """) - @projectedName("json", "smartCropsResult") + @encodedName("application/json", "smartCropsResult") smartCrops?: SmartCropsResult; @doc("A list of content tags in the analyzed image.") - @projectedName("json", "tagsResult") + @encodedName("application/json", "tagsResult") tags?: TagsResult; } diff --git a/specification/ai/OpenAI.Assistants/assistants/models.tsp b/specification/ai/OpenAI.Assistants/assistants/models.tsp index 5b3f78051b00..6f82c711d58d 100644 --- a/specification/ai/OpenAI.Assistants/assistants/models.tsp +++ b/specification/ai/OpenAI.Assistants/assistants/models.tsp @@ -16,7 +16,7 @@ model Assistant { @doc("The object type, which is always assistant.") object: "assistant"; - @projectedName("json", "created_at") + @encodedName("application/json", "created_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this object was created.") createdAt: utcDateTime; @@ -39,7 +39,7 @@ model Assistant { @doc("The collection of tools enabled for the assistant.") tools: ToolDefinition[] = []; - @projectedName("json", "file_ids") + @encodedName("application/json", "file_ids") @doc("A list of attached file IDs, ordered by creation date in ascending order.") fileIds: string[] = []; @@ -68,7 +68,7 @@ model AssistantCreationOptions { @doc("The collection of tools to enable for the new assistant.") tools?: ToolDefinition[] = []; - @projectedName("json", "file_ids") + @encodedName("application/json", "file_ids") @doc("A list of previously uploaded file IDs to attach to the assistant.") fileIds?: string[] = []; @@ -100,7 +100,7 @@ model UpdateAssistantOptions { @doc("The modified collection of tools to enable for the assistant.") tools?: ToolDefinition[] = []; - @projectedName("json", "file_ids") + @encodedName("application/json", "file_ids") @doc("The modified list of previously uploaded fileIDs to attach to the assistant.") fileIds?: string[] = []; @@ -125,12 +125,12 @@ model AssistantFile { @doc("The object type, which is always 'assistant.file'.") object: "assistant.file"; - @projectedName("json", "created_at") + @encodedName("application/json", "created_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this object was created.") createdAt: utcDateTime; - @projectedName("json", "assistant_id") + @encodedName("application/json", "assistant_id") @doc("The assistant ID that the file is attached to.") assistantId: string; } diff --git a/specification/ai/OpenAI.Assistants/assistants/routes.tsp b/specification/ai/OpenAI.Assistants/assistants/routes.tsp index b164b8be98f0..bbdb7829485a 100644 --- a/specification/ai/OpenAI.Assistants/assistants/routes.tsp +++ b/specification/ai/OpenAI.Assistants/assistants/routes.tsp @@ -94,7 +94,7 @@ op deleteAssistant(@path assistantId: string): AssistantDeletionStatus; @added(ServiceApiVersions.v2024_02_15_preview) op createAssistantFile( @path assistantId: string, - @projectedName("json", "file_id") fileId: string, + @encodedName("application/json", "file_id") fileId: string, ): AssistantFile; /** diff --git a/specification/ai/OpenAI.Assistants/common/models.tsp b/specification/ai/OpenAI.Assistants/common/models.tsp index b14289158081..3cb86ef89fb5 100644 --- a/specification/ai/OpenAI.Assistants/common/models.tsp +++ b/specification/ai/OpenAI.Assistants/common/models.tsp @@ -52,15 +52,15 @@ model OpenAIPageableListOf { @doc("The requested list of items.") data: T[]; - @projectedName("json", "first_id") + @encodedName("application/json", "first_id") @doc("The first ID represented in this list.") firstId: string; - @projectedName("json", "last_id") + @encodedName("application/json", "last_id") @doc("The last ID represented in this list.") lastId: string; - @projectedName("json", "has_more") + @encodedName("application/json", "has_more") @doc("A value indicating whether there are additional values available not captured in this list.") hasMore: boolean; } diff --git a/specification/ai/OpenAI.Assistants/files/models.tsp b/specification/ai/OpenAI.Assistants/files/models.tsp index 23d2c04e040b..87a897edff65 100644 --- a/specification/ai/OpenAI.Assistants/files/models.tsp +++ b/specification/ai/OpenAI.Assistants/files/models.tsp @@ -20,7 +20,7 @@ model OpenAIFile { @doc("The name of the file.") filename: string; - @projectedName("json", "created_at") + @encodedName("application/json", "created_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this object was created.") createdAt: utcDateTime; diff --git a/specification/ai/OpenAI.Assistants/files/routes.tsp b/specification/ai/OpenAI.Assistants/files/routes.tsp index e8f3152f2e6b..fde1cfc385e3 100644 --- a/specification/ai/OpenAI.Assistants/files/routes.tsp +++ b/specification/ai/OpenAI.Assistants/files/routes.tsp @@ -63,7 +63,7 @@ op uploadFile( @route("/files/{fileId}") op deleteFile( @doc("The ID of the file to delete.") - @projectedName("json", "file_id") + @encodedName("application/json", "file_id") @path fileId: string, ): FileDeletionStatus; @@ -78,6 +78,6 @@ op deleteFile( op getFile( @doc("The ID of the file to retrieve.") @path - @projectedName("json", "file_id") + @encodedName("application/json", "file_id") fileId: string, ): OpenAIFile; diff --git a/specification/ai/OpenAI.Assistants/messages/models.tsp b/specification/ai/OpenAI.Assistants/messages/models.tsp index aa929623fb90..f53eba607013 100644 --- a/specification/ai/OpenAI.Assistants/messages/models.tsp +++ b/specification/ai/OpenAI.Assistants/messages/models.tsp @@ -13,7 +13,7 @@ model ThreadInitializationMessage { @doc("The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via a separate call to the create message API.") content: string; - @projectedName("json", "file_ids") + @encodedName("application/json", "file_ids") @doc(""" A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can access files. @@ -32,12 +32,12 @@ model ThreadMessage { @doc("The object type, which is always 'thread.message'.") object: "thread.message"; - @projectedName("json", "created_at") + @encodedName("application/json", "created_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this object was created.") createdAt: utcDateTime; - @projectedName("json", "thread_id") + @encodedName("application/json", "thread_id") @doc("The ID of the thread that this message belongs to.") threadId: string; @@ -47,15 +47,15 @@ model ThreadMessage { @doc("The list of content items associated with the assistant thread message.") content: MessageContent[]; - @projectedName("json", "assistant_id") + @encodedName("application/json", "assistant_id") @doc("If applicable, the ID of the assistant that authored this message.") assistantId?: string; - @projectedName("json", "run_id") + @encodedName("application/json", "run_id") @doc("If applicable, the ID of the run associated with the authoring of this message.") runId?: string; - @projectedName("json", "file_ids") + @encodedName("application/json", "file_ids") @doc(""" A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can access files. @@ -91,7 +91,7 @@ model MessageImageFileContent extends MessageContent { @doc("The object type, which is always 'image_file'.") type: "image_file"; - @projectedName("json", "image_file") + @encodedName("application/json", "image_file") @doc("The image file for this thread message content item.") imageFile: MessageImageFileDetails; } @@ -120,11 +120,11 @@ model MessageTextAnnotation { @doc("The textual content associated with this text annotation item.") text: string; - @projectedName("json", "start_index") + @encodedName("application/json", "start_index") @doc("The first text index associated with this text annotation.") startIndex: int32; - @projectedName("json", "end_index") + @encodedName("application/json", "end_index") @doc("The last text index associated with this text annotation.") endIndex: int32; } @@ -137,7 +137,7 @@ model MessageTextFileCitationAnnotation extends MessageTextAnnotation { @doc("The object type, which is always 'file_citation'.") type: "file_citation"; - @projectedName("json", "file_citation") + @encodedName("application/json", "file_citation") @doc(""" A citation within the message that points to a specific quote from a specific file. Generated when the assistant uses the "retrieval" tool to search files. @@ -148,7 +148,7 @@ model MessageTextFileCitationAnnotation 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.v2024_02_15_preview) model MessageTextFileCitationDetails { - @projectedName("json", "file_id") + @encodedName("application/json", "file_id") @doc("The ID of the file associated with this citation.") fileId: string; @@ -164,7 +164,7 @@ model MessageTextFilePathAnnotation extends MessageTextAnnotation { @doc("The object type, which is always 'file_path'.") type: "file_path"; - @projectedName("json", "file_path") + @encodedName("application/json", "file_path") @doc("A URL for the file that's generated when the assistant used the code_interpreter tool to generate a file.") filePath: MessageTextFilePathDetails; } @@ -173,7 +173,7 @@ model MessageTextFilePathAnnotation extends MessageTextAnnotation { @added(ServiceApiVersions.v2024_02_15_preview) model MessageTextFilePathDetails { @doc("The ID of the specific file that the citation is from.") - @projectedName("json", "file_id") + @encodedName("application/json", "file_id") fileId: string; } @@ -182,7 +182,7 @@ model MessageTextFilePathDetails { @doc("An image reference, as represented in thread message content.") @added(ServiceApiVersions.v2024_02_15_preview) model MessageImageFileDetails { - @projectedName("json", "file_id") + @encodedName("application/json", "file_id") @doc("The ID for the file associated with this image.") fileId: MessageImageFileIdDetails; } @@ -191,7 +191,7 @@ model MessageImageFileDetails { @added(ServiceApiVersions.v2024_02_15_preview) model MessageImageFileIdDetails { @doc("The ID of the specific image file.") - @projectedName("json", "file_id") + @encodedName("application/json", "file_id") fileId: string; } @@ -206,12 +206,12 @@ model MessageFile { @doc("The object type, which is always 'thread.message.file'.") object: "thread.message.file"; - @projectedName("json", "created_at") + @encodedName("application/json", "created_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this object was created.") createdAt: utcDateTime; - @projectedName("json", "message_id") + @encodedName("application/json", "message_id") @doc("The ID of the message that this file is attached to.") messageId: string; } diff --git a/specification/ai/OpenAI.Assistants/messages/routes.tsp b/specification/ai/OpenAI.Assistants/messages/routes.tsp index ef9afeccb056..356bf12e140f 100644 --- a/specification/ai/OpenAI.Assistants/messages/routes.tsp +++ b/specification/ai/OpenAI.Assistants/messages/routes.tsp @@ -33,7 +33,7 @@ op createMessage( @path threadId: string, role: MessageRole, content: string, - @projectedName("json", "file_ids") fileIds?: string[], + @encodedName("application/json", "file_ids") fileIds?: string[], ...OptionalNullableMetadata, ): ThreadMessage; diff --git a/specification/ai/OpenAI.Assistants/run_steps/models.tsp b/specification/ai/OpenAI.Assistants/run_steps/models.tsp index 38b14f6dfcfb..d13b49c3e9da 100644 --- a/specification/ai/OpenAI.Assistants/run_steps/models.tsp +++ b/specification/ai/OpenAI.Assistants/run_steps/models.tsp @@ -17,55 +17,55 @@ model RunStep { @doc("The type of run step, which can be either message_creation or tool_calls.") type: RunStepType; - @projectedName("json", "assistant_id") + @encodedName("application/json", "assistant_id") @doc("The ID of the assistant associated with the run step.") assistantId: string; - @projectedName("json", "thread_id") + @encodedName("application/json", "thread_id") @doc("The ID of the thread that was run.") threadId: string; - @projectedName("json", "run_id") + @encodedName("application/json", "run_id") @doc("The ID of the run that this run step is a part of.") runId: string; @doc("The status of this run step.") status: RunStepStatus; - @projectedName("json", "step_details") + @encodedName("application/json", "step_details") @doc("The details for this run step.") stepDetails: RunStepDetails; #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" - @projectedName("json", "last_error") + @encodedName("application/json", "last_error") @doc("If applicable, information about the last error encountered by this run step.") lastError: RunStepError | null; - @projectedName("json", "created_at") + @encodedName("application/json", "created_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this object was created.") createdAt: utcDateTime; #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" - @projectedName("json", "expired_at") + @encodedName("application/json", "expired_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this item expired.") expiredAt: utcDateTime | null; #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" - @projectedName("json", "completed_at") + @encodedName("application/json", "completed_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this completed.") completedAt: utcDateTime | null; #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" - @projectedName("json", "cancelled_at") + @encodedName("application/json", "cancelled_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this was cancelled.") cancelledAt: utcDateTime | null; #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" - @projectedName("json", "failed_at") + @encodedName("application/json", "failed_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this failed.") failedAt: utcDateTime | null; @@ -97,7 +97,7 @@ model RunStepMessageCreationDetails extends RunStepDetails { @doc("The object type, which is always 'message_creation'.") type: RunStepType.messageCreation; - @projectedName("json", "message_creation") + @encodedName("application/json", "message_creation") @doc("Information about the message creation associated with this run step.") messageCreation: RunStepMessageCreationReference; } @@ -108,7 +108,7 @@ model RunStepToolCallDetails extends RunStepDetails { @doc("The object type, which is always 'tool_calls'.") type: RunStepType.toolCalls; - @projectedName("json", "tool_calls") + @encodedName("application/json", "tool_calls") @doc("A list of tool call details for this run step.") toolCalls: RunStepToolCall[]; } @@ -116,7 +116,7 @@ model RunStepToolCallDetails extends RunStepDetails { @doc("The details of a message created as a part of a run step.") @added(ServiceApiVersions.v2024_02_15_preview) model RunStepMessageCreationReference { - @projectedName("json", "message_id") + @encodedName("application/json", "message_id") @doc("The ID of the message created by this run step.") messageId: string; } diff --git a/specification/ai/OpenAI.Assistants/runs/models.tsp b/specification/ai/OpenAI.Assistants/runs/models.tsp index 96f5b13b6750..18ab265d1e12 100644 --- a/specification/ai/OpenAI.Assistants/runs/models.tsp +++ b/specification/ai/OpenAI.Assistants/runs/models.tsp @@ -16,11 +16,11 @@ model ThreadRun { @doc("The object type, which is always 'thread.run'.") object: "thread.run"; - @projectedName("json", "thread_id") + @encodedName("application/json", "thread_id") @doc("The ID of the thread associated with this run.") threadId: string; - @projectedName("json", "assistant_id") + @encodedName("application/json", "assistant_id") @doc("The ID of the assistant associated with the thread this run was performed against.") assistantId: string; @@ -33,12 +33,12 @@ model ThreadRun { // https://platform.openai.com/docs/api-reference/runs/object#runs/object-expires_at // https://github.com/openai/openai-openapi/blob/master/openapi.yaml#L8245 #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" - @projectedName("json", "required_action") + @encodedName("application/json", "required_action") @doc("The details of the action required for the assistant thread run to continue.") requiredAction?: RequiredAction | null; #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" - @projectedName("json", "last_error") + @encodedName("application/json", "last_error") @doc("The last error, if any, encountered by this assistant thread run.") lastError: RunError | null; @@ -51,11 +51,11 @@ model ThreadRun { @doc("The overridden enabled tools used for this assistant thread run.") tools: ToolDefinition[] = []; - @projectedName("json", "file_ids") + @encodedName("application/json", "file_ids") @doc("A list of attached file IDs, ordered by creation date in ascending order.") fileIds: string[] = []; - @projectedName("json", "created_at") + @encodedName("application/json", "created_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this object was created.") createdAt: utcDateTime; @@ -64,31 +64,31 @@ model ThreadRun { // for completed runs. // https://platform.openai.com/docs/api-reference/runs/object#runs/object-expires_at #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" - @projectedName("json", "expires_at") + @encodedName("application/json", "expires_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this item expires.") expiresAt: utcDateTime | null; #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" - @projectedName("json", "started_at") + @encodedName("application/json", "started_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this item was started.") startedAt: utcDateTime | null; #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" - @projectedName("json", "completed_at") + @encodedName("application/json", "completed_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this completed.") completedAt: utcDateTime | null; #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" - @projectedName("json", "cancelled_at") + @encodedName("application/json", "cancelled_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this was cancelled.") cancelledAt: utcDateTime | null; #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" - @projectedName("json", "failed_at") + @encodedName("application/json", "failed_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this failed.") failedAt: utcDateTime | null; @@ -100,7 +100,7 @@ model ThreadRun { @added(ServiceApiVersions.v2024_02_15_preview) model CreateRunOptions { @doc("The ID of the assistant that should run the thread.") - @projectedName("json", "assistant_id") + @encodedName("application/json", "assistant_id") assistantId: string; #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" @@ -112,7 +112,7 @@ model CreateRunOptions { instructions?: string | null; #suppress "@azure-tools/typespec-azure-core/no-nullable" "OpenAI uses explicit nullability, distinct from optionality" - @projectedName("json", "additional_instructions") + @encodedName("application/json", "additional_instructions") @doc(""" Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions. @@ -178,7 +178,7 @@ model SubmitToolOutputsAction extends RequiredAction { @doc("The object type, which is always 'submit_tool_outputs'.") type: "submit_tool_outputs"; - @projectedName("json", "submit_tool_outputs") + @encodedName("application/json", "submit_tool_outputs") @doc("The details describing tools that should be called to submit tool outputs.") submitToolOutputs: SubmitToolOutputsDetails; } @@ -186,7 +186,7 @@ model SubmitToolOutputsAction extends RequiredAction { @doc("The details describing tools that should be called to submit tool outputs.") @added(ServiceApiVersions.v2024_02_15_preview) model SubmitToolOutputsDetails { - @projectedName("json", "tool_calls") + @encodedName("application/json", "tool_calls") @doc("The list of tool calls that must be resolved for the assistant thread run to continue.") toolCalls: RequiredToolCall[]; } @@ -194,7 +194,7 @@ model SubmitToolOutputsDetails { @doc("The details used when creating and immediately running a new assistant thread.") @added(ServiceApiVersions.v2024_02_15_preview) model CreateAndRunThreadOptions { - @projectedName("json", "assistant_id") + @encodedName("application/json", "assistant_id") @doc("The ID of the assistant for which the thread should be created.") assistantId: string; diff --git a/specification/ai/OpenAI.Assistants/runs/routes.tsp b/specification/ai/OpenAI.Assistants/runs/routes.tsp index 071c91a6581b..1a4f417b33db 100644 --- a/specification/ai/OpenAI.Assistants/runs/routes.tsp +++ b/specification/ai/OpenAI.Assistants/runs/routes.tsp @@ -101,7 +101,7 @@ op updateRun( op submitToolOutputsToRun( @path threadId: string, @path runId: string, - @projectedName("json", "tool_outputs") toolOutputs: ToolOutput[], + @encodedName("application/json", "tool_outputs") toolOutputs: ToolOutput[], ): ThreadRun; /** diff --git a/specification/ai/OpenAI.Assistants/threads/models.tsp b/specification/ai/OpenAI.Assistants/threads/models.tsp index 5c94894b61a4..d4097d0fecb0 100644 --- a/specification/ai/OpenAI.Assistants/threads/models.tsp +++ b/specification/ai/OpenAI.Assistants/threads/models.tsp @@ -15,7 +15,7 @@ model AssistantThread { @doc("The object type, which is always 'thread'.") object: "thread"; - @projectedName("json", "created_at") + @encodedName("application/json", "created_at") @encode(DateTimeKnownEncoding.unixTimestamp, int32) @doc("The Unix timestamp, in seconds, representing when this object was created.") createdAt: utcDateTime; diff --git a/specification/ai/OpenAI.Assistants/tools/models.tsp b/specification/ai/OpenAI.Assistants/tools/models.tsp index 542bd00dd9a4..250013bdf449 100644 --- a/specification/ai/OpenAI.Assistants/tools/models.tsp +++ b/specification/ai/OpenAI.Assistants/tools/models.tsp @@ -119,7 +119,7 @@ model RunStepCodeInterpreterToolCall extends RunStepToolCall { @doc("The object type, which is always 'code_interpreter'.") type: "code_interpreter"; - @projectedName("json", "code_interpreter") + @encodedName("application/json", "code_interpreter") @doc("The details of the tool call to the code interpreter tool.") codeInterpreter: RunStepCodeInterpreterToolCallDetails; } @@ -195,7 +195,7 @@ model RunStepCodeInterpreterImageOutput @doc("An image reference emitted by a code interpreter tool in response to a tool call by the model.") @added(ServiceApiVersions.v2024_02_15_preview) model RunStepCodeInterpreterImageReference { - @projectedName("json", "file_id") + @encodedName("application/json", "file_id") @doc("The ID of the file associated with this image.") fileId: string; } @@ -224,7 +224,7 @@ model RunStepFunctionToolCallDetails { @added(ServiceApiVersions.v2024_02_15_preview) model ToolOutput { @doc("The ID of the tool call being resolved, as provided in the tool calls of a required action from a run.") - @projectedName("json", "tool_call_id") + @encodedName("application/json", "tool_call_id") toolCallId?: string; @doc("The output from the tool to be submitted.") diff --git a/specification/cognitiveservices/OpenAI.Inference/models/audio/audio_transcription.tsp b/specification/cognitiveservices/OpenAI.Inference/models/audio/audio_transcription.tsp index 1e68921410b1..536752d25067 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/audio/audio_transcription.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/audio/audio_transcription.tsp @@ -51,7 +51,7 @@ model AudioTranscriptionOptions { @doc(""" The requested format of the transcription response data, which will influence the content and detail of the result. """) - @projectedName("json", "response_format") + @encodedName("application/json", "response_format") responseFormat?: AudioTranscriptionFormat; @doc(""" @@ -109,16 +109,16 @@ model AudioTranscriptionSegment { temperature: float32; @doc("The average log probability associated with this audio segment.") - @projectedName("json", "avg_logprob") + @encodedName("application/json", "avg_logprob") @projectedName("csharp", "AverageLogProbability") avgLogprob: float32; @doc("The compression ratio of this audio segment.") - @projectedName("json", "compression_ratio") + @encodedName("application/json", "compression_ratio") compressionRatio: float32; @doc("The probability of no speech detection within this audio segment.") - @projectedName("json", "no_speech_prob") + @encodedName("application/json", "no_speech_prob") @projectedName("csharp", "NoSpeechProbability") noSpeechProb: float32; diff --git a/specification/cognitiveservices/OpenAI.Inference/models/audio/audio_translation.tsp b/specification/cognitiveservices/OpenAI.Inference/models/audio/audio_translation.tsp index d2a09137b0df..113f78a8899c 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/audio/audio_translation.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/audio/audio_translation.tsp @@ -51,7 +51,7 @@ model AudioTranslationOptions { @doc(""" The requested format of the translation response data, which will influence the content and detail of the result. """) - @projectedName("json", "response_format") + @encodedName("application/json", "response_format") responseFormat?: AudioTranslationFormat; @doc(""" @@ -102,16 +102,16 @@ model AudioTranslationSegment { temperature: float32; @doc("The average log probability associated with this audio segment.") - @projectedName("json", "avg_logprob") + @encodedName("application/json", "avg_logprob") @projectedName("csharp", "AverageLogProbability") avgLogprob: float32; @doc("The compression ratio of this audio segment.") - @projectedName("json", "compression_ratio") + @encodedName("application/json", "compression_ratio") compressionRatio: float32; @doc("The probability of no speech detection within this audio segment.") - @projectedName("json", "no_speech_prob") + @encodedName("application/json", "no_speech_prob") @projectedName("csharp", "NoSpeechProbability") noSpeechProb: float32; diff --git a/specification/cognitiveservices/OpenAI.Inference/models/completions/azure_content_filtering.tsp b/specification/cognitiveservices/OpenAI.Inference/models/completions/azure_content_filtering.tsp index ec4416042ad5..3a0f2c06aa79 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/completions/azure_content_filtering.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/completions/azure_content_filtering.tsp @@ -46,11 +46,9 @@ enum ContentFilterSeverity { @doc("Information about filtered content severity level and if it has been filtered or not.") model ContentFilterResult { @doc("Ratings for the intensity and risk level of filtered content.") - @projectedName("json", "severity") severity: ContentFilterSeverity; @doc("A value indicating whether or not the content has been filtered.") - @projectedName("json", "filtered") filtered: boolean; } @@ -82,7 +80,7 @@ alias ContentFilterResultsBase = { Describes language related to physical actions intended to purposely hurt, injure, or damage one’s body, or kill oneself. """) - @projectedName("json", "self_harm") + @encodedName("application/json", "self_harm") selfHarm?: ContentFilterResult; @added(ServiceApiVersions.v2023_12_01_Preview) @@ -90,7 +88,7 @@ alias ContentFilterResultsBase = { profanity?: ContentFilterDetectionResult; @added(ServiceApiVersions.v2023_12_01_Preview) - @projectedName("json", "custom_blocklists") + @encodedName("application/json", "custom_blocklists") @doc("Describes detection results against configured custom blocklists.") customBlocklists?: ContentFilterBlocklistIdResult[]; @@ -117,12 +115,12 @@ model ContentFilterResultsForChoice { ...ContentFilterResultsBase; @added(ServiceApiVersions.v2023_12_01_Preview) - @projectedName("json", "protected_material_text") + @encodedName("application/json", "protected_material_text") @doc("Information about detection of protected text material.") protectedMaterialText?: ContentFilterDetectionResult; @added(ServiceApiVersions.v2023_12_01_Preview) - @projectedName("json", "protected_material_code") + @encodedName("application/json", "protected_material_code") @doc("Information about detection of protected code material.") protectedMaterialCode?: ContentFilterCitedDetectionResult; } @@ -133,11 +131,11 @@ Content filtering results for a single prompt in the request. """) model ContentFilterResultsForPrompt { @doc("The index of this prompt in the set of prompt results") - @projectedName("json", "prompt_index") + @encodedName("application/json", "prompt_index") promptIndex: int32; @doc("Content filtering results for this prompt") - @projectedName("json", "content_filter_results") + @encodedName("application/json", "content_filter_results") contentFilterResults: ContentFilterResultDetailsForPrompt; } @@ -156,7 +154,7 @@ model ContentFilterDetectionResult { model ContentFilterCitedDetectionResult { ...ContentFilterDetectionResult; - @projectedName("json", "URL") + @encodedName("application/json", "URL") @doc("The internet location associated with the detection.") url?: url; diff --git a/specification/cognitiveservices/OpenAI.Inference/models/completions/chat_completions.tsp b/specification/cognitiveservices/OpenAI.Inference/models/completions/chat_completions.tsp index e1380c7171c6..2aa9f37b49ff 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/completions/chat_completions.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/completions/chat_completions.tsp @@ -58,7 +58,6 @@ model ChatCompletionsOptions { the behavior of the assistant, followed by alternating messages between the User and Assistant roles. """) - @projectedName("json", "messages") messages: ChatRequestMessage[]; @doc("A list of functions the model may generate JSON inputs for.") @@ -72,13 +71,13 @@ model ChatCompletionsOptions { Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. "none" is the default when no functions are present. "auto" is the default if functions are present. """) - @projectedName("json", "function_call") + @encodedName("application/json", "function_call") @added(ServiceApiVersions.v2023_07_01_Preview) @removed(ServiceApiVersions.v2023_12_01_Preview) functionCall?: FunctionCallConfig; @doc("The maximum number of tokens to generate.") - @projectedName("json", "max_tokens") + @encodedName("application/json", "max_tokens") maxTokens?: int32; @doc(""" @@ -88,7 +87,6 @@ model ChatCompletionsOptions { It is not recommended to modify temperature and top_p for the same completions request as the interaction of these two settings is difficult to predict. """) - @projectedName("json", "temperature") temperature?: float32; @doc(""" @@ -99,7 +97,7 @@ model ChatCompletionsOptions { It is not recommended to modify temperature and top_p for the same completions request as the interaction of these two settings is difficult to predict. """) - @projectedName("json", "top_p") + @encodedName("application/json", "top_p") @projectedName("csharp", "NucleusSamplingFactor") topP?: float32; @@ -110,7 +108,7 @@ model ChatCompletionsOptions { a full ban or exclusive selection of a token, respectively. The exact behavior of a given bias score varies by model. """) - @projectedName("json", "logit_bias") + @encodedName("application/json", "logit_bias") @projectedName("csharp", "TokenSelectionBiases") logitBias?: Record; @@ -118,7 +116,6 @@ model ChatCompletionsOptions { An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes. """) - @projectedName("json", "user") user?: string; @doc(""" @@ -127,14 +124,12 @@ model ChatCompletionsOptions { Because this setting can generate many completions, it may quickly consume your token quota. Use carefully and ensure reasonable settings for max_tokens and stop. """) - @projectedName("json", "n") @projectedName("csharp", "ChoiceCount") n?: int32; @doc(""" A collection of textual sequences that will end completions generation. """) - @projectedName("json", "stop") @projectedName("csharp", "StopSequences") stop?: string[]; @@ -144,7 +139,7 @@ model ChatCompletionsOptions { Positive values will make tokens less likely to appear when they already exist and increase the model's likelihood to output new topics. """) - @projectedName("json", "presence_penalty") + @encodedName("application/json", "presence_penalty") presencePenalty?: float32; @doc(""" @@ -153,13 +148,12 @@ model ChatCompletionsOptions { Positive values will make tokens less likely to appear as their frequency increases and decrease the likelihood of the model repeating the same statements verbatim. """) - @projectedName("json", "frequency_penalty") + @encodedName("application/json", "frequency_penalty") frequencyPenalty?: float32; @doc(""" A value indicating whether chat completions should be streamed for this request. """) - @projectedName("json", "stream") @projectedName("csharp", "InternalShouldStreamResponse") stream?: boolean; @@ -168,7 +162,6 @@ model ChatCompletionsOptions { Not applicable to Azure OpenAI, where deployment information should be included in the Azure resource URI that's connected to. """) - @projectedName("json", "model") @projectedName("csharp", "DeploymentName") `model`?: string; @@ -182,7 +175,6 @@ model ChatCompletionsOptions { // "extensions" instead of "data sources" for representing the additional configuration information. A future // service API version will absorb these proposed changes and allow us to retire the extra complexity. @added(ServiceApiVersions.v2023_08_01_Preview) - @projectedName("json", "dataSources") @projectedName("csharp", "InternalAzureExtensionsDataSources") dataSources?: AzureChatExtensionConfiguration[]; @@ -198,7 +190,7 @@ model ChatCompletionsOptions { """) seed?: int64; - @projectedName("json", "response_format") + @encodedName("application/json", "response_format") @added(ServiceApiVersions.v2023_12_01_Preview) @doc("An object specifying the format that the model must output. Used to enable JSON mode.") responseFormat?: ChatCompletionsResponseFormat; @@ -207,7 +199,7 @@ model ChatCompletionsOptions { @doc("The available tool definitions that the chat completions request can use, including caller-defined functions.") tools?: ChatCompletionsToolDefinition[]; - @projectedName("json", "tool_choice") + @encodedName("application/json", "tool_choice") @added(ServiceApiVersions.v2023_12_01_Preview) @doc(""" If specified, the model will configure which of the provided tools it can use for the chat completions response. @@ -223,17 +215,15 @@ Token limits and other settings may limit the number of choices generated. @added(ServiceApiVersions.v2023_05_15) model ChatChoice { @doc("The chat message for a given chat completions prompt.") - @projectedName("json", "message") message?: ChatResponseMessage; @doc("The ordered index associated with this chat completions choice.") - @projectedName("json", "index") index: int32; #suppress "@azure-tools/typespec-azure-core/no-nullable" "The operation already returns nulls" #suppress "@azure-tools/typespec-autorest/union-unsupported" "OpenAPI v2 support deferred" @doc("The reason that this chat completions choice completed its generated.") - @projectedName("json", "finish_reason") + @encodedName("application/json", "finish_reason") finishReason: CompletionsFinishReason | null; // Note: this property is currently speculative via observation and not yet documented anywhere. @@ -242,11 +232,10 @@ model ChatChoice { This structured representation replaces 'finish_reason' for some models. """) @added(ServiceApiVersions.v2023_12_01_Preview) - @projectedName("json", "finish_details") + @encodedName("application/json", "finish_details") finishDetails?: ChatFinishDetails; @doc("The delta message content for a streaming response.") - @projectedName("json", "delta") @projectedName("csharp", "InternalStreamingDeltaMessage") delta?: ChatResponseMessage; @@ -256,7 +245,7 @@ model ChatChoice { determines the intensity and risk level of harmful content) and if it has been filtered or not. """) @added(ServiceApiVersions.v2023_06_01_Preview) - @projectedName("json", "content_filter_results") + @encodedName("application/json", "content_filter_results") contentFilterResults?: ContentFilterResultsForChoice; @added(ServiceApiVersions.v2023_12_01_Preview) @@ -276,14 +265,12 @@ provided prompt data. @added(ServiceApiVersions.v2023_05_15) model ChatCompletions { @doc("A unique identifier associated with this chat completions response.") - @projectedName("json", "id") id: string; @doc(""" The first timestamp associated with generation activity for this completions response, represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970. """) - @projectedName("json", "created") @projectedName("java", "createdAt") @encode(DateTimeKnownEncoding.unixTimestamp, int32) created: utcDateTime; @@ -293,7 +280,6 @@ model ChatCompletions { Generally, `n` choices are generated per provided prompt with a default value of 1. Token limits and other settings may limit the number of choices generated. """) - @projectedName("json", "choices") choices: ChatChoice[]; @doc(""" @@ -301,11 +287,11 @@ model ChatCompletions { results for different prompts may arrive at different times or in different orders. """) @added(ServiceApiVersions.v2023_06_01_Preview) - @projectedName("json", "prompt_filter_results") + @encodedName("application/json", "prompt_filter_results") promptFilterResults?: ContentFilterResultsForPrompt[]; @added(ServiceApiVersions.v2023_12_01_Preview) - @projectedName("json", "system_fingerprint") + @encodedName("application/json", "system_fingerprint") @doc(""" Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. @@ -315,7 +301,6 @@ model ChatCompletions { @doc(""" Usage information for tokens processed and generated as part of this completions operation. """) - @projectedName("json", "usage") usage: CompletionsUsage; } diff --git a/specification/cognitiveservices/OpenAI.Inference/models/completions/chat_messages.tsp b/specification/cognitiveservices/OpenAI.Inference/models/completions/chat_messages.tsp index 261f8ef9f611..e07cad33c8db 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/completions/chat_messages.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/completions/chat_messages.tsp @@ -60,7 +60,7 @@ model ChatMessageImageContentItem extends ChatMessageContentItem { type: "image_url"; @doc("An internet location, which must be accessible to the model,from which the image may be retrieved.") - @projectedName("json", "image_url") + @encodedName("application/json", "image_url") imageUrl: ChatMessageImageUrl; } @@ -127,7 +127,7 @@ model ChatRequestAssistantMessage extends ChatRequestMessage { @doc("An optional name for the participant.") name?: string; - @projectedName("json", "tool_calls") + @encodedName("application/json", "tool_calls") @added(ServiceApiVersions.v2023_12_01_Preview) @doc(""" The tool calls that must be resolved and have their outputs appended to subsequent input messages for the chat @@ -137,7 +137,7 @@ model ChatRequestAssistantMessage extends ChatRequestMessage { @added(ServiceApiVersions.v2023_07_01_Preview) @removed(ServiceApiVersions.v2023_12_01_Preview) - @projectedName("json", "function_call") + @encodedName("application/json", "function_call") @doc(""" The function call that must be resolved and have its output appended to subsequent input messages for the chat completions request to resolve as configured. @@ -155,7 +155,7 @@ model ChatRequestToolMessage extends ChatRequestMessage { @doc("The content of the message.") content: string | null; - @projectedName("json", "tool_call_id") + @encodedName("application/json", "tool_call_id") @doc("The ID of the tool call resolved by the provided content.") toolCallId: string; } @@ -186,7 +186,7 @@ model ChatResponseMessage { content: string | null; @added(ServiceApiVersions.v2023_12_01_Preview) - @projectedName("json", "tool_calls") + @encodedName("application/json", "tool_calls") @doc(""" The tool calls that must be resolved and have their outputs appended to subsequent input messages for the chat completions request to resolve as configured. @@ -194,7 +194,7 @@ model ChatResponseMessage { toolCalls?: ChatCompletionsToolCall[]; @added(ServiceApiVersions.v2023_07_01_Preview) - @projectedName("json", "function_call") + @encodedName("application/json", "function_call") @doc(""" The function call that must be resolved and have its output appended to subsequent input messages for the chat completions request to resolve as configured. diff --git a/specification/cognitiveservices/OpenAI.Inference/models/completions/common.tsp b/specification/cognitiveservices/OpenAI.Inference/models/completions/common.tsp index 3c5b697aef47..b510324ec244 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/completions/common.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/completions/common.tsp @@ -12,15 +12,15 @@ other consumers. """) model CompletionsUsage { @doc("The number of tokens generated across all completions emissions.") - @projectedName("json", "completion_tokens") + @encodedName("application/json", "completion_tokens") completionTokens: int32; @doc("The number of tokens in the provided prompts for the completions request.") - @projectedName("json", "prompt_tokens") + @encodedName("application/json", "prompt_tokens") promptTokens: int32; @doc("The total number of tokens processed for the completions request and response.") - @projectedName("json", "total_tokens") + @encodedName("application/json", "total_tokens") totalTokens: int32; } diff --git a/specification/cognitiveservices/OpenAI.Inference/models/completions/completions_create.tsp b/specification/cognitiveservices/OpenAI.Inference/models/completions/completions_create.tsp index 12d789dce2fa..4d8cd96cd0d7 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/completions/completions_create.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/completions/completions_create.tsp @@ -18,12 +18,11 @@ provided prompt data. """) model CompletionsOptions { @doc("The prompts to generate completions from.") - @projectedName("json", "prompt") @projectedName("csharp", "Prompts") prompt: string[]; @doc("The maximum number of tokens to generate.") - @projectedName("json", "max_tokens") + @encodedName("application/json", "max_tokens") maxTokens?: int32; @doc(""" @@ -33,7 +32,6 @@ model CompletionsOptions { It is not recommended to modify temperature and top_p for the same completions request as the interaction of these two settings is difficult to predict. """) - @projectedName("json", "temperature") temperature?: float32; @doc(""" @@ -44,7 +42,7 @@ model CompletionsOptions { It is not recommended to modify temperature and top_p for the same completions request as the interaction of these two settings is difficult to predict. """) - @projectedName("json", "top_p") + @encodedName("application/json", "top_p") @projectedName("csharp", "NucleusSamplingFactor") topP?: float32; @@ -55,7 +53,7 @@ model CompletionsOptions { a full ban or exclusive selection of a token, respectively. The exact behavior of a given bias score varies by model. """) - @projectedName("json", "logit_bias") + @encodedName("application/json", "logit_bias") @projectedName("csharp", "TokenSelectionBiases") logitBias?: Record; @@ -63,7 +61,6 @@ model CompletionsOptions { An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes. """) - @projectedName("json", "user") user?: string; @doc(""" @@ -72,7 +69,6 @@ model CompletionsOptions { Because this setting can generate many completions, it may quickly consume your token quota. Use carefully and ensure reasonable settings for max_tokens and stop. """) - @projectedName("json", "n") @projectedName("csharp", "ChoicesPerPrompt") n?: int32; @@ -80,7 +76,6 @@ model CompletionsOptions { A value that controls the emission of log probabilities for the provided number of most likely tokens within a completions response. """) - @projectedName("json", "logprobs") @projectedName("csharp", "LogProbabilityCount") logprobs?: int32; @@ -88,13 +83,11 @@ model CompletionsOptions { A value specifying whether completions responses should include input prompts as prefixes to their generated output. """) - @projectedName("json", "echo") echo?: boolean; @doc(""" A collection of textual sequences that will end completions generation. """) - @projectedName("json", "stop") @projectedName("csharp", "StopSequences") stop?: string[]; @@ -104,7 +97,7 @@ model CompletionsOptions { Positive values will make tokens less likely to appear when they already exist and increase the model's likelihood to output new topics. """) - @projectedName("json", "presence_penalty") + @encodedName("application/json", "presence_penalty") presencePenalty?: float32; @doc(""" @@ -113,7 +106,7 @@ model CompletionsOptions { Positive values will make tokens less likely to appear as their frequency increases and decrease the likelihood of the model repeating the same statements verbatim. """) - @projectedName("json", "frequency_penalty") + @encodedName("application/json", "frequency_penalty") frequencyPenalty?: float32; @doc(""" @@ -124,14 +117,13 @@ model CompletionsOptions { Because this setting can generate many completions, it may quickly consume your token quota. Use carefully and ensure reasonable settings for max_tokens and stop. """) - @projectedName("json", "best_of") + @encodedName("application/json", "best_of") @projectedName("csharp", "GenerationSampleCount") bestOf?: int32; @doc(""" A value indicating whether chat completions should be streamed for this request. """) - @projectedName("json", "stream") @projectedName("csharp", "InternalShouldStreamResponse") stream?: boolean; @@ -140,7 +132,6 @@ model CompletionsOptions { Not applicable to Azure OpenAI, where deployment information should be included in the Azure resource URI that's connected to. """) - @projectedName("json", "model") @projectedName("csharp", "DeploymentName") `model`?: string; } @@ -152,14 +143,12 @@ provided prompt data. """) model Completions { @doc("A unique identifier associated with this completions response.") - @projectedName("json", "id") id: string; @doc(""" The first timestamp associated with generation activity for this completions response, represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970. """) - @projectedName("json", "created") @projectedName("java", "createdAt") @encode(DateTimeKnownEncoding.unixTimestamp, int32) created: utcDateTime; @@ -169,7 +158,7 @@ model Completions { results for different prompts may arrive at different times or in different orders. """) @added(ServiceApiVersions.v2023_06_01_Preview) - @projectedName("json", "prompt_filter_results") + @encodedName("application/json", "prompt_filter_results") promptFilterResults?: ContentFilterResultsForPrompt[]; @doc(""" @@ -177,13 +166,11 @@ model Completions { Generally, `n` choices are generated per provided prompt with a default value of 1. Token limits and other settings may limit the number of choices generated. """) - @projectedName("json", "choices") choices: Choice[]; @doc(""" Usage information for tokens processed and generated as part of this completions operation. """) - @projectedName("json", "usage") usage: CompletionsUsage; } @@ -194,11 +181,9 @@ Token limits and other settings may limit the number of choices generated. """) model Choice { @doc("The generated text for a given completions prompt.") - @projectedName("json", "text") text: string; @doc("The ordered index associated with this completions choice.") - @projectedName("json", "index") index: int32; @doc(""" @@ -207,19 +192,18 @@ model Choice { determines the intensity and risk level of harmful content) and if it has been filtered or not. """) @added(ServiceApiVersions.v2023_06_01_Preview) - @projectedName("json", "content_filter_results") + @encodedName("application/json", "content_filter_results") contentFilterResults?: ContentFilterResultsForChoice; #suppress "@azure-tools/typespec-azure-core/no-nullable" "The operation already returns nulls" @doc("The log probabilities model for tokens associated with this completions choice.") - @projectedName("json", "logprobs") @projectedName("csharp", "LogProbabilityModel") logprobs: CompletionsLogProbabilityModel | null; #suppress "@azure-tools/typespec-azure-core/no-nullable" "The operation already returns nulls" #suppress "@azure-tools/typespec-autorest/union-unsupported" "OpenAPI v2 support deferred" @doc("Reason for finishing") - @projectedName("json", "finish_reason") + @encodedName("application/json", "finish_reason") finishReason: CompletionsFinishReason | null; } @@ -230,23 +214,22 @@ Representation of a log probabilities model for a completions generation. """) model CompletionsLogProbabilityModel { @doc("The textual forms of tokens evaluated in this probability model.") - @projectedName("json", "tokens") tokens: string[]; @doc("A collection of log probability values for the tokens in this completions data.") - @projectedName("json", "token_logprobs") + @encodedName("application/json", "token_logprobs") @projectedName("csharp", "TokenLogProbabilities") @projectedName("java", "tokenLogProbabilities") tokenLogprobs: NullableFloat[]; @doc("A mapping of tokens to maximum log probability values in this completions data.") - @projectedName("json", "top_logprobs") + @encodedName("application/json", "top_logprobs") @projectedName("csharp", "TopLogProbabilities") @projectedName("java", "topLogProbabilities") topLogprobs: Record[]; @doc("The text offsets associated with tokens in this completions data.") - @projectedName("json", "text_offset") + @encodedName("application/json", "text_offset") @projectedName("csharp", "TextOffsets") @projectedName("java", "textOffsets") textOffset: int32[]; diff --git a/specification/cognitiveservices/OpenAI.Inference/models/embeddings_create.tsp b/specification/cognitiveservices/OpenAI.Inference/models/embeddings_create.tsp index 59f6bc7c6d84..92a39c23bb70 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/embeddings_create.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/embeddings_create.tsp @@ -16,7 +16,6 @@ model EmbeddingsOptions { An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes. """) - @projectedName("json", "user") user?: string; @doc(""" @@ -24,7 +23,6 @@ model EmbeddingsOptions { Not applicable to Azure OpenAI, where deployment information should be included in the Azure resource URI that's connected to. """) - @projectedName("json", "model") @projectedName("csharp", "DeploymentName") `model`?: string; @@ -67,10 +65,10 @@ model EmbeddingItem { @doc("Measurement of the amount of tokens used in this request and response.") model EmbeddingsUsage { @doc("Number of tokens sent in the original request.") - @projectedName("json", "prompt_tokens") + @encodedName("application/json", "prompt_tokens") promptTokens: int32; @doc("Total number of tokens transacted in this request/response.") - @projectedName("json", "total_tokens") + @encodedName("application/json", "total_tokens") totalTokens: int32; } diff --git a/specification/cognitiveservices/OpenAI.Inference/models/images/images.tsp b/specification/cognitiveservices/OpenAI.Inference/models/images/images.tsp index a80a53300efd..200c97d3ee7f 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/images/images.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/images/images.tsp @@ -120,7 +120,7 @@ model ImageGenerationOptions { size?: ImageSize = ImageSize.size1024x1024; @doc("The format in which image generation response items should be presented.") - @projectedName("json", "response_format") + @encodedName("application/json", "response_format") responseFormat?: ImageGenerationResponseFormat = ImageGenerationResponseFormat.url; @doc(""" @@ -151,7 +151,7 @@ model ImageGenerationData { url?: url; @doc("The complete data for an image, represented as a base64-encoded string.") - @projectedName("json", "b64_json") + @encodedName("application/json", "b64_json") base64Data?: string; @doc(""" @@ -159,7 +159,7 @@ model ImageGenerationData { Only provided with dall-3-models and only when revisions were made to the prompt. """) @added(ServiceApiVersions.v2023_12_01_Preview) - @projectedName("json", "revised_prompt") + @encodedName("application/json", "revised_prompt") revisedPrompt?: string; } @@ -170,7 +170,6 @@ model ImageGenerations { A timestamp representing when this operation was started. Expressed in seconds since the Unix epoch of 1970-01-01T00:00:00+0000. """) - @projectedName("json", "created") @projectedName("java", "createdAt") @encode(DateTimeKnownEncoding.unixTimestamp, int32) created: utcDateTime; @@ -197,7 +196,6 @@ model BatchImageGenerationOperationResponse { id: string; @doc("A timestamp when this job or item was created (in unix epochs).") - @projectedName("json", "created") @projectedName("java", "createdAt") @encode(DateTimeKnownEncoding.unixTimestamp, int32) created: utcDateTime; diff --git a/specification/loadtestservice/LoadTestService/models.tsp b/specification/loadtestservice/LoadTestService/models.tsp index 519a40e3acca..6845712c4e92 100644 --- a/specification/loadtestservice/LoadTestService/models.tsp +++ b/specification/loadtestservice/LoadTestService/models.tsp @@ -830,7 +830,7 @@ model DimensionFilter { @doc("The response to a metrics query.") @friendlyName("Metrics") -// using friendlyName to change the name of the model due to issue in using projectedName '@projectedName("json", "Metrics")' https://github.com/microsoft/typespec/issues/2276 +// using friendlyName to change the name of the model due to issue in using projectedName '@encodedName("application/json", "Metrics")' https://github.com/microsoft/typespec/issues/2276 model Metrics is Azure.Core.Page; @doc("The time series returned when a data query is performed.")