mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-11 06:08:19 +00:00
Moved all extension methods into extension blocks (#1155)
This commit is contained in:
1 parent
acc7d09fa2
commit
c0a75f39ac
138 files changed
+5884
-4954
No files matched your search
@@ -4,22 +4,25 @@ namespace AIStudio.Provider.OpenAI;
|
||||
|
||||
public static class SystemPromptRoleExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Spells a system prompt role the way OpenAI's APIs expect it.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A role no rule states becomes "developer". OpenAI's current documentation names no other, a
|
||||
/// model the rules do not know is almost always one released after they were written, and the
|
||||
/// older generations which still want "system" say so in their families.
|
||||
/// </remarks>
|
||||
/// <param name="role">The role the model profile states.</param>
|
||||
/// <returns>The role, as OpenAI names it.</returns>
|
||||
public static string ToOpenAIRole(this SystemPromptRole role) => role switch
|
||||
extension(SystemPromptRole role)
|
||||
{
|
||||
SystemPromptRole.SYSTEM => "system",
|
||||
SystemPromptRole.DEVELOPER => "developer",
|
||||
SystemPromptRole.USER => "user",
|
||||
/// <summary>
|
||||
/// Spells a system prompt role the way OpenAI's APIs expect it.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A role no rule states becomes "developer". OpenAI's current documentation names no other, a
|
||||
/// model the rules do not know is almost always one released after they were written, and the
|
||||
/// older generations which still want "system" say so in their families.
|
||||
/// </remarks>
|
||||
/// <returns>The role, as OpenAI names it.</returns>
|
||||
public string ToOpenAIRole() => role switch
|
||||
{
|
||||
SystemPromptRole.SYSTEM => "system",
|
||||
SystemPromptRole.DEVELOPER => "developer",
|
||||
SystemPromptRole.USER => "user",
|
||||
|
||||
_ => "developer",
|
||||
};
|
||||
_ => "developer",
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user