openai/openai-dotnet

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.2.0-beta.1

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/Custom/Chat/Messages/SystemChatMessage.cs

59lines · modecode

1using System.Collections.Generic;
2
3namespace OpenAI.Chat;
4
5/// <summary>
6/// Represents a chat message of the <c>system</c> role as supplied to a chat completion request. A system message is
7/// generally supplied as the first message to a chat completion request and guides the model's behavior across future
8/// <c>assistant</c> role response messages. These messages may help control behavior, style, tone, and
9/// restrictions for a model-based assistant. Developer messages replace system messages for o1 models and newer.
10/// </summary>
11[CodeGenModel("ChatCompletionRequestSystemMessage")]
12[CodeGenSuppress("SystemChatMessage", typeof(ChatMessageContent))]
13public partial class SystemChatMessage : ChatMessage
14{
15 /// <summary>
16 /// Creates a new instance of <see cref="SystemChatMessage"/> using a collection of content items.
17 /// For <c>system</c> messages, these can only be of type <c>text</c>.
18 /// </summary>
19 /// <param name="contentParts">
20 /// The collection of content items associated with the message.
21 /// </param>
22 public SystemChatMessage(IEnumerable<ChatMessageContentPart> contentParts)
23 : base(ChatMessageRole.System, contentParts)
24 { }
25
26 /// <summary>
27 /// Creates a new instance of <see cref="SystemChatMessage"/> using a collection of content items.
28 /// For <c>system</c> messages, these can only be of type <c>text</c>.
29 /// </summary>
30 /// <param name="contentParts">
31 /// The collection of content items associated with the message.
32 /// </param>
33 public SystemChatMessage(params ChatMessageContentPart[] contentParts)
34 : base(ChatMessageRole.System, contentParts)
35 {
36 Argument.AssertNotNullOrEmpty(contentParts, nameof(contentParts));
37 }
38
39 /// <summary>
40 /// Creates a new instance of <see cref="SystemChatMessage"/> with a single item of text content.
41 /// </summary>
42 /// <param name="content"> The text content of the message. </param>
43 public SystemChatMessage(string content)
44 : base(ChatMessageRole.System, content)
45 {
46 Argument.AssertNotNull(content, nameof(content));
47 }
48
49 // CUSTOM: Hide the default constructor.
50 internal SystemChatMessage()
51 {
52 }
53
54 /// <summary>
55 /// An optional <c>name</c> for the participant.
56 /// </summary>
57 [CodeGenMember("Name")]
58 public string ParticipantName { get; set; }
59}