Skip to content

Package developer notes

Richard Park edited this page Sep 19, 2024 · 6 revisions

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.

azopenai/azopenaiassistants

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:

Regenerating

The basics, assuming everything is working correctly, are just:

  1. Update testdata/tsp-location.yaml to point to the proper Git commit for the TypeSpec.
  2. 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:

    1. Create a custom type
    2. Create construction functions for each of the types in the union.