Skip to content

Chschrae/lro merge from main#12

Merged
annelo-msft merged 35 commits intoannelo-msft:oai-polling-lrofrom
chschrae:chschrae/LROMergeFromMain
Sep 10, 2024
Merged

Chschrae/lro merge from main#12
annelo-msft merged 35 commits intoannelo-msft:oai-polling-lrofrom
chschrae:chschrae/LROMergeFromMain

Conversation

@chschrae
Copy link
Copy Markdown

No description provided.

joseharriaga and others added 30 commits August 14, 2024 14:13
* Export API with model factory changes

* Amend CHANGELOG
…r (#201)

- Removed client constructors that do not explicitly take an API key parameter or an endpoint via an `OpenAIClientOptions` parameter, making it clearer how to appropriately instantiate a client.
- Removed the endpoint parameter from all client constructors, making it clearer that an alternative endpoint must be specified via the `OpenAIClientOptions` parameter.
- Removed `OpenAIClient`'s `Endpoint` `protected` property. 
- Made `OpenAIClient`'s constructor that takes a `ClientPipeline` parameter `protected internal` instead of just `protected`.
…#202)

Renamed the `User` property in applicable Options classes to `EndUserId`, making its purpose clearer.
… (#214)

* minimal public api with full spec update

* refusal rename, remove init

* refusal tests

* add missing refusal parameter to factory

* response format update

* updates

* greatly expanded tool test

* minor changelog updates

* PR feedback

* content part updates to address refusal and future-proof

* minor changelog update

* superficial refactor

* minor: api updated (protected only)

* pr feedback including null content fix
Renamed `AudioClient`'s `GenerateSpeechFromText` methods to simply `GenerateSpeech`.
…rties (#208)

Use `AssertNotFrozen()` in the setters of `OpenAIClientOptions` properties to help users understand that setting these properties after the client has been instantiated has no effect on it.
* add roger's fix and a test for options bug

* changelog
…ion pattern (#197)

Move service methods for paginated endpoints to use SCM based pagination pattern
…#222)

* reflect 2.0.0-beta.10

* fix changelog

* touchup changelog
Co-authored-by: ShivangiReja <shivangi.reja@microsoft.com>
…s namespace (#229)

Add Experimental attribute to all public APIs in the OpenAI.Assistants namespace
…res namespace (#231)

Add Experimental attribute to all public APIs in the OpenAI.VectorStores namespace
…mespaces (#233)

* Add Experimental attribute
…le_search) (#236)

Changes were made via the ingestion tool.
- The application of the `x-oaiTypeLabel = map` attribute now results in otherwise unspecified types being `Record<unknown>` instead of `Record<object>`.
- `metadata`, a known `Record<string>` and the reason why the rule was the way it was, is special-cased with a straightforward, pattern-checked replacement
- Repro test case included for before/after with `file_search`
…#238)

This is the same issue that we saw previously with `ChatMessage`'s serialization in unity/mono/etc.

See: dotnet/runtime#103365

See: joseharriaga#138
- Refactors the code to bring the directory structure in sync with what we have in the Azure repo
- Updates the Azure OpenAI code with all changes from the Azure repo
- Brings over the Azure OpenAI test suite to allow for full testing in this repo (including support for recording/playback of requests)
- Fixes a regression introduced with the latest FineTuningClient pagination changes

Co-authored-by: Travis Wilson <travisw@microsoft.com>
* Renamed `ChatMessageContentPart`'s `CreateTextMessageContentPart` factory method to `CreateTextPart`.
* Renamed `ChatMessageContentPart`'s `CreateImageMessageContentPart` factory method to `CreateImagePart`.
* Renamed `ChatMessageContentPart`'s `CreateRefusalMessageContentPart` factory method to `CreateRefusalPart`.
* Renamed `ImageChatMessageContentPartDetail` to `ChatImageDetailLevel`.
* Removed `ChatMessageContentPart`'s `ToString` overload. It does not receive a lot of usage, and it can also return `null` against the `ToString` guidelines.
* Added better doc comments.
joseharriaga and others added 5 commits September 4, 2024 17:45
The `OpenAI.Chat` namespace has several cases of unions (both discriminated and non-discriminated). To represent them in C#, we use one of three possible solutions based on the specific characteristics of each case.

1️⃣ `ChatResponseFormat`:
- **Characteristics**: 
  - Discriminated union of objects with a "type" property. Currently three possible types: "text", "json_object", or "json_schema. 
  - Used only as input.
- 🔵 **Solution # 1**: 
  - Because this is input-only, we only expose factory methods. 
  - The factory methods return `ChatResponseFormat`.

2️⃣ `ChatToolChoice`:
- **Characteristics**: 
  - Non-discriminated union of enum values ("auto" | "none" | "required") and an object. 
  - Used only as input.
- 🔵 **Solution # 1**: 
  - Because this is input-only, we only expose factory methods. 
  - The factory methods return `ChatToolChoice`.

3️⃣ `ChatTool`:
- **Characteristics**: 
  - Discriminated union of objects with a "type" property. Currently one possible type only: "function". 
  - Used as both input and output.
- 🟢 **Solution # 2**: 
  - Because this is also an output, we need more than just factory methods.
  - Since there is only one possible type at the moment, we would rather avoid having a whole class hierarchy. Instead, we spread the properties of what would have been the derived type into `ChatTool`. 
  - Additionally, we publicly expose the `Kind` property (a.k.a. the "type" property). 
  - The factory methods return `ChatTool`.

4️⃣ `ChatToolCall`:
- **Characteristics**: 
  - Discriminated union of objects with a "type" property. Currently one possible type only: "function". 
  - Used as both input and output.
- 🟢 **Solution # 2**: 
  - Because this is also an output, we need more than just factory methods.
  - Since there is only one possible type at the moment, we would rather avoid having a whole class hierarchy. Instead, we spread the properties of what would have been the derived type into `ChatToolCall`. 
  - Additionally, we publicly expose the `Kind` property (a.k.a. the "type" property). 
  - The factory methods return `ChatToolCall`.

5️⃣ `ChatMessageContentPart`:
- **Characteristics**: 
  - Discriminated union of objects with a "type" property. Currently three possible types: "text", "image_url", and "refusal". 
  - Used as both input and output.
- 🟢 **Solution # 2**: 
  - Because this is also an output, we need more than just factory methods. 
  - Since the three possible types are relatively lightweight, we would rather avoid having a whole class hierarchy. Instead, we spread the properties of what would have been the derived types into `ChatMessageContentPart`. 
  - Additionally, we publicly expose the `Kind` property (a.k.a. the "type" property). 
  - The factory methods return `ChatMessageContentPart`.

6️⃣ `ChatMessage`:
- **Characteristics**: 
  - Discriminated union of objects with a "role" property. Currently five possible roles: "system", "user", "assistant", "tool", and "function". 
  - Used as both input and output.
- 🔴 **Solution # 3**: 
  - Because this is also an output, we need more than just factory methods. 
  - Because dealing with five different possible types is complex, we think that having an actual class hierarchy is appropriate in this case. As such, we end up with five concrete types: `SystemChatMessage`, `UserChatMessage`, `AssistantChatMessage`, `ToolChatMessage`, and `FunctionChatMessage`. 
  - The `Role` property is not public. 
  - The factory methods return the concrete types instead of returning the abstract `ChatMessage`.
- By default, automatic recording will be disabled if running in CI/CD (supports GitHub workflows and Azure DevOps detection right now)
- Allows you to customize when autoamtic recording is disabled globally, at the test suite level, or for individual tests
… enums in their corresponding sub-namespaces (#234)

* Removed the common `ListOrder` enum from the top-level `OpenAI` namespace in favor of individual enums in their corresponding sub-namespace.
* Renamed the `PageSize` property to `PageSizeLimit` to hint at the fact that this equates to the REST API's `limit` property.
* Polished a few doc comments.
@annelo-msft annelo-msft merged commit c4fa5ab into annelo-msft:oai-polling-lro Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants