Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public class ChatCompletionUserMessageContentJsonConverter : global::System.Text
if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; }
if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; }

string? value1 = default;
global::System.Collections.Generic.IList<global::Together.OneOf<global::Together.ChatCompletionUserMessageContentMultimodalItemVariant1, global::Together.ChatCompletionUserMessageContentMultimodalItemVariant2, global::Together.ChatCompletionUserMessageContentMultimodalItemVideo, global::Together.ChatCompletionUserMessageContentMultimodalItemAudio, global::Together.ChatCompletionUserMessageContentMultimodalItemInputAudio>>? value2 = default;
string? @string = default;
global::System.Collections.Generic.IList<global::Together.OneOf<global::Together.ChatCompletionUserMessageContentMultimodalItemVariant1, global::Together.ChatCompletionUserMessageContentMultimodalItemVariant2, global::Together.ChatCompletionUserMessageContentMultimodalItemVideo, global::Together.ChatCompletionUserMessageContentMultimodalItemAudio, global::Together.ChatCompletionUserMessageContentMultimodalItemInputAudio>>? multimodal = default;
if (__bestIndex >= 0)
{
if (__bestIndex == 0)
Expand All @@ -65,7 +65,7 @@ public class ChatCompletionUserMessageContentJsonConverter : global::System.Text

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<string> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}");
value1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
@string = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -82,7 +82,7 @@ public class ChatCompletionUserMessageContentJsonConverter : global::System.Text

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::System.Collections.Generic.IList<global::Together.OneOf<global::Together.ChatCompletionUserMessageContentMultimodalItemVariant1, global::Together.ChatCompletionUserMessageContentMultimodalItemVariant2, global::Together.ChatCompletionUserMessageContentMultimodalItemVideo, global::Together.ChatCompletionUserMessageContentMultimodalItemAudio, global::Together.ChatCompletionUserMessageContentMultimodalItemInputAudio>>), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.IList<global::Together.OneOf<global::Together.ChatCompletionUserMessageContentMultimodalItemVariant1, global::Together.ChatCompletionUserMessageContentMultimodalItemVariant2, global::Together.ChatCompletionUserMessageContentMultimodalItemVideo, global::Together.ChatCompletionUserMessageContentMultimodalItemAudio, global::Together.ChatCompletionUserMessageContentMultimodalItemInputAudio>>> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::System.Collections.Generic.IList<global::Together.OneOf<global::Together.ChatCompletionUserMessageContentMultimodalItemVariant1, global::Together.ChatCompletionUserMessageContentMultimodalItemVariant2, global::Together.ChatCompletionUserMessageContentMultimodalItemVideo, global::Together.ChatCompletionUserMessageContentMultimodalItemAudio, global::Together.ChatCompletionUserMessageContentMultimodalItemInputAudio>>).Name}");
value2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
multimodal = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -93,14 +93,14 @@ public class ChatCompletionUserMessageContentJsonConverter : global::System.Text
}
}

if (value1 == null && value2 == null)
if (@string == null && multimodal == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<string> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}");
value1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
@string = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -114,7 +114,7 @@ public class ChatCompletionUserMessageContentJsonConverter : global::System.Text

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::System.Collections.Generic.IList<global::Together.OneOf<global::Together.ChatCompletionUserMessageContentMultimodalItemVariant1, global::Together.ChatCompletionUserMessageContentMultimodalItemVariant2, global::Together.ChatCompletionUserMessageContentMultimodalItemVideo, global::Together.ChatCompletionUserMessageContentMultimodalItemAudio, global::Together.ChatCompletionUserMessageContentMultimodalItemInputAudio>>), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.IList<global::Together.OneOf<global::Together.ChatCompletionUserMessageContentMultimodalItemVariant1, global::Together.ChatCompletionUserMessageContentMultimodalItemVariant2, global::Together.ChatCompletionUserMessageContentMultimodalItemVideo, global::Together.ChatCompletionUserMessageContentMultimodalItemAudio, global::Together.ChatCompletionUserMessageContentMultimodalItemInputAudio>>> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::System.Collections.Generic.IList<global::Together.OneOf<global::Together.ChatCompletionUserMessageContentMultimodalItemVariant1, global::Together.ChatCompletionUserMessageContentMultimodalItemVariant2, global::Together.ChatCompletionUserMessageContentMultimodalItemVideo, global::Together.ChatCompletionUserMessageContentMultimodalItemAudio, global::Together.ChatCompletionUserMessageContentMultimodalItemInputAudio>>).Name}");
value2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
multimodal = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -125,9 +125,9 @@ public class ChatCompletionUserMessageContentJsonConverter : global::System.Text
}

var __value = new global::Together.ChatCompletionUserMessageContent(
value1,
@string,

value2
multimodal
);

return __value;
Expand All @@ -142,17 +142,17 @@ public override void Write(
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set.");

if (value.IsValue1)
if (value.IsString)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<string?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.String!, typeInfo);
}
else if (value.IsValue2)
else if (value.IsMultimodal)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::System.Collections.Generic.IList<global::Together.OneOf<global::Together.ChatCompletionUserMessageContentMultimodalItemVariant1, global::Together.ChatCompletionUserMessageContentMultimodalItemVariant2, global::Together.ChatCompletionUserMessageContentMultimodalItemVideo, global::Together.ChatCompletionUserMessageContentMultimodalItemAudio, global::Together.ChatCompletionUserMessageContentMultimodalItemInputAudio>>), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.IList<global::Together.OneOf<global::Together.ChatCompletionUserMessageContentMultimodalItemVariant1, global::Together.ChatCompletionUserMessageContentMultimodalItemVariant2, global::Together.ChatCompletionUserMessageContentMultimodalItemVideo, global::Together.ChatCompletionUserMessageContentMultimodalItemAudio, global::Together.ChatCompletionUserMessageContentMultimodalItemInputAudio>>?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::System.Collections.Generic.IList<global::Together.OneOf<global::Together.ChatCompletionUserMessageContentMultimodalItemVariant1, global::Together.ChatCompletionUserMessageContentMultimodalItemVariant2, global::Together.ChatCompletionUserMessageContentMultimodalItemVideo, global::Together.ChatCompletionUserMessageContentMultimodalItemAudio, global::Together.ChatCompletionUserMessageContentMultimodalItemInputAudio>>).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Multimodal!, typeInfo);
}
}
}
Expand Down
26 changes: 13 additions & 13 deletions src/libs/Together/Generated/Together.JsonConverters.Error.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public class ErrorJsonConverter : global::System.Text.Json.Serialization.JsonCon
if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; }
if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; }

string? value1 = default;
object? value2 = default;
string? errorVariant1 = default;
object? errorVariant2 = default;
if (__bestIndex >= 0)
{
if (__bestIndex == 0)
Expand All @@ -65,7 +65,7 @@ public class ErrorJsonConverter : global::System.Text.Json.Serialization.JsonCon

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<string> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}");
value1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
errorVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -82,7 +82,7 @@ public class ErrorJsonConverter : global::System.Text.Json.Serialization.JsonCon

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<object> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}");
value2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
errorVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -93,14 +93,14 @@ public class ErrorJsonConverter : global::System.Text.Json.Serialization.JsonCon
}
}

if (value1 == null && value2 == null)
if (errorVariant1 == null && errorVariant2 == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<string> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}");
value1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
errorVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -114,7 +114,7 @@ public class ErrorJsonConverter : global::System.Text.Json.Serialization.JsonCon

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<object> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}");
value2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
errorVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -125,9 +125,9 @@ public class ErrorJsonConverter : global::System.Text.Json.Serialization.JsonCon
}

var __value = new global::Together.Error(
value1,
errorVariant1,

value2
errorVariant2
);

return __value;
Expand All @@ -142,17 +142,17 @@ public override void Write(
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set.");

if (value.IsValue1)
if (value.IsErrorVariant1)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<string?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.ErrorVariant1!, typeInfo);
}
else if (value.IsValue2)
else if (value.IsErrorVariant2)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<object?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.ErrorVariant2!, typeInfo);
}
}
}
Expand Down
Loading