Azure / Azure/azure-rest-api-specs

Azure OpenAI: TypeSpec definitions have inconsistent representation of service-side default values

Open
#25,820 0 comments 0 reactions 0 assignees View on GitHub
OpenAI Service Attention
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
2d 22h
Merged PRs (30d)
444

Description

Azure OpenAI has a substantial number of "service-side default" options value assignments (explicitly: where there's a documented default behavior "as if" a client-specified value were provided even when no actual client value is present). We currently represent a subset of these in the .tsp files with most not represented.

E.g. image generation encodes its default of `1024x1024` for `size`:
https://github.com/Azure/azure-rest-api-specs/blob/b566117de9ae54c33abdf8a6cd150645a8ede028/specification/cognitiveservices/OpenAI.Inference/models/images.tsp#L46

Meanwhile, variables like `temperature`, which have documented service-side defaults (in this case, for chat completions, of `1`) do not specify any default value:
https://github.com/Azure/azure-rest-api-specs/blob/b566117de9ae54c33abdf8a6cd150645a8ede028/specification/cognitiveservices/OpenAI.Inference/models/chat.completions.tsp#L110

This is inconsistent and incorrect. It should be all one or the other.

Thus, we need to:

1. Confirm the correct approach for representing these service-side defaults (with no client-side requirement) in TypeSpec
2. Update *all* parameters with service-side defaults to use the correct pattern
3. Ensure updated, generated code behaves as intended (e.g. by not forcing a client-side value when none is provided)

Contributor guide

Open the contributing guide

Research direction

Start by comparing specification/cognitiveservices/OpenAI.Inference/models/images.tsp and chat.completions.tsp, then confirm the TypeSpec pattern for service-side defaults that do not require client input. Identify all Azure OpenAI parameters with documented defaults, update their representations consistently, and verify generated code does not require omitted values.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
api, backend-api-design, cloud
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.