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
4 changes: 2 additions & 2 deletions Microsoft.Azure.Cosmos/src/Inference/RerankScore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class RerankScore
/// <summary>
/// Gets the document content or identifier that was reranked.
/// </summary>
public object Document { get; }
public string Document { get; }

/// <summary>
/// Gets the score assigned to the document after reranking.
Expand All @@ -36,7 +36,7 @@ class RerankScore
/// <param name="document">The document content or identifier.</param>
/// <param name="score">The reranked score for the document.</param>
/// <param name="index">The original index of the document.</param>
public RerankScore(object document, double score, int index)
public RerankScore(string document, double score, int index)
{
this.Document = document;
this.Score = score;
Expand Down
10 changes: 6 additions & 4 deletions Microsoft.Azure.Cosmos/src/Inference/SemanticRerankResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,19 @@ internal static async Task<SemanticRerankResult> DeserializeSemanticRerankResult
{
foreach (JsonElement item in scoresElement.EnumerateArray())
{
object document = null;
string document = string.Empty;
if (item.TryGetProperty("document", out JsonElement docElement))
{
// Try to deserialize as an object
switch (docElement.ValueKind)
{
case JsonValueKind.Object:
document = JsonSerializer.Deserialize<Dictionary<string, object>>(docElement.GetRawText());
document = docElement.GetRawText();
break;
case JsonValueKind.Null:
document = null;
case JsonValueKind.String:
document = docElement.GetString();
break;
default:
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1452,22 +1452,22 @@
"Attributes": [],
"MethodInfo": "Int32 Index;CanRead:True;CanWrite:False;Int32 get_Index();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
},
"System.Object Document": {
"System.String Document": {
"Type": "Property",
"Attributes": [],
"MethodInfo": "System.Object Document;CanRead:True;CanWrite:False;System.Object get_Document();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
"MethodInfo": "System.String Document;CanRead:True;CanWrite:False;System.String get_Document();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
},
"System.Object get_Document()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
"System.String get_Document()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
"Type": "Method",
"Attributes": [
"CompilerGeneratedAttribute"
],
"MethodInfo": "System.Object get_Document();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
"MethodInfo": "System.String get_Document();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
},
"Void .ctor(System.Object, Double, Int32)": {
"Void .ctor(System.String, Double, Int32)": {
"Type": "Constructor",
"Attributes": [],
"MethodInfo": "Void .ctor(System.Object, Double, Int32)"
"MethodInfo": "Void .ctor(System.String, Double, Int32)"
}
},
"NestedTypes": {}
Expand Down
Loading