Skip to content

Commit

Permalink
UGemini v2.3.0-preview.1
Browse files Browse the repository at this point in the history
- Fixed chunk patch methods.
  • Loading branch information
Uralstech committed Oct 3, 2024
1 parent c01a54c commit 3dd4417
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class GeminiCorporaChunkBatchUpdateRequestPart
/// <summary>
/// The patch data for the Chunk.
/// </summary>
public GeminiCorpusObjectPatchData Chunk;
public GeminiCorpusChunkPatchData Chunk;

/// <summary>
/// The list of fields to update. This is automatically generated.
Expand All @@ -23,7 +23,7 @@ public class GeminiCorporaChunkBatchUpdateRequestPart
/// Creates a new <see cref="GeminiCorporaChunkBatchUpdateRequestPart"/>.
/// </summary>
/// <param name="chunk">The patch data for the Chunk.</param>
public GeminiCorporaChunkBatchUpdateRequestPart(GeminiCorpusObjectPatchData chunk)
public GeminiCorporaChunkBatchUpdateRequestPart(GeminiCorpusChunkPatchData chunk)
{
Chunk = chunk;
UpdateMask = Chunk.GetFieldMask();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class GeminiCorpusChunk
public GeminiCorpusChunkId Resource;

/// <summary>
/// The content for the Chunk, such as the text string. The maximum number of tokens per chunk is 2043.
/// The content for the Chunk, such as text. The maximum number of tokens per chunk is 2043.
/// </summary>
public GeminiCorpusChunkData Data;

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System.ComponentModel;

namespace Uralstech.UGemini.CorporaAPI.Chunks
{
/// <summary>
/// Data to patch an existing Chunk resource with new data.
/// </summary>
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
public class GeminiCorpusChunkPatchData
{
/// <summary>
/// The content for the Chunk, such as text. The maximum number of tokens per chunk is 2043.
/// </summary>
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore), DefaultValue(null)]
public GeminiCorpusChunkData Data = null;

/// <summary>
/// User provided custom metadata stored as key-value pairs used for querying. A Chunk can have a maximum of 20 CustomMetadata.
/// </summary>
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore), DefaultValue(null)]
public GeminiCorpusCustomMetadata[] CustomMetadata = null;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
using Newtonsoft.Json.Serialization;
using System.ComponentModel;

namespace Uralstech.UGemini.CorporaAPI
namespace Uralstech.UGemini.CorporaAPI.Documents
{
/// <summary>
/// Data to patch an existing Document or Chunk resource with new data.
/// Data to patch an existing Document resource with new data.
/// </summary>
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
public class GeminiCorpusObjectPatchData : GeminiCorpusPatchData
public class GeminiCorpusDocumentPatchData : GeminiCorpusPatchData
{
/// <summary>
/// User provided custom metadata stored as key-value pairs used for querying. A Document or Chunk can have a maximum of 20 CustomMetadata.
/// User provided custom metadata stored as key-value pairs used for querying. A Document can have a maximum of 20 CustomMetadata.
/// </summary>
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore), DefaultValue(null)]
public GeminiCorpusCustomMetadata[] CustomMetadata = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ namespace Uralstech.UGemini.CorporaAPI
/// <remarks>
/// Only available in the beta API.
/// </remarks>
public class GeminiCorporaPatchRequest : IGeminiPatchRequest
/// <typeparam name="TPatchData">
/// The type of patch data. Use <see cref="GeminiCorpusPatchData"/> for patching Corpora,
/// <see cref="Documents.GeminiCorpusDocumentPatchData"/> for Documents and
/// <see cref="Chunks.GeminiCorpusChunkPatchData"/> for Chunks.
/// </typeparam>
public class GeminiCorporaPatchRequest<TPatchData> : IGeminiPatchRequest
{
/// <summary>
/// The patch data.
/// </summary>
/// <remarks>
/// See <see cref="GeminiCorpusObjectPatchData"/> for Document and Chunk-specific patch data.
/// </remarks>
public GeminiCorpusPatchData Patch;
public TPatchData Patch;

/// <summary>
/// The ID of the Corpora API resource to patch.
Expand Down Expand Up @@ -53,7 +55,7 @@ public string GetEndpointUri(GeminiRequestMetadata metadata)
/// <param name="patch">The patch data.</param>
/// <param name="resourceId">The resource ID of the Corpora API resource to patch.</param>
/// <param name="useBetaApi">Should the request use the Beta API?</param>
public GeminiCorporaPatchRequest(GeminiCorpusPatchData patch, IGeminiCorpusResourceId resourceId, bool useBetaApi = true)
public GeminiCorporaPatchRequest(TPatchData patch, IGeminiCorpusResourceId resourceId, bool useBetaApi = true)
{
Patch = patch;
ResourceId = resourceId;
Expand Down

0 comments on commit 3dd4417

Please sign in to comment.