Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some clean up in OpenAIClientBase #788

Merged
merged 4 commits into from
May 4, 2023

Commits on May 3, 2023

  1. Some clean up in OpenAIClientBase

    - The type accepts an HttpClient instance that it'll use.  It shouldn't then mutate that instance, as it might be shared with other consumers.  But it's adding to its DefaultRequestHeaders collection, which will impact all other users of that instance (DefaultRequestHeaders also isn't thread-safe and should only ever be added to while it's not being used for issuing requests).  I've removed the interaction with DefaultRequestHeaders and instead added the relevant headers to each message being sent.
    - The base is exposing a lot of protected surface area, but it's not actually extensible outside of the assembly.  I've changed all of its internal and protected members to instead be "private protected" or just "private", reflecting their actual usage and ensuring the surface area doesn't show up in public documentation (which protected members would).
    - As it's not actually extensible publicly, and as no derived types are finalizable, it needn't implement the full IDisposable pattern nor use GC.SuppressFinalize.
    - Both the base and the derived image generation client had duplicated APIs for url vs base64 image generation.  I've consolidated that via arguments to just have one copy of the code. Note that the base64 image generation was private and unused, so I've deleted that unused member, but the functionality can be exposed easily if desired based on the shared routines now in place.
    - Removed some unnecessary null checking for things that'll never be null.
    - Ensured the HttpClient response message is disposed.
    stephentoub committed May 3, 2023
    Configuration menu
    Copy the full SHA
    3e39ce3 View commit details
    Browse the repository at this point in the history

Commits on May 4, 2023

  1. Configuration menu
    Copy the full SHA
    e3f5eca View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7ccdc46 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d85b83a View commit details
    Browse the repository at this point in the history