-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix OpenAPI doc and remove "Citation" class duplication
- Loading branch information
Showing
5 changed files
with
73 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Microsoft.SemanticMemory.Client.Models; | ||
|
||
public class Citation | ||
{ | ||
/// <summary> | ||
/// Link to the source, if available. | ||
/// </summary> | ||
[JsonPropertyName("link")] | ||
[JsonPropertyOrder(1)] | ||
public string Link { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Type of source, e.g. PDF, Word, Chat, etc. | ||
/// </summary> | ||
[JsonPropertyName("sourceContentType")] | ||
[JsonPropertyOrder(2)] | ||
public string SourceContentType { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Name of the source, e.g. file name. | ||
/// </summary> | ||
[JsonPropertyName("sourceName")] | ||
[JsonPropertyOrder(3)] | ||
public string SourceName { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// List of chunks/blocks of text used. | ||
/// </summary> | ||
[JsonPropertyName("partitions")] | ||
[JsonPropertyOrder(4)] | ||
public List<Partition> Partitions { get; set; } = new(); | ||
|
||
public class Partition | ||
{ | ||
/// <summary> | ||
/// Content of the document partition, aka chunk/block of text. | ||
/// </summary> | ||
[JsonPropertyName("text")] | ||
[JsonPropertyOrder(1)] | ||
public string Text { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Relevance of this partition against the given query. | ||
/// Value usually is between 0 and 1, when using cosine similarity. | ||
/// </summary> | ||
[JsonPropertyName("relevance")] | ||
[JsonPropertyOrder(2)] | ||
public float Relevance { get; set; } = 0; | ||
|
||
/// <summary> | ||
/// Timestamp about the file/text partition. | ||
/// </summary> | ||
[JsonPropertyName("lastUpdate")] | ||
[JsonPropertyOrder(4)] | ||
public DateTimeOffset LastUpdate { get; set; } = DateTimeOffset.MinValue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters