Skip to content

Commit 4ddf980

Browse files
committed
Rename "requestId" to "documentId"
1 parent f2082ed commit 4ddf980

8 files changed

Lines changed: 29 additions & 29 deletions

File tree

clients/curl/upload-file.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Usage:
1818
-f file path Path to the document to upload.
1919
-u userId User ID.
2020
-c "coll1 coll2 .." List of collection IDs separated by a space.
21-
-i uploadId Unique identifier for the upload.
21+
-i document ID Unique identifier for the document uploaded.
2222
-s web service URL Semantic Memory web service URL.
2323
-h Print this help content.
2424
@@ -50,7 +50,7 @@ readParameters() {
5050
;;
5151
-i)
5252
shift
53-
REQUEST_ID=$1
53+
DOCUMENT_ID=$1
5454
;;
5555
-s)
5656
shift
@@ -91,8 +91,8 @@ validatePrameters() {
9191
echo "Please specify the list of collection IDs"
9292
exit 3
9393
fi
94-
if [ -z "$REQUEST_ID" ]; then
95-
echo "Please specify a unique upload request ID"
94+
if [ -z "$DOCUMENT_ID" ]; then
95+
echo "Please specify a unique document ID"
9696
exit 4
9797
fi
9898
if [ -z "$SERVICE_URL" ]; then
@@ -103,7 +103,7 @@ validatePrameters() {
103103

104104
# Remove variables and functions from the environment, in case the script was sourced
105105
cleanupEnv() {
106-
unset FILENAME USER_ID COLLECTIONS REQUEST_ID SERVICE_URL
106+
unset FILENAME USER_ID COLLECTIONS DOCUMENT_ID SERVICE_URL
107107
unset -f help readParameters validatePrameters cleanupEnv exitScript
108108
}
109109

@@ -127,6 +127,6 @@ done
127127
curl -v \
128128
-F 'file1=@"'"${FILENAME}"'"' \
129129
-F 'user="'"${USER_ID}"'"' \
130-
-F 'requestId="'"${REQUEST_ID}"'"' \
130+
-F 'documentId="'"${DOCUMENT_ID}"'"' \
131131
$COLLECTIONS_FIELD \
132132
$SERVICE_URL

clients/dotnet/MemoryPipelineClient/MemoryPipelineClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private async Task ImportFilesInternalAsync(string[] files, ImportFileOptions op
5959
InProcessPipelineOrchestrator orchestrator = await this.Orchestrator.ConfigureAwait(false);
6060

6161
var pipeline = orchestrator
62-
.PrepareNewFileUploadPipeline(options.RequestId, options.UserId, options.CollectionIds);
62+
.PrepareNewFileUploadPipeline(options.DocumentId, options.UserId, options.CollectionIds);
6363

6464
// Include all files
6565
for (int index = 0; index < files.Length; index++)

clients/dotnet/MemoryWebClient/MemoryWebClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ private async Task ImportFilesInternalAsync(string[] files, ImportFileOptions op
4747
// Populate form with values and files from disk
4848
using var formData = new MultipartFormDataContent();
4949

50-
using var requestIdContent = new StringContent(options.RequestId);
50+
using var documentIdContent = new StringContent(options.DocumentId);
5151
using (var userContent = new StringContent(options.UserId))
5252
{
5353
List<IDisposable> disposables = new();
54-
formData.Add(requestIdContent, "requestId");
54+
formData.Add(documentIdContent, "documentId");
5555
formData.Add(userContent, "user");
5656
foreach (var collectionId in options.CollectionIds)
5757
{

clients/samples/FileImportExamples/Example1_ImportWithMemoryPipelineClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ public static async Task RunAsync()
1313
var memory = new MemoryPipelineClient(config);
1414

1515
await memory.ImportFileAsync("file1.txt",
16-
new ImportFileOptions(userId: "user1", collectionId: "collection01", requestId: "upload1"));
16+
new ImportFileOptions(userId: "user1", collectionId: "collection01", documentId: "upload1"));
1717

1818
await memory.ImportFilesAsync(new[] { "file2.txt", "file3.docx", "file4.pdf" },
19-
new ImportFileOptions(userId: "user2", collectionId: "collection01", requestId: "upload2"));
19+
new ImportFileOptions(userId: "user2", collectionId: "collection01", documentId: "upload2"));
2020

2121
await memory.ImportFileAsync("5.docx",
22-
new ImportFileOptions(userId: "user3", collectionId: "collection01", requestId: "upload1"));
22+
new ImportFileOptions(userId: "user3", collectionId: "collection01", documentId: "upload1"));
2323

2424
var owner = "user3";
2525

lib/dotnet/Core.NetStandard20/ImportFileOptions.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class ImportFileOptions
1010
{
1111
public string UserId { get; set; } = string.Empty;
1212
public List<string> CollectionIds { get; set; } = new();
13-
public string RequestId { get; set; } = string.Empty;
13+
public string DocumentId { get; set; } = string.Empty;
1414

1515
public ImportFileOptions()
1616
{
@@ -21,26 +21,26 @@ public ImportFileOptions(string userId, string collectionId)
2121
{
2222
}
2323

24-
public ImportFileOptions(string userId, string collectionId, string requestId)
24+
public ImportFileOptions(string userId, string collectionId, string documentId)
2525
{
2626
this.UserId = userId;
2727
this.CollectionIds.Add(collectionId);
28-
this.RequestId = requestId;
28+
this.DocumentId = documentId;
2929
}
3030

31-
public ImportFileOptions(string userId, List<string> collectionIds, string requestId)
31+
public ImportFileOptions(string userId, List<string> collectionIds, string documentId)
3232
{
3333
this.UserId = userId;
3434
this.CollectionIds = collectionIds;
35-
this.RequestId = requestId;
35+
this.DocumentId = documentId;
3636
}
3737

3838
public void Sanitize()
3939
{
40-
if (string.IsNullOrEmpty(this.RequestId))
40+
if (string.IsNullOrEmpty(this.DocumentId))
4141
{
4242
// note: the ID doesn't include the full date, to avoid "personal" details
43-
this.RequestId = Guid.NewGuid().ToString("D") + "-" + DateTimeOffset.UtcNow.ToString("ss.fffffff", CultureInfo.InvariantCulture);
43+
this.DocumentId = Guid.NewGuid().ToString("D") + "-" + DateTimeOffset.UtcNow.ToString("ss.fffffff", CultureInfo.InvariantCulture);
4444
}
4545
}
4646

lib/dotnet/Core/WebService/UploadRequest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Microsoft.SemanticMemory.Core.WebService;
1212

1313
public class UploadRequest
1414
{
15-
public string RequestId { get; set; } = string.Empty;
15+
public string DocumentId { get; set; } = string.Empty;
1616
public string UserId { get; set; } = string.Empty;
1717
public IEnumerable<string> CollectionIds { get; set; } = new List<string>();
1818
public IEnumerable<IFormFile> Files { get; set; } = new List<IFormFile>();
@@ -27,7 +27,7 @@ public class UploadRequest
2727
{
2828
const string UserField = "user";
2929
const string CollectionsField = "collections";
30-
const string RequestIdField = "requestId";
30+
const string DocumentIdField = "documentId";
3131

3232
var result = new UploadRequest();
3333

@@ -59,13 +59,13 @@ public class UploadRequest
5959
return (result, false, $"Invalid or missing collection ID, '{CollectionsField}' list is empty or contains empty values");
6060
}
6161

62-
if (form.TryGetValue(RequestIdField, out StringValues requestIds) && requestIds.Count > 1)
62+
if (form.TryGetValue(DocumentIdField, out StringValues documentIds) && documentIds.Count > 1)
6363
{
64-
return (result, false, $"Invalid request ID, '{RequestIdField}' must be a single value, not a list");
64+
return (result, false, $"Invalid document ID, '{DocumentIdField}' must be a single value, not a list");
6565
}
6666

67-
// Request Id is optional, e.g. the client wants to retry the same upload, otherwise we generate a random/unique one
68-
result.RequestId = requestIds.FirstOrDefault() ?? DateTimeOffset.Now.ToString("yyyyMMdd.HHmmss.", CultureInfo.InvariantCulture) + Guid.NewGuid().ToString("N");
67+
// Document Id is optional, e.g. used if the client wants to retry the same upload, otherwise we generate a random/unique one
68+
result.DocumentId = documentIds.FirstOrDefault() ?? DateTimeOffset.Now.ToString("yyyyMMdd.HHmmss.", CultureInfo.InvariantCulture) + Guid.NewGuid().ToString("N");
6969

7070
result.UserId = userIds[0]!;
7171
result.CollectionIds = collectionIds;

server/combinedservices-dotnet/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@
8787
return Results.BadRequest(errMsg);
8888
}
8989

90-
log.LogInformation("Queueing upload of {0} files for further processing [request {1}]", input.Files.Count(), input.RequestId);
91-
var containerId = $"usr.{input.UserId}.op.{input.RequestId}";
90+
log.LogInformation("Queueing upload of {0} files for further processing [request {1}]", input.Files.Count(), input.DocumentId);
91+
var containerId = $"usr.{input.UserId}.op.{input.DocumentId}";
9292

9393
// Define all the steps in the pipeline
9494
var pipeline = orchestrator

server/webservice-dotnet/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@
8080
return Results.BadRequest(errMsg);
8181
}
8282

83-
log.LogInformation("Queueing upload of {0} files for further processing [request {1}]", input.Files.Count(), input.RequestId);
84-
var containerId = $"usr.{input.UserId}.op.{input.RequestId}";
83+
log.LogInformation("Queueing upload of {0} files for further processing [request {1}]", input.Files.Count(), input.DocumentId);
84+
var containerId = $"usr.{input.UserId}.op.{input.DocumentId}";
8585

8686
// Define all the steps in the pipeline
8787
var pipeline = orchestrator

0 commit comments

Comments
 (0)