-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
base: feature-connectors-assemblyai
Are you sure you want to change the base?
.Net: Refactor AssemblyAI connector to use AssemblyAI SDK #8556
Conversation
There was a problem hiding this 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 :)
...src/Connectors/Connectors.AssemblyAI.UnitTests/Services/AssemblyAIAudioToTextServiceTests.cs
Outdated
Show resolved
Hide resolved
...src/Connectors/Connectors.AssemblyAI.UnitTests/Services/AssemblyAIAudioToTextServiceTests.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Connectors/Connectors.AssemblyAI/AssemblyAIAudioToTextExecutionSettings.cs
Outdated
Show resolved
Hide resolved
this._pollingTimeout = value; | ||
} | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override PromptExecutionSettings Clone() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
dotnet/src/Connectors/Connectors.AssemblyAI/AssemblyAIClientFactory.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Connectors/Connectors.AssemblyAI/AssemblyAIServiceCollectionExtensions.cs
Outdated
Show resolved
Hide resolved
@@ -57,17 +53,27 @@ public async Task<IReadOnlyList<TextContent>> GetTextContentsAsync( | |||
{ | |||
Verify.NotNull(content); | |||
|
|||
if (executionSettings?.ExtensionData is not null && executionSettings.ExtensionData.Count > 0) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
dotnet/src/IntegrationTests/Connectors/AssemblyAI/AssemblyAIFilesTests.cs
Outdated
Show resolved
Hide resolved
- 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
There was a problem hiding this 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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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!
dotnet/Directory.Packages.props
Outdated
@@ -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" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert those unrelated changes.
Fix small format issues. |
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