-
Notifications
You must be signed in to change notification settings - Fork 954
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, using the TypeSpec, emitted into an Swagger file, which we then generate from 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 way of handling this so the pattern that I have in OpenAI looks like this:
- Create a custom type
- Create construction functions for each of the types in the union.