diff --git a/src/Mindee/V2/Client.cs b/src/Mindee/V2/Client.cs
index 7249a4a4..32dc8eed 100644
--- a/src/Mindee/V2/Client.cs
+++ b/src/Mindee/V2/Client.cs
@@ -238,11 +238,13 @@ InputSource inputSource
///
///
public async Task UploadRagDocumentAsync(
- LocalInputSource inputSource, RagDocumentUploadParameters parameters, CancellationToken ct = default)
+ LocalInputSource inputSource
+ , BaseRagDocumentUploadParameters parameters
+ , CancellationToken ct = default)
where TAnnotationResponse : BaseRagAnnotationResponse, new()
{
_logger?.LogInformation("Adding a document to the RAG database");
- return await _mindeeApi.ReqPostRagDocumentAsync(parameters, inputSource, ct);
+ return await _mindeeApi.ReqPostRagDocumentAsync(parameters, inputSource, ct);
}
///
@@ -255,15 +257,14 @@ public async Task UploadRagDocumentAsync
public async Task UploadAndGetRagDocumentPollAsync(
LocalInputSource inputSource
- , RagDocumentUploadParameters parameters
+ , BaseRagDocumentUploadParameters parameters
, PollingOptions pollingOptions = null
, CancellationToken ct = default)
where TAnnotationResponse : BaseRagAnnotationResponse, new()
{
pollingOptions ??= new PollingOptions();
- var initialResponse = await UploadRagDocumentAsync(
- inputSource, parameters, ct);
+ var initialResponse = await UploadRagDocumentAsync(inputSource, parameters, ct);
return await PollForRagDocumentAsync(
initialResponse, pollingOptions, ct);
@@ -303,8 +304,7 @@ string documentId
return initialResponse;
pollingOptions ??= new PollingOptions();
- return await PollForRagDocumentAsync(
- initialResponse, pollingOptions, ct);
+ return await PollForRagDocumentAsync(initialResponse, pollingOptions, ct);
}
///
@@ -314,11 +314,11 @@ string documentId
///
///
public async Task UpdateRagAnnotationAsync(
- BaseAnnotationParameters parameters, CancellationToken ct = default)
+ BaseAnnotationParameters parameters, CancellationToken ct = default)
where TAnnotationResponse : BaseRagAnnotationResponse, new()
{
_logger?.LogInformation("Updating RAG document ID: {DocumentId}", parameters.DocumentId);
- return await _mindeeApi.ReqPatchRagAnnotationAsync(parameters, ct);
+ return await _mindeeApi.ReqPatchRagAnnotationAsync(parameters, ct);
}
///
@@ -329,13 +329,13 @@ public async Task UpdateRagAnnotationAsync
///
public async Task UpdateAndGetRagAnnotationPollAsync(
- BaseAnnotationParameters parameters
+ BaseAnnotationParameters parameters
, PollingOptions pollingOptions = null
, CancellationToken ct = default)
where TAnnotationResponse : ExtractionRagAnnotationResponse, new()
{
_logger?.LogInformation("Updating RAG document ID: {DocumentId}", parameters.DocumentId);
- var initialResponse = await _mindeeApi.ReqPatchRagAnnotationAsync(parameters, ct);
+ var initialResponse = await _mindeeApi.ReqPatchRagAnnotationAsync(parameters, ct);
if (initialResponse.Status != "Processing")
return initialResponse;
diff --git a/src/Mindee/V2/ClientOptions/BaseAnnotationParameters.cs b/src/Mindee/V2/ClientOptions/BaseAnnotationParameters.cs
index 2beb2965..3d7e3b0b 100644
--- a/src/Mindee/V2/ClientOptions/BaseAnnotationParameters.cs
+++ b/src/Mindee/V2/ClientOptions/BaseAnnotationParameters.cs
@@ -1,12 +1,14 @@
using System;
using System.Collections.Generic;
+using Mindee.V2.Parsing;
namespace Mindee.V2.ClientOptions
{
///
/// Base parameters for document annotations.
///
- public abstract class BaseAnnotationParameters
+ public abstract class BaseAnnotationParameters
+ where TAnnotationResponse : BaseRagAnnotationResponse
{
///
/// UUID of the annotated document.
diff --git a/src/Mindee/V2/ClientOptions/BaseRagDocumentUploadParameters.cs b/src/Mindee/V2/ClientOptions/BaseRagDocumentUploadParameters.cs
new file mode 100644
index 00000000..c5ddaa7f
--- /dev/null
+++ b/src/Mindee/V2/ClientOptions/BaseRagDocumentUploadParameters.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using Mindee.V2.Parsing;
+
+namespace Mindee.V2.ClientOptions
+{
+ ///
+ /// Base parameters for document upload operations.
+ ///
+ public abstract class BaseRagDocumentUploadParameters
+ where TAnnotationResponse : BaseRagAnnotationResponse
+ {
+ ///
+ /// UUID of the model that the uploaded RAG document is linked to.
+ ///
+ public string ModelId { get; }
+
+ ///
+ /// Default constructor.
+ ///
+ ///
+ protected BaseRagDocumentUploadParameters(string modelId)
+ {
+ if (string.IsNullOrWhiteSpace(modelId))
+ throw new ArgumentException("ModelId cannot be null or whitespace.", nameof(modelId));
+ ModelId = modelId.Trim();
+ }
+
+ ///
+ /// Gets the request parameters for the upload request.
+ ///
+ public virtual Dictionary GetRequestParameters()
+ {
+ var parameters = new Dictionary();
+ parameters.Add("model_id", ModelId);
+ return parameters;
+ }
+ }
+}
diff --git a/src/Mindee/V2/Http/HttpApiV2.cs b/src/Mindee/V2/Http/HttpApiV2.cs
index 4b84ca0d..17735b1e 100644
--- a/src/Mindee/V2/Http/HttpApiV2.cs
+++ b/src/Mindee/V2/Http/HttpApiV2.cs
@@ -95,7 +95,7 @@ public abstract Task ReqGetSearchAsync(
///
///
public abstract Task ReqPostRagDocumentAsync(
- RagDocumentUploadParameters parameters
+ BaseRagDocumentUploadParameters parameters
, LocalInputSource localInputSource
, CancellationToken cancellationToken = default)
where TAnnotationResponse : BaseRagAnnotationResponse, new();
@@ -115,7 +115,7 @@ public abstract Task ReqGetRagAnnotationAsync
///
public abstract Task ReqPatchRagAnnotationAsync(
- BaseAnnotationParameters parameters, CancellationToken cancellationToken = default)
+ BaseAnnotationParameters parameters, CancellationToken cancellationToken = default)
where TAnnotationResponse : BaseRagAnnotationResponse, new();
///
diff --git a/src/Mindee/V2/Http/MindeeApiV2.cs b/src/Mindee/V2/Http/MindeeApiV2.cs
index d7e5f23e..1a520e82 100644
--- a/src/Mindee/V2/Http/MindeeApiV2.cs
+++ b/src/Mindee/V2/Http/MindeeApiV2.cs
@@ -95,7 +95,7 @@ public override async Task ReqGetSearchAsync(
}
public override async Task ReqPostRagDocumentAsync(
- RagDocumentUploadParameters parameters
+ BaseRagDocumentUploadParameters parameters
, LocalInputSource localInputSource
, CancellationToken cancellationToken = default)
{
@@ -120,7 +120,7 @@ public override async Task ReqGetRagAnnotationAsync ReqPatchRagAnnotationAsync(
- BaseAnnotationParameters parameters, CancellationToken cancellationToken = default)
+ BaseAnnotationParameters parameters, CancellationToken cancellationToken = default)
{
var request = new RestRequest(
$"/v2/products/extraction/rag-documents/{parameters.DocumentId}", Method.Patch);
diff --git a/src/Mindee/V2/Product/Extraction/RagDocuments/Params/RagDocumentAnnotationParameters.cs b/src/Mindee/V2/Product/Extraction/RagDocuments/Params/RagDocumentAnnotationParameters.cs
index 194e0477..75fb3d55 100644
--- a/src/Mindee/V2/Product/Extraction/RagDocuments/Params/RagDocumentAnnotationParameters.cs
+++ b/src/Mindee/V2/Product/Extraction/RagDocuments/Params/RagDocumentAnnotationParameters.cs
@@ -8,7 +8,7 @@ namespace Mindee.V2.Product.Extraction.RagDocuments.Params
///
/// Annotation parameters for RAG documents.
///
- public class RagDocumentAnnotationParameters : BaseAnnotationParameters
+ public class RagDocumentAnnotationParameters : BaseAnnotationParameters
{
///
/// New public status to apply to the document (for example, to deactivate it).
@@ -23,7 +23,9 @@ public class RagDocumentAnnotationParameters : BaseAnnotationParameters
///
/// Default constructor.
///
- ///
+ ///
+ ///
+ ///
///
///
public RagDocumentAnnotationParameters(
diff --git a/src/Mindee/V2/Product/Extraction/RagDocuments/Params/RagDocumentUploadParameters.cs b/src/Mindee/V2/Product/Extraction/RagDocuments/Params/RagDocumentUploadParameters.cs
index 574bf9a7..cb5dd7f1 100644
--- a/src/Mindee/V2/Product/Extraction/RagDocuments/Params/RagDocumentUploadParameters.cs
+++ b/src/Mindee/V2/Product/Extraction/RagDocuments/Params/RagDocumentUploadParameters.cs
@@ -1,37 +1,19 @@
using System;
using System.Collections.Generic;
+using Mindee.V2.ClientOptions;
namespace Mindee.V2.Product.Extraction.RagDocuments.Params
{
///
/// Upload parameters for RAG documents.
///
- public class RagDocumentUploadParameters
+ public class RagDocumentUploadParameters : BaseRagDocumentUploadParameters
{
///
- /// UUID of the extraction model that the uploaded RAG document is linked to.
+ ///
///
- public string ModelId { get; }
-
- ///
- /// Default constructor.
- ///
- ///
- public RagDocumentUploadParameters(string modelId)
- {
- if (string.IsNullOrWhiteSpace(modelId))
- throw new ArgumentException("ModelId cannot be null or whitespace.", nameof(modelId));
- ModelId = modelId.Trim();
- }
-
- ///
- /// Gets the request parameters for the upload request.
- ///
- public virtual Dictionary GetRequestParameters()
- {
- var parameters = new Dictionary();
- parameters.Add("model_id", ModelId);
- return parameters;
- }
+ ///
+ public RagDocumentUploadParameters(string modelId) : base(modelId)
+ { }
}
}