Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net: Refactor AssemblyAI connector to use AssemblyAI SDK #8556

Open
wants to merge 7 commits into
base: feature-connectors-assemblyai
Choose a base branch
from

Conversation

Swimburger
Copy link

Motivation and Context

Description

By using the SDK, users can use the TranscriptOptionalParams class from the SDK to pass parameters to the AssemblyAI transcription endpoint.

Contribution Checklist

@Swimburger Swimburger requested a review from a team as a code owner September 5, 2024 18:38
@Swimburger Swimburger changed the base branch from main to feature-connectors-assemblyai September 5, 2024 18:38
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel documentation labels Sep 5, 2024
Copy link
Contributor

@Krzysztof318 Krzysztof318 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! I left some comments :)

dotnet/Directory.Packages.props Outdated Show resolved Hide resolved
this._pollingTimeout = value;
}
}

/// <inheritdoc/>
public override PromptExecutionSettings Clone()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add new properties to clone method also.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I deep clone TranscriptParams?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, avoid any reference changes, on the original and cloned.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -57,17 +53,27 @@ public async Task<IReadOnlyList<TextContent>> GetTextContentsAsync(
{
Verify.NotNull(content);

if (executionSettings?.ExtensionData is not null && executionSettings.ExtensionData.Count > 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice (if possible) support generic ExtensionData instead throwing exception.

Copy link
Author

@Swimburger Swimburger Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Unfortunately, we cannot send arbitrary JSON via the SDK, but we could convert the params into JSON and the extension data, merge the JSON objects, and then deserialize it back to the params class. Extension data that doesn't map to the object would still be omitted.

- Remove Resharper comments
- Update AssemblyAIAudioToTextExecutionSettings.Clone method
- Inline creation of AssemblyAIClient (remove AssemblyAIClientFactory)
- Catch HttpRequestExceptions and wrap in HttpOperationException
- Catch ApiException and wrap in HttpOperationException
- Catch TranscriptNotCompletedStatusException and wrap in KernelException
- Move JSON stub responses to files
Copy link
Member

@RogerBarreto RogerBarreto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small comments, getting close to merge.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This service can be dropped, as we did for the OpenAIFIleService, since they have an SDK for file management, and this is not related to an AIService, suggest recommending usage of the SDK client directly

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, that makes sense!

@@ -30,7 +31,7 @@
<PackageVersion Include="Microsoft.Bcl.TimeProvider" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageVersion Include="Microsoft.Identity.Client" Version="4.64.0" />
<PackageVersion Include="Microsoft.ML.OnnxRuntime" Version="1.19.2" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert those unrelated changes.

@RogerBarreto
Copy link
Member

Fix small format issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants