Skip to content

Releases: tryAGI/OpenAI

v3.8.0

26 Sep 02:55
Compare
Choose a tag to compare

What's Changed

Full Changelog: v3.7.0...v3.8.0

v3.7.0

14 Sep 04:29
Compare
Choose a tag to compare

What's Changed

Full Changelog: v3.6.3...v3.7.0

v3.6.3

02 Sep 01:14
Compare
Choose a tag to compare

v3.6.2

01 Sep 22:11
Compare
Choose a tag to compare

v3.6.1

01 Sep 16:56
Compare
Choose a tag to compare

What's Changed

Full Changelog: v3.5.1...v3.6.1

v3.5.1

18 Aug 14:51
Compare
Choose a tag to compare

Full Changelog: v3.5.0...v3.5.1

v3.5.0

17 Aug 17:15
Compare
Choose a tag to compare

Added Structured Outputs support.

using OpenAI;

using var api = new OpenAiApi("API_KEY");

var response = await api.Chat.CreateChatCompletionAsAsync<Weather>(
    messages: ["Generate random weather."],
    model: CreateChatCompletionRequestModel.Gpt4oMini,
    jsonSerializerOptions: new JsonSerializerOptions
    {
        Converters = {new JsonStringEnumConverter()},
    });
// or (if you need trimmable/NativeAOT version)
var response = await api.Chat.CreateChatCompletionAsAsync(
    jsonTypeInfo: SourceGeneratedContext.Default.Weather,
    messages: ["Generate random weather."],
    model: CreateChatCompletionRequestModel.Gpt4oMini);

// response.Value1 contains the structured output
// response.Value2 contains the CreateChatCompletionResponse object
Weather:
Location: San Francisco, CA
Temperature: 65
Unit: Fahrenheit
Description: Partly cloudy with a light breeze and occasional sunshine.
Raw Response:
{"Location":"San Francisco, CA","Temperature":65,"Unit":"Fahrenheit","Description":"Partly cloudy with a light breeze and occasional sunshine."}

Additional code for trimmable/NativeAOT version:

[JsonSourceGenerationOptions(Converters = [typeof(JsonStringEnumConverter<Unit>)])]
[JsonSerializable(typeof(Weather))]
public partial class SourceGeneratedContext : JsonSerializerContext;

Full Changelog: v3.4.1...v3.5.0

v3.4.1

16 Aug 13:40
Compare
Choose a tag to compare

Full Changelog: v3.4.0...v3.4.1