-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
beca6ce
commit 2d82227
Showing
12 changed files
with
279 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#if NET472_OR_GREATER || NETSTANDARD2_0 | ||
using System.Text.Json.Serialization; | ||
#endif | ||
|
||
namespace Mscc.GenerativeAI | ||
{ | ||
/// <summary> | ||
/// The mode of the predictor to be used in dynamic retrieval. | ||
/// </summary> | ||
[JsonConverter(typeof(JsonStringEnumConverter<DynamicRetrievalConfigMode>))] | ||
public enum DynamicRetrievalConfigMode | ||
{ | ||
/// <summary> | ||
/// Always trigger retrieval. | ||
/// </summary> | ||
ModeUnspecified = 0, | ||
/// <summary> | ||
/// Run retrieval only when system decides it is necessary. | ||
/// </summary> | ||
ModeDynamic | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
src/Mscc.GenerativeAI/Types/Generative/DynamicRetrievalConfig.cs
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,17 @@ | ||
namespace Mscc.GenerativeAI | ||
{ | ||
/// <summary> | ||
/// Describes the options to customize dynamic retrieval. | ||
/// </summary> | ||
public class DynamicRetrievalConfig | ||
{ | ||
/// <summary> | ||
/// The mode of the predictor to be used in dynamic retrieval. | ||
/// </summary> | ||
public DynamicRetrievalConfigMode? Mode { get; set; } | ||
/// <summary> | ||
/// The threshold to be used in dynamic retrieval. If not set, a system default value is used. | ||
/// </summary> | ||
public float? DynamicThreshold { get; set; } | ||
} | ||
} |
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,13 @@ | ||
namespace Mscc.GenerativeAI | ||
{ | ||
/// <summary> | ||
/// Grounding chunk. | ||
/// </summary> | ||
public class GroundingChunk | ||
{ | ||
/// <summary> | ||
/// Grounding chunk from the web. | ||
/// </summary> | ||
public Web? Web { get; set; } | ||
} | ||
} |
29 changes: 28 additions & 1 deletion
29
src/Mscc.GenerativeAI/Types/Generative/GroundingMetadata.cs
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 |
---|---|---|
@@ -1,10 +1,37 @@ | ||
using System.Collections.Generic; | ||
#if NET472_OR_GREATER || NETSTANDARD2_0 | ||
using System.Collections.Generic; | ||
#endif | ||
|
||
namespace Mscc.GenerativeAI | ||
{ | ||
/// <summary> | ||
/// Metadata returned to client when grounding is enabled. | ||
/// </summary> | ||
public class GroundingMetadata | ||
{ | ||
/// <summary> | ||
/// Optional. Google search entry for the following-up web searches. | ||
/// </summary> | ||
public SearchEntryPoint? SearchEntryPoint { get; set; } | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public List<GroundingAttribution>? GroundingAttributions { get; set; } | ||
/// <summary> | ||
/// Web search queries for the following-up web search. | ||
/// </summary> | ||
public List<string>? WebSearchQueries { get; set; } | ||
/// <summary> | ||
/// List of grounding support. | ||
/// </summary> | ||
public List<GroundingSupport>? GroundingSupports { get; set; } | ||
/// <summary> | ||
/// Metadata related to retrieval in the grounding flow. | ||
/// </summary> | ||
public RetrievalMetadata? RetrievalMetadata { get; set; } | ||
/// <summary> | ||
/// List of supporting references retrieved from specified grounding source. | ||
/// </summary> | ||
public List<GroundingChunk>? GroundingChunks { get; set; } | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/Mscc.GenerativeAI/Types/Generative/GroundingSupport.cs
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,29 @@ | ||
#if NET472_OR_GREATER || NETSTANDARD2_0 | ||
using System.Collections.Generic; | ||
#endif | ||
|
||
namespace Mscc.GenerativeAI | ||
{ | ||
/// <summary> | ||
/// Grounding support. | ||
/// </summary> | ||
public class GroundingSupport | ||
{ | ||
/// <summary> | ||
/// Segment of the content this support belongs to. | ||
/// </summary> | ||
public Segment? Segment { get; set; } | ||
/// <summary> | ||
/// A list of indices (into 'grounding_chunk') specifying the citations associated with the claim. | ||
/// </summary> | ||
/// <remarks> | ||
/// For instance [1,3,4] means that grounding_chunk[1], grounding_chunk[3], grounding_chunk[4] are the retrieved content attributed to the claim. | ||
/// </remarks> | ||
public List<int>? GroundingChunkIndices { get; set; } | ||
/// <summary> | ||
/// Confidence score of the support references. Ranges from 0 to 1. 1 is the most confident. | ||
/// This list must have the same size as the grounding_chunk_indices. | ||
/// </summary> | ||
public List<float>? ConfidenceScores { get; set; } | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Mscc.GenerativeAI/Types/Generative/RetrievalMetadata.cs
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,18 @@ | ||
namespace Mscc.GenerativeAI | ||
{ | ||
/// <summary> | ||
/// Metadata related to retrieval in the grounding flow. | ||
/// </summary> | ||
public class RetrievalMetadata | ||
{ | ||
/// <summary> | ||
/// Optional. Score indicating how likely information from google search could help answer the prompt. | ||
/// </summary> | ||
/// <remarks> | ||
/// The score is in the range [0, 1], where 0 is the least likely and 1 is the most likely. | ||
/// This score is only populated when google search grounding and dynamic retrieval is enabled. | ||
/// It will be compared to the threshold to determine whether to trigger google search. | ||
/// </remarks> | ||
public float? GoogleSearchDynamicRetrievalScore { get; set; } | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Mscc.GenerativeAI/Types/Generative/SearchEntryPoint.cs
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,17 @@ | ||
namespace Mscc.GenerativeAI | ||
{ | ||
/// <summary> | ||
/// Google search entry point. | ||
/// </summary> | ||
public class SearchEntryPoint | ||
{ | ||
/// <summary> | ||
/// Optional. Web content snippet that can be embedded in a web page or an app webview. | ||
/// </summary> | ||
public string? RenderedContent { get; set; } | ||
/// <summary> | ||
/// Optional. Base64 encoded JSON representing array of tuple. | ||
/// </summary> | ||
public byte[]? SdkBlob { get; set; } | ||
} | ||
} |
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,25 @@ | ||
namespace Mscc.GenerativeAI | ||
{ | ||
/// <summary> | ||
/// Segment of the content. | ||
/// </summary> | ||
public class Segment | ||
{ | ||
/// <summary> | ||
/// Output only. The text corresponding to the segment from the response. | ||
/// </summary> | ||
public string? Text { get; set; } | ||
/// <summary> | ||
/// Output only. Start index in the given Part, measured in bytes. Offset from the start of the Part, inclusive, starting at zero. | ||
/// </summary> | ||
public int? StartIndex { get; set; } | ||
/// <summary> | ||
/// Output only. The index of a Part object within its parent Content object. | ||
/// </summary> | ||
public int? PartIndex { get; set; } | ||
/// <summary> | ||
/// Output only. End index in the given Part, measured in bytes. Offset from the start of the Part, exclusive, starting at zero. | ||
/// </summary> | ||
public int? EndIndex { get; set; } | ||
} | ||
} |
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,17 @@ | ||
namespace Mscc.GenerativeAI | ||
{ | ||
/// <summary> | ||
/// Chunk from the web. | ||
/// </summary> | ||
public class Web | ||
{ | ||
/// <summary> | ||
/// URI reference of the chunk. | ||
/// </summary> | ||
public string? Uri { get; set; } | ||
/// <summary> | ||
/// Title of the chunk. | ||
/// </summary> | ||
public string? Title { get; set; } | ||
} | ||
} |
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