Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions docs/code_samples/workflow_execution.txt

This file was deleted.

83 changes: 0 additions & 83 deletions src/Mindee/V1/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -723,89 +723,6 @@ UrlInputSource inputSource
return await PollForResultsAsync(enqueueResponse, pollingOptions, ct);
}

/// <summary>
/// Send a local file to a workflow execution.
/// </summary>
/// <param name="workflowId">The workflow id.</param>
/// <param name="inputSource">
/// <see cref="LocalInputSource" />
/// </param>
/// <param name="workflowOptions">
/// <see cref="WorkflowOptions" />
/// </param>
/// <param name="pageOptions">
/// <see cref="PageOptions" />
/// </param>
/// <returns>
/// <see cref="WorkflowResponse{TInferenceModel}" />
/// </returns>
public async Task<WorkflowResponse<GeneratedV1>> ExecuteWorkflowAsync(
string workflowId,
LocalInputSource inputSource,
WorkflowOptions workflowOptions = null,
PageOptions pageOptions = null)
{
Logger?.LogInformation("Sending '{Filename}' to workflow '{WorkflowId}'...", inputSource.Filename, workflowId);

if (pageOptions != null && inputSource.IsPdf())
{
inputSource.FileBytes = _pdfOperation.Split(
new SplitQuery(inputSource.FileBytes, pageOptions)).File;
}

workflowOptions ??= new WorkflowOptions();

return await _mindeeApi.PostWorkflowExecution<GeneratedV1>(
workflowId,
new WorkflowParameter(
inputSource,
null,
workflowOptions.FullText,
workflowOptions.Alias,
workflowOptions.Priority,
workflowOptions.PublicUrl,
workflowOptions.Rag
));
}

/// <summary>
/// Send a remote file to a workflow execution.
/// </summary>
/// <param name="workflowId">The workflow id.</param>
/// <param name="inputSource">
/// <see cref="LocalInputSource" />
/// </param>
/// <param name="workflowOptions">
/// <see cref="WorkflowOptions" />
/// </param>
/// <returns>
/// <see cref="WorkflowResponse{TInferenceModel}" />
/// </returns>
public async Task<WorkflowResponse<GeneratedV1>> ExecuteWorkflowAsync(
string workflowId,
UrlInputSource inputSource,
WorkflowOptions workflowOptions = null)
{
Logger?.LogInformation("Asynchronous parsing of {} ...", inputSource.FileUrl);

if (workflowOptions == null)
{
workflowOptions = new WorkflowOptions();
}

return await _mindeeApi.PostWorkflowExecution<GeneratedV1>(
workflowId,
new WorkflowParameter(
null,
inputSource,
workflowOptions.FullText,
workflowOptions.Alias,
workflowOptions.Priority,
workflowOptions.PublicUrl,
workflowOptions.Rag
));
}

/// <summary>
/// Load a local prediction.
/// Typically used when wanting to load from a webhook callback.
Expand Down
13 changes: 0 additions & 13 deletions src/Mindee/V1/Http/IHttpApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,5 @@ string jobId
, CustomEndpoint endpoint = null
, CancellationToken ct = default)
where TModel : class, new();

/// <summary>
/// Send a document to a workflow.
/// </summary>
/// <param name="workflowId">The ID of the workflow.</param>
/// <param name="workflowParameter">
/// <see cref="PredictParameter" />
/// </param>
/// <typeparam name="TModel">Document type.</typeparam>
Task<WorkflowResponse<TModel>> PostWorkflowExecution<TModel>(
string workflowId,
WorkflowParameter workflowParameter)
where TModel : class, new();
}
}
61 changes: 0 additions & 61 deletions src/Mindee/V1/Http/MindeeApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,67 +141,6 @@ string jobId
return handledResponse;
}

public async Task<WorkflowResponse<TModel>> PostWorkflowExecution<TModel>(
string workflowId,
WorkflowParameter workflowParameter)
where TModel : class, new()
{
var request = new RestRequest(
$"/v1/workflows/{workflowId}/executions"
, Method.Post);

AddWorkflowRequestParameters(workflowParameter, request);

_logger?.LogInformation("HTTP POST to {RequestResource} ...", _baseUrl + request.Resource);

var response = await _httpClient.ExecutePostAsync(request);
return ResponseHandler<WorkflowResponse<TModel>>(response);
}

private static void AddWorkflowRequestParameters(WorkflowParameter workflowParameter, RestRequest request)
{
if (workflowParameter.LocalSource != null)
{
request.AddFile(
"document",
workflowParameter.LocalSource.FileBytes,
workflowParameter.LocalSource.Filename);
}
else if (workflowParameter.UrlSource != null)
{
request.AddParameter(
"document",
workflowParameter.UrlSource.FileUrl.ToString());
}

if (workflowParameter.FullText)
{
request.AddQueryParameter("full_text_ocr", "true");
}

if (workflowParameter.Alias != null)
{
request.AddParameter("alias", workflowParameter.Alias);
}

if (workflowParameter.PublicUrl != null)
{
request.AddParameter("public_url", workflowParameter.PublicUrl);
}

if (workflowParameter.Priority != null)
{
request.AddParameter(
"priority",
workflowParameter.Priority?.ToString().ToLower());
}

if (workflowParameter.Rag)
{
request.AddQueryParameter("rag", "true");
}
}

private static void AddPredictRequestParameters(PredictParameter predictParameter, RestRequest request)
{
if (predictParameter.LocalSource != null)
Expand Down
58 changes: 0 additions & 58 deletions src/Mindee/V1/Http/WorkflowParameter.cs

This file was deleted.

25 changes: 0 additions & 25 deletions src/Mindee/V1/Parsing/Common/WorkflowResponse.cs

This file was deleted.

13 changes: 0 additions & 13 deletions tests/Mindee.IntegrationTests/V1/Workflow/WorkflowTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,6 @@ public WorkflowTest()
_workflowId = Environment.GetEnvironmentVariable("Workflow__ID") ?? "";
}

[Fact(Timeout = 180000)]
public async Task Given_AWorkflowIdUpload_ShouldReturnACorrectWorkflowObject()
{
var currentDateTime = DateTime.Now.ToString("yyyy-MM-dd-HH:mm:ss");
var alias = "dotnet-" + currentDateTime;
var options = new WorkflowOptions(alias, ExecutionPriority.Low, rag: true);
var response = await _client.ExecuteWorkflowAsync(
_workflowId, _ragMatchInputSource, options);

Assert.Equal(ExecutionPriority.Low, response.Execution.Priority);
Assert.Equal(alias, response.Execution.File.Alias);
}

[Fact(Timeout = 180000)]
public async Task Given_AWorkflowIdPredictCustom_ShouldPollAndMatchRag()
{
Expand Down
Loading
Loading