-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ModelFactory] Implemented Files, Models, and Moderations factories
- Loading branch information
1 parent
32bfd2b
commit 0c0c30c
Showing
10 changed files
with
1,037 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace OpenAI.Files; | ||
|
||
/// <summary> Model factory for models. </summary> | ||
public static partial class OpenAIFilesModelFactory | ||
{ | ||
/// <summary> Initializes a new instance of <see cref="OpenAI.Files.OpenAIFileInfo"/>. </summary> | ||
/// <returns> A new <see cref="OpenAI.Files.OpenAIFileInfo"/> instance for mocking. </returns> | ||
public static OpenAIFileInfo OpenAIFileInfo(string id = null, long? sizeInBytes = null, DateTimeOffset createdAt = default, string filename = null, OpenAIFilePurpose purpose = default, OpenAIFileStatus status = default, string statusDetails = null) | ||
{ | ||
return new OpenAIFileInfo( | ||
id, | ||
sizeInBytes, | ||
createdAt, | ||
filename, | ||
@object: InternalOpenAIFileObject.File, | ||
purpose, | ||
status, | ||
statusDetails, | ||
serializedAdditionalRawData: null); | ||
} | ||
|
||
/// <summary> Initializes a new instance of <see cref="OpenAI.Files.OpenAIFileInfoCollection"/>. </summary> | ||
/// <returns> A new <see cref="OpenAI.Files.OpenAIFileInfoCollection"/> instance for mocking. </returns> | ||
public static OpenAIFileInfoCollection OpenAIFileInfoCollection(IEnumerable<OpenAIFileInfo> items = null) | ||
{ | ||
items ??= new List<OpenAIFileInfo>(); | ||
|
||
return new OpenAIFileInfoCollection( | ||
items.ToList(), | ||
InternalListFilesResponseObject.List, | ||
serializedAdditionalRawData: null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace OpenAI.Models; | ||
|
||
/// <summary> Model factory for models. </summary> | ||
public static partial class OpenAIModelsModelFactory | ||
{ | ||
/// <summary> Initializes a new instance of <see cref="OpenAI.Models.OpenAIModelInfo"/>. </summary> | ||
/// <returns> A new <see cref="OpenAI.Models.OpenAIModelInfo"/> instance for mocking. </returns> | ||
public static OpenAIModelInfo OpenAIModelInfo(string id = null, DateTimeOffset createdAt = default, string ownedBy = null) | ||
{ | ||
return new OpenAIModelInfo( | ||
id, | ||
createdAt, | ||
InternalModelObject.Model, | ||
ownedBy, | ||
serializedAdditionalRawData: null); | ||
} | ||
|
||
/// <summary> Initializes a new instance of <see cref="OpenAI.Models.OpenAIModelInfoCollection"/>. </summary> | ||
/// <returns> A new <see cref="OpenAI.Models.OpenAIModelInfoCollection"/> instance for mocking. </returns> | ||
public static OpenAIModelInfoCollection OpenAIModelInfoCollection(IEnumerable<OpenAIModelInfo> items = null) | ||
{ | ||
items ??= new List<OpenAIModelInfo>(); | ||
|
||
return new OpenAIModelInfoCollection( | ||
InternalListModelsResponseObject.List, | ||
items.ToList(), | ||
serializedAdditionalRawData: null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace OpenAI.Moderations; | ||
|
||
/// <summary> Model factory for models. </summary> | ||
public static partial class OpenAIModerationsModelFactory | ||
{ | ||
/// <summary> Initializes a new instance of <see cref="OpenAI.Moderations.ModerationCategories"/>. </summary> | ||
/// <returns> A new <see cref="OpenAI.Moderations.ModerationCategories"/> instance for mocking. </returns> | ||
public static ModerationCategories ModerationCategories(bool hate = default, bool hateThreatening = default, bool harassment = default, bool harassmentThreatening = default, bool selfHarm = default, bool selfHarmIntent = default, bool selfHarmInstructions = default, bool sexual = default, bool sexualMinors = default, bool violence = default, bool violenceGraphic = default) | ||
{ | ||
return new ModerationCategories( | ||
hate, | ||
hateThreatening, | ||
harassment, | ||
harassmentThreatening, | ||
selfHarm, | ||
selfHarmIntent, | ||
selfHarmInstructions, | ||
sexual, | ||
sexualMinors, | ||
violence, | ||
violenceGraphic, | ||
serializedAdditionalRawData: null); | ||
} | ||
|
||
/// <summary> Initializes a new instance of <see cref="OpenAI.Moderations.ModerationCategoryScores"/>. </summary> | ||
/// <returns> A new <see cref="OpenAI.Moderations.ModerationCategoryScores"/> instance for mocking. </returns> | ||
public static ModerationCategoryScores ModerationCategoryScores(float hate = default, float hateThreatening = default, float harassment = default, float harassmentThreatening = default, float selfHarm = default, float selfHarmIntent = default, float selfHarmInstructions = default, float sexual = default, float sexualMinors = default, float violence = default, float violenceGraphic = default) | ||
{ | ||
return new ModerationCategoryScores( | ||
hate, | ||
hateThreatening, | ||
harassment, | ||
harassmentThreatening, | ||
selfHarm, | ||
selfHarmIntent, | ||
selfHarmInstructions, | ||
sexual, | ||
sexualMinors, | ||
violence, | ||
violenceGraphic, | ||
serializedAdditionalRawData: null); | ||
} | ||
|
||
/// <summary> Initializes a new instance of <see cref="OpenAI.Moderations.ModerationCollection"/>. </summary> | ||
/// <returns> A new <see cref="OpenAI.Moderations.ModerationCollection"/> instance for mocking. </returns> | ||
public static ModerationCollection ModerationCollection(string id = null, string model = null, IEnumerable<ModerationResult> items = null) | ||
{ | ||
items ??= new List<ModerationResult>(); | ||
|
||
return new ModerationCollection( | ||
id, | ||
model, | ||
items.ToList(), | ||
serializedAdditionalRawData: null); | ||
} | ||
|
||
/// <summary> Initializes a new instance of <see cref="OpenAI.Moderations.ModerationResult"/>. </summary> | ||
/// <returns> A new <see cref="OpenAI.Moderations.ModerationResult"/> instance for mocking. </returns> | ||
public static ModerationResult ModerationResult(bool flagged = default, ModerationCategories categories = null, ModerationCategoryScores categoryScores = null) | ||
{ | ||
return new ModerationResult( | ||
flagged, | ||
categories, | ||
categoryScores, | ||
serializedAdditionalRawData: null); | ||
} | ||
} |
Oops, something went wrong.