Skip to content

Package developer notes

Richard Park edited this page Sep 19, 2024 · 7 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, using the TypeSpec, emitted into an Swagger file, which we then generate from 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 way of handling this so the pattern that I have in OpenAI looks like this:

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

Clone this wiki locally