You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.Net Fix - OpenAIFilePurpose definitions and handling for OpenAIFileService (#6858)
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
1. Why is this change required?
2. What problem does it solve?
3. What scenario does it contribute to?
4. If it fixes an open issue, please link to the issue here.
-->
File-purpose values othen than `assistants` and `fine-tune` result in
exception.
### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
1. Converted `enum` to string based `struct` as enum too brittle to
handle file-purpose values and new purposes are introduced.
2. Updated test to actually utilize the file-service.
3. Centralized capture of content uri and file-reference id (as
metadata)
4. Support filtering on specific file-purpose (`GetFilesAsync`)
5. Added integration test
https://platform.openai.com/docs/api-reference/files/create#files-create-purposehttps://platform.openai.com/docs/api-reference/files/object#files/object-purpose
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [X] The code builds clean without any errors or warnings
- [X] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [X] All unit tests pass, and I have added new tests where possible
- [X] I didn't break anyone 😄
@@ -147,9 +153,19 @@ public async Task<OpenAIFileReference> GetFileAsync(string id, CancellationToken
147
153
/// </summary>
148
154
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
149
155
/// <returns>The metadata of all uploaded files.</returns>
/// Retrieve metadata for previously uploaded files
161
+
/// </summary>
162
+
/// <param name="filePurpose">The purpose of the files by which to filter.</param>
163
+
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
164
+
/// <returns>The metadata of all uploaded files.</returns>
0 commit comments