-
Notifications
You must be signed in to change notification settings - Fork 847
Package developer notes
The documentation is about implementation details and isn't considered customer facing or binding - implementation can change at any time, provided it maintains compatibility with our published interfaces.
These clients are both generated. We compile the TypeSpec locally (see build.go
for the exact commands), which is emitted into a Swagger file, which read using autorest.
The TypeSpec source for these clients is here:
- OpenAI (inference): https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cognitiveservices/OpenAI.Inference
- OpenAI (assistants): https://github.com/Azure/azure-rest-api-specs/tree/main/specification/ai/OpenAI.Assistants
Regenerating
The basics, assuming everything is working correctly, are just:
- Update testdata/tsp-location.yaml to point to the proper Git commit for the TypeSpec.
- Run
go generate
There are some caveats that you'll need to manually write code for:
-
Union types typically don't generate properly. In TypeSpec, if you see things like this:
union ChatMessageContent { string, @added(ServiceApiVersions.v2024_02_15_Preview) ChatMessageContentItem[], }
Note, this is different than a standard polymorphic type, where you'll see an 'extends' relationship. For these types the 'leaf types' (like
ChatMessageContentItem
) will generate, but the envelope/union type (ChatMessageContent
) will not generate. There are two ways to handle this:At this time, we don't have a standard Azure SDK way of handling this pattern. In the azopenai packages we've gone with this:
- Create a custom type
- Create construction functions for each of the types in the union.