Releases: tryAGI/OpenAI
v3.6.1
What's Changed
-
feat:Minor formatting adjustments in JsonSerializerContext.g.cs for readability by @HavenDV in #68
-
feat:Add file search classes, enums, and OpenAPI enhancements in OpenAI namespace by @HavenDV in #70
-
feat:Update OpenAPI specification to rename query parameter
includetoinclude[]by @HavenDV in #71 -
feat:Add Initialized method for HttpClient customization in client classes by @HavenDV in #72
-
feat:Introduce UnixTimestampJsonConverter for DateTimeOffset handling by @HavenDV in #73
-
feat:Add default parameter values and update JSON serialization in client methods by @HavenDV in #74
-
fix: Added Assistants.CreateRunAsStream. Fixed AssistantsWithVision.
-
feat: Added AsUserMessage(this byte[] bytes, string mimeType) extension to easy use vision.
-
feat: Added Image.Bytes auto-property to get Base64 json as byte array.
Full Changelog: v3.5.1...v3.6.1
v3.5.1
Full Changelog: v3.5.0...v3.5.1
v3.5.0
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 objectWeather:
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
Full Changelog: v3.4.0...v3.4.1