Class ChatCompletionRequestBase<TSelf, TPrompt, TOutput>
- Namespace
- Glitch9.AIDevKit.ChatCompletions
Task for generating text using an LLM model. Supports instructions and role-based prompts.
public abstract class ChatCompletionRequestBase<TSelf, TPrompt, TOutput> : LanguageModelRequest<TSelf, TPrompt, TOutput>, ILanguageModelRequest, IGenerativeRequest, ISequentialRequest where TSelf : ChatCompletionRequestBase<TSelf, TPrompt, TOutput> where TPrompt : IPrompt where TOutput : IGeneratedOutput
Type Parameters
TSelfTPromptTOutput
- Inheritance
-
objectFluentApiRequest<TSelf, TOutput>LanguageModelRequest<TSelf, TPrompt, TOutput>ChatCompletionRequestBase<TSelf, TPrompt, TOutput>
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ChatCompletionRequestBase()
protected ChatCompletionRequestBase()
ChatCompletionRequestBase(TPrompt)
protected ChatCompletionRequestBase(TPrompt prompt)
Parameters
promptTPrompt
Properties
Messages
Context messages for chat-based models.
public List<Message> Messages { get; set; }
Property Value
- List<Message>
OutputModalities
For multi-modal models, specifies the desired output modalities (e.g., text, image, audio).
Note: Not all providers support this parameter. Check your provider's documentation for details.
public Modalities? OutputModalities { get; set; }
Property Value
Stop
Stop sequences for text generation.
Note: Responses API does not support this parameter.
public List<string> Stop { get; set; }
Property Value
- List<string>
Methods
AddMessageRange(IEnumerable<Message>)
public override TSelf AddMessageRange(IEnumerable<Message> messages)
Parameters
messagesIEnumerable<Message>
Returns
- TSelf
CreateStreamAsyncInternal()
protected override UniTask<IO.Networking.RESTApi.IRESTStream<INoopStreamEvent<TOutput>>> CreateStreamAsyncInternal()
Returns
- UniTask<IRESTStream<INoopStreamEvent<TOutput>>>
GetMessages()
public override List<Message> GetMessages()
Returns
- List<Message>
SetOutputModalities(Modalities)
Sets the desired output modalities for multi-modal models (e.g., text, image, audio). Note: Not all providers support this parameter. Check your provider's documentation for details.
public TSelf SetOutputModalities(Modalities modalities)
Parameters
modalitiesModalities
Returns
- TSelf
SetResponseFormat(ResponseFormat)
Sets the desired response format for the output.
Auto: Model decides the best format.Text: Plain text output.JsonObject: Structured JSON output.
public TSelf SetResponseFormat(ResponseFormat format)
Parameters
formatResponseFormat
Returns
- TSelf
SetResponseFormat(Type)
Sets the desired response format using a type annotated with JsonSchemaAttribute or StrictJsonSchemaAttribute. The type's structure will be converted into a JSON schema for the model to follow.
public TSelf SetResponseFormat(Type type)
Parameters
typeType
Returns
- TSelf
SetStopSequences(params string[])
Sets the stop sequences for text generation.
Note: Responses API does not support this parameter.
public TSelf SetStopSequences(params string[] stop)
Parameters
stopstring[]
Returns
- TSelf