openai/openai-dotnet

Public

mirrored from https://github.com/openai/openai-dotnetAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.0.0-beta.1

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/Custom/Files/Internal/InternalFileUploadOptions.cs

42lines · modeblame

9f9f2936Jose Arriaga Maldonado2 years ago1using System.IO;
2
3namespace OpenAI.Files;
4
5[CodeGenModel("CreateFileRequest")]
6[CodeGenSuppress("InternalFileUploadOptions", typeof(Stream), typeof(FileUploadPurpose))]
7internal partial class InternalFileUploadOptions
8{
9// CUSTOM:
10// - Made internal. This value comes from a parameter on the client method.
11// - Added setter.
12/// <summary> The file object (not file name) to be uploaded. </summary>
13internal Stream File { get; set; }
14
15// CUSTOM:
16// - Made internal. This value comes from a parameter on the client method.
17// - Added setter.
18/// <summary>
19/// The intended purpose of the uploaded file. Use "fine-tune" for
20/// [Fine-tuning](/docs/api-reference/fine-tuning) and "assistants" for
21/// [Assistants](/docs/api-reference/assistants) and [Messages](/docs/api-reference/messages). This
22/// allows us to validate the format of the uploaded file is correct for fine-tuning.
23/// </summary>
24internal FileUploadPurpose Purpose { get; set; }
25
26// CUSTOM: Made public now that there are no required properties.
27/// <summary> Initializes a new instance of <see cref="InternalFileUploadOptions"/> for deserialization. </summary>
28public InternalFileUploadOptions()
29{
30}
31
32internal MultipartFormDataBinaryContent ToMultipartContent(Stream file, string filename)
33{
34MultipartFormDataBinaryContent content = new();
35
36content.Add(file, "file", filename);
37
38content.Add(Purpose.ToString(), "purpose");
39
40return content;
41}
42}