Class OAIExtensions
- Namespace
- Uralstech.UAI.Abstraction.Providers.OAI
Extensions to convert between generic and OpenAI types.
public static class OAIExtensions
- Inheritance
-
objectOAIExtensions
Methods
ToGeneric(Message)
Converts an OpenAI message to a generic message.
public static Message ToGeneric(this OpenAI.Chat.Message message)
Parameters
message
Message
Returns
ToGeneric(Role)
Converts an OpenAI role to a generic role.
public static Role ToGeneric(this OpenAI.Role role)
Parameters
role
Role
Returns
Exceptions
- NotImplementedException
Thrown if a OpenAI role has no known generic equivalent.
ToGeneric(Usage)
Converts an OpenAI function to a generic function.
public static Usage ToGeneric(this OpenAI.Usage usage)
Parameters
usage
Usage
Returns
ToGeneric(IReadOnlyList<Message>)
Converts a collection of OpenAI messages to an array of generic messages.
public static Message[] ToGeneric(this IReadOnlyList<OpenAI.Chat.Message> messages)
Parameters
messages
IReadOnlyList<OpenAI.Chat.Message>
Returns
- Message[]
ToOAI(IReadOnlyList<Message>)
Converts a collection of generic messages to an array of OpenAI messages.
public static OpenAI.Chat.Message[] ToOAI(this IReadOnlyList<Message> messages)
Parameters
messages
IReadOnlyList<Message>
Returns
- Message[]
ToOAI(IReadOnlyList<Function>)
Converts a collection of generic functions to an array of OpenAI.Tools.
public static OpenAI.Tool[] ToOAI(this IReadOnlyList<Function> functions)
Parameters
functions
IReadOnlyList<Function>
Returns
- Tool[]
ToOAI(Message)
Converts a generic message to an OpenAI message.
public static OpenAI.Chat.Message ToOAI(this Message message)
Parameters
message
Message
Returns
- Message
ToOAI(Role)
Converts a generic role to an OpenAI role.
public static OpenAI.Role ToOAI(this Role role)
Parameters
role
Role
Returns
- Role
Exceptions
- NotImplementedException
Thrown if a generic role has no known OpenAI equivalent.
ToOAI(Function)
Converts a generic function to an OpenAI function.
public static OpenAI.Function ToOAI(this Function function)
Parameters
function
Function
Returns
- Function
Exceptions
- NotImplementedException
Thrown if a generic ParameterType has no known OpenAI equivalent.