From 3dd44176e9a6856221ebb1be7920238ce766738e Mon Sep 17 00:00:00 2001 From: Udayshankar Ravikumar Date: Thu, 3 Oct 2024 23:29:51 +0530 Subject: [PATCH] UGemini v2.3.0-preview.1 - Fixed chunk patch methods. --- ...eminiCorporaChunkBatchUpdateRequestPart.cs | 4 +-- .../Data/Corpora/Chunks/GeminiCorpusChunk.cs | 2 +- .../Scripts/Data/Corpora/Chunks/Patch.meta | 8 ++++++ .../Patch/GeminiCorpusChunkPatchData.cs | 25 +++++++++++++++++++ .../Patch/GeminiCorpusChunkPatchData.cs.meta | 11 ++++++++ .../Scripts/Data/Corpora/Documents/Patch.meta | 8 ++++++ .../Patch/GeminiCorpusDocumentPatchData.cs} | 8 +++--- .../GeminiCorpusDocumentPatchData.cs.meta} | 0 .../Patch/GeminiCorporaPatchRequest.cs | 14 ++++++----- 9 files changed, 67 insertions(+), 13 deletions(-) create mode 100644 UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/Patch.meta create mode 100644 UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/Patch/GeminiCorpusChunkPatchData.cs create mode 100644 UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/Patch/GeminiCorpusChunkPatchData.cs.meta create mode 100644 UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Documents/Patch.meta rename UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/{Patch/GeminiCorpusObjectPatchData.cs => Documents/Patch/GeminiCorpusDocumentPatchData.cs} (64%) rename UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/{Patch/GeminiCorpusObjectPatchData.cs.meta => Documents/Patch/GeminiCorpusDocumentPatchData.cs.meta} (100%) diff --git a/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/BatchUpdate/GeminiCorporaChunkBatchUpdateRequestPart.cs b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/BatchUpdate/GeminiCorporaChunkBatchUpdateRequestPart.cs index b8bad29..0d2ee61 100644 --- a/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/BatchUpdate/GeminiCorporaChunkBatchUpdateRequestPart.cs +++ b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/BatchUpdate/GeminiCorporaChunkBatchUpdateRequestPart.cs @@ -12,7 +12,7 @@ public class GeminiCorporaChunkBatchUpdateRequestPart /// /// The patch data for the Chunk. /// - public GeminiCorpusObjectPatchData Chunk; + public GeminiCorpusChunkPatchData Chunk; /// /// The list of fields to update. This is automatically generated. @@ -23,7 +23,7 @@ public class GeminiCorporaChunkBatchUpdateRequestPart /// Creates a new . /// /// The patch data for the Chunk. - public GeminiCorporaChunkBatchUpdateRequestPart(GeminiCorpusObjectPatchData chunk) + public GeminiCorporaChunkBatchUpdateRequestPart(GeminiCorpusChunkPatchData chunk) { Chunk = chunk; UpdateMask = Chunk.GetFieldMask(); diff --git a/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/GeminiCorpusChunk.cs b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/GeminiCorpusChunk.cs index 8c34b87..57f8f13 100644 --- a/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/GeminiCorpusChunk.cs +++ b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/GeminiCorpusChunk.cs @@ -25,7 +25,7 @@ public class GeminiCorpusChunk public GeminiCorpusChunkId Resource; /// - /// 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. /// public GeminiCorpusChunkData Data; diff --git a/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/Patch.meta b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/Patch.meta new file mode 100644 index 0000000..38e0552 --- /dev/null +++ b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/Patch.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e649ce2c9a80d0441829540e4f0e0716 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/Patch/GeminiCorpusChunkPatchData.cs b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/Patch/GeminiCorpusChunkPatchData.cs new file mode 100644 index 0000000..db9fe82 --- /dev/null +++ b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/Patch/GeminiCorpusChunkPatchData.cs @@ -0,0 +1,25 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using System.ComponentModel; + +namespace Uralstech.UGemini.CorporaAPI.Chunks +{ + /// + /// Data to patch an existing Chunk resource with new data. + /// + [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] + public class GeminiCorpusChunkPatchData + { + /// + /// The content for the Chunk, such as text. The maximum number of tokens per chunk is 2043. + /// + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore), DefaultValue(null)] + public GeminiCorpusChunkData Data = null; + + /// + /// User provided custom metadata stored as key-value pairs used for querying. A Chunk can have a maximum of 20 CustomMetadata. + /// + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore), DefaultValue(null)] + public GeminiCorpusCustomMetadata[] CustomMetadata = null; + } +} \ No newline at end of file diff --git a/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/Patch/GeminiCorpusChunkPatchData.cs.meta b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/Patch/GeminiCorpusChunkPatchData.cs.meta new file mode 100644 index 0000000..54bc85f --- /dev/null +++ b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Chunks/Patch/GeminiCorpusChunkPatchData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5fa33ed8bad7d0247af4bc2b46cce9c4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Documents/Patch.meta b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Documents/Patch.meta new file mode 100644 index 0000000..1aa3d9c --- /dev/null +++ b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Documents/Patch.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d6317a6df7786db4cb08be0eabdd33c6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Patch/GeminiCorpusObjectPatchData.cs b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Documents/Patch/GeminiCorpusDocumentPatchData.cs similarity index 64% rename from UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Patch/GeminiCorpusObjectPatchData.cs rename to UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Documents/Patch/GeminiCorpusDocumentPatchData.cs index d6a04d2..ace3453 100644 --- a/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Patch/GeminiCorpusObjectPatchData.cs +++ b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Documents/Patch/GeminiCorpusDocumentPatchData.cs @@ -2,16 +2,16 @@ using Newtonsoft.Json.Serialization; using System.ComponentModel; -namespace Uralstech.UGemini.CorporaAPI +namespace Uralstech.UGemini.CorporaAPI.Documents { /// - /// Data to patch an existing Document or Chunk resource with new data. + /// Data to patch an existing Document resource with new data. /// [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] - public class GeminiCorpusObjectPatchData : GeminiCorpusPatchData + public class GeminiCorpusDocumentPatchData : GeminiCorpusPatchData { /// - /// 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. /// [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore), DefaultValue(null)] public GeminiCorpusCustomMetadata[] CustomMetadata = null; diff --git a/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Patch/GeminiCorpusObjectPatchData.cs.meta b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Documents/Patch/GeminiCorpusDocumentPatchData.cs.meta similarity index 100% rename from UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Patch/GeminiCorpusObjectPatchData.cs.meta rename to UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Documents/Patch/GeminiCorpusDocumentPatchData.cs.meta diff --git a/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Patch/GeminiCorporaPatchRequest.cs b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Patch/GeminiCorporaPatchRequest.cs index 3f681d6..edd6b88 100644 --- a/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Patch/GeminiCorporaPatchRequest.cs +++ b/UGemini/Packages/com.uralstech.ugemini/Runtime/Scripts/Data/Corpora/Patch/GeminiCorporaPatchRequest.cs @@ -9,15 +9,17 @@ namespace Uralstech.UGemini.CorporaAPI /// /// Only available in the beta API. /// - public class GeminiCorporaPatchRequest : IGeminiPatchRequest + /// + /// The type of patch data. Use for patching Corpora, + /// for Documents and + /// for Chunks. + /// + public class GeminiCorporaPatchRequest : IGeminiPatchRequest { /// /// The patch data. /// - /// - /// See for Document and Chunk-specific patch data. - /// - public GeminiCorpusPatchData Patch; + public TPatchData Patch; /// /// The ID of the Corpora API resource to patch. @@ -53,7 +55,7 @@ public string GetEndpointUri(GeminiRequestMetadata metadata) /// The patch data. /// The resource ID of the Corpora API resource to patch. /// Should the request use the Beta API? - public GeminiCorporaPatchRequest(GeminiCorpusPatchData patch, IGeminiCorpusResourceId resourceId, bool useBetaApi = true) + public GeminiCorporaPatchRequest(TPatchData patch, IGeminiCorpusResourceId resourceId, bool useBetaApi = true) { Patch = patch; ResourceId = resourceId;