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 @@ -66,9 +66,9 @@ public class EmbeddingItemJsonConverter : global::System.Text.Json.Serialization
if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; }
if (__score2 > __bestScore) { __bestScore = __score2; __bestIndex = 2; }

global::System.Collections.Generic.IList<double>? value1 = default;
global::System.Collections.Generic.IList<int>? value2 = default;
string? value3 = default;
global::System.Collections.Generic.IList<double>? embeddingItemVariant1 = default;
global::System.Collections.Generic.IList<int>? embeddingItemVariant2 = default;
string? embeddingItemVariant3 = default;
if (__bestIndex >= 0)
{
if (__bestIndex == 0)
Expand All @@ -78,7 +78,7 @@ public class EmbeddingItemJsonConverter : global::System.Text.Json.Serialization

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

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

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}");
value3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
embeddingItemVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -123,14 +123,14 @@ public class EmbeddingItemJsonConverter : global::System.Text.Json.Serialization
}
}

if (value1 == null && value2 == null && value3 == null)
if (embeddingItemVariant1 == null && embeddingItemVariant2 == null && embeddingItemVariant3 == null)
{
try
{

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

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

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}");
value3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
embeddingItemVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -169,11 +169,11 @@ public class EmbeddingItemJsonConverter : global::System.Text.Json.Serialization
}

var __value = new global::Mixedbread.EmbeddingItem(
value1,
embeddingItemVariant1,

value2,
embeddingItemVariant2,

value3
embeddingItemVariant3
);

return __value;
Expand All @@ -188,23 +188,23 @@ 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.IsEmbeddingItemVariant1)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::System.Collections.Generic.IList<double>), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.IList<double>?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::System.Collections.Generic.IList<double>).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.EmbeddingItemVariant1!, typeInfo);
}
else if (value.IsValue2)
else if (value.IsEmbeddingItemVariant2)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::System.Collections.Generic.IList<int>), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.IList<int>?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::System.Collections.Generic.IList<int>).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.EmbeddingItemVariant2!, typeInfo);
}
else if (value.IsValue3)
else if (value.IsEmbeddingItemVariant3)
{
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.Value3!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.EmbeddingItemVariant3!, typeInfo);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public class MultiModalQueryJsonConverter : global::System.Text.Json.Serializati
if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; }
if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; }

string? value1 = default;
global::Mixedbread.MultiModalQueryVariant2? value2 = default;
string? multiModalQueryVariant1 = default;
global::Mixedbread.MultiModalQueryVariant2? multiModalQueryVariant2 = default;
if (__bestIndex >= 0)
{
if (__bestIndex == 0)
Expand All @@ -65,7 +65,7 @@ public class MultiModalQueryJsonConverter : global::System.Text.Json.Serializati

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);
multiModalQueryVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -82,7 +82,7 @@ public class MultiModalQueryJsonConverter : global::System.Text.Json.Serializati

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

if (value1 == null && value2 == null)
if (multiModalQueryVariant1 == null && multiModalQueryVariant2 == 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);
multiModalQueryVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -114,7 +114,7 @@ public class MultiModalQueryJsonConverter : global::System.Text.Json.Serializati

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

var __value = new global::Mixedbread.MultiModalQuery(
value1,
multiModalQueryVariant1,

value2
multiModalQueryVariant2
);

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.IsMultiModalQueryVariant1)
{
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.MultiModalQueryVariant1!, typeInfo);
}
else if (value.IsValue2)
else if (value.IsMultiModalQueryVariant2)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Mixedbread.MultiModalQueryVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Mixedbread.MultiModalQueryVariant2> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Mixedbread.MultiModalQueryVariant2).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2!.Value, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.MultiModalQueryVariant2!.Value, typeInfo);
}
}
}
Expand Down
Loading
Loading