diff --git a/.gitignore b/.gitignore index 009742c..79781ad 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,7 @@ scratch.txt # Codex CLI generated state **/.codex/ + +src/samples/01.DiscordAgent/Properties/ +data/discord-chat.ndjson + diff --git a/data/discord-chat.ndjson b/data/discord-chat.ndjson new file mode 100644 index 0000000..57a6197 --- /dev/null +++ b/data/discord-chat.ndjson @@ -0,0 +1,46 @@ +{"schemaVersion":"1","position":1,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":1,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":1,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":2,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":1,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":2,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":1,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":1,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":1,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":1,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":1,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":2,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":1,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":2,"entry":{"$type":"ChatEfferentDraft","text":"Yes\u2014loud and clear! I can see your message and everything\u2019s working. What would you like to do next?","sender":"BOT"}} +{"schemaVersion":"1","position":3,"entry":{"$type":"ChatChunk","text":"Yes\u2014loud and clear! I can see your message and everything\u2019s working. What would you like to do next?","sender":"BOT"}} +{"schemaVersion":"1","position":4,"entry":{"$type":"ChatStreamCompleted","sender":"BOT"}} +{"schemaVersion":"1","position":5,"entry":{"$type":"ChatEfferent","text":"Yes\u2014loud and clear! I can see your message and everything\u2019s working. What would you like to do next?","sender":"BOT"}} +{"schemaVersion":"1","position":1,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":2,"entry":{"$type":"ChatEfferentDraft","text":"Yes\u2014it\u0027s working. I can see your message. How can I help?","sender":"BOT"}} +{"schemaVersion":"1","position":3,"entry":{"$type":"ChatChunk","text":"Yes\u2014it\u0027s working. I can see your message. How can I help?","sender":"BOT"}} +{"schemaVersion":"1","position":4,"entry":{"$type":"ChatStreamCompleted","sender":"BOT"}} +{"schemaVersion":"1","position":5,"entry":{"$type":"ChatEfferent","text":"Yes\u2014it\u0027s working. I can see your message. How can I help?","sender":"BOT"}} +{"schemaVersion":"1","position":6,"entry":{"$type":"ChatAck","position":2,"sender":"BOT"}} +{"schemaVersion":"1","position":1,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":2,"entry":{"$type":"ChatEfferentDraft","text":"Yes\u2014loud and clear, hunts135. I can see your message and reply here. What would you like to do next?","sender":"BOT"}} +{"schemaVersion":"1","position":3,"entry":{"$type":"ChatChunk","text":"Yes\u2014loud and clear, hunts135. I can see your message and reply here. What would you like to do next?","sender":"BOT"}} +{"schemaVersion":"1","position":4,"entry":{"$type":"ChatStreamCompleted","sender":"BOT"}} +{"schemaVersion":"1","position":5,"entry":{"$type":"ChatEfferent","text":"Yes\u2014loud and clear, hunts135. I can see your message and reply here. What would you like to do next?","sender":"BOT"}} +{"schemaVersion":"1","position":1,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":2,"entry":{"$type":"ChatEfferentDraft","text":"Yes\u2014your message came through. I can see you, hunts135. How can I help?","sender":"BOT"}} +{"schemaVersion":"1","position":3,"entry":{"$type":"ChatChunk","text":"Yes\u2014your message came through. I can see you, hunts135. How can I help?","sender":"BOT"}} +{"schemaVersion":"1","position":4,"entry":{"$type":"ChatStreamCompleted","sender":"BOT"}} +{"schemaVersion":"1","position":5,"entry":{"$type":"ChatEfferent","text":"Yes\u2014your message came through. I can see you, hunts135. How can I help?","sender":"BOT"}} +{"schemaVersion":"1","position":6,"entry":{"$type":"ChatAck","position":2,"sender":"BOT"}} +{"schemaVersion":"1","position":1,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":2,"entry":{"$type":"ChatEfferentDraft","text":"Yes\u2014got your message, hunts135. I\u2019m here and responsive. How can I help?","sender":"BOT"}} +{"schemaVersion":"1","position":3,"entry":{"$type":"ChatChunk","text":"Yes\u2014got your message, hunts135. I\u2019m here and responsive. How can I help?","sender":"BOT"}} +{"schemaVersion":"1","position":4,"entry":{"$type":"ChatStreamCompleted","sender":"BOT"}} +{"schemaVersion":"1","position":5,"entry":{"$type":"ChatEfferent","text":"Yes\u2014got your message, hunts135. I\u2019m here and responsive. How can I help?","sender":"BOT"}} +{"schemaVersion":"1","position":6,"entry":{"$type":"ChatAck","position":2,"sender":"BOT"}} +{"schemaVersion":"1","position":1,"entry":{"$type":"ChatAfferent","text":"Is this working?","sender":"hunts135"}} +{"schemaVersion":"1","position":2,"entry":{"$type":"ChatEfferentDraft","text":"Yes\u2014I can see your message, hunts135. Looks like everything\u2019s working. How can I help?","sender":"BOT"}} +{"schemaVersion":"1","position":3,"entry":{"$type":"ChatChunk","text":"Yes\u2014I can see your message, hunts135. Looks like everything\u2019s working. How can I help?","sender":"BOT"}} +{"schemaVersion":"1","position":4,"entry":{"$type":"ChatStreamCompleted","sender":"BOT"}} +{"schemaVersion":"1","position":5,"entry":{"$type":"ChatEfferent","text":"Yes\u2014I can see your message, hunts135. Looks like everything\u2019s working. How can I help?","sender":"BOT"}} +{"schemaVersion":"1","position":6,"entry":{"$type":"ChatAck","position":2,"sender":"BOT"}} diff --git a/src/Coven.Agents.OpenAI/OpenAIClientConfig.cs b/src/Coven.Agents.OpenAI/OpenAIClientConfig.cs index 81bfd6e..ed27bba 100644 --- a/src/Coven.Agents.OpenAI/OpenAIClientConfig.cs +++ b/src/Coven.Agents.OpenAI/OpenAIClientConfig.cs @@ -43,12 +43,12 @@ public sealed record OpenAIClientConfig public int? MaxOutputTokens { get; init; } /// - /// Max number of transcript items to include; defaults to unlimited. + /// Configures reasoning options for models that support it. /// - public int HistoryClip { get; init; } = int.MaxValue; + public ReasoningConfig? Reasoning { get; init; } /// - /// Configures reasoning options for models that support it. + /// Max number of transcript items to include; defaults to unlimited. /// - public ReasoningConfig Reasoning { get; init; } = new ReasoningConfig(); + public int HistoryClip { get; init; } = int.MaxValue; } diff --git a/src/Coven.Agents.OpenAI/OpenAIResponseOptionsTransmuter.cs b/src/Coven.Agents.OpenAI/OpenAIResponseOptionsTransmuter.cs index a295dff..f82d4a2 100644 --- a/src/Coven.Agents.OpenAI/OpenAIResponseOptionsTransmuter.cs +++ b/src/Coven.Agents.OpenAI/OpenAIResponseOptionsTransmuter.cs @@ -21,7 +21,7 @@ public Task Transmute(OpenAIClientConfig Input, Cancell if (Input.Reasoning is not null) { - options.ReasoningOptions = new ResponseReasoningOptions() + ResponseReasoningOptions reasoning = new() { ReasoningEffortLevel = Input.Reasoning.Effort switch { @@ -29,15 +29,21 @@ public Task Transmute(OpenAIClientConfig Input, Cancell ReasoningEffort.Medium => ResponseReasoningEffortLevel.Medium, ReasoningEffort.High => ResponseReasoningEffortLevel.High, _ => null - }, - ReasoningSummaryVerbosity = Input.Reasoning.SummaryVerbosity switch + } + }; + + if (Input.Reasoning.IncludeSummary) + { + reasoning.ReasoningSummaryVerbosity = Input.Reasoning.SummaryVerbosity switch { ReasoningSummaryVerbosity.Auto => ResponseReasoningSummaryVerbosity.Auto, ReasoningSummaryVerbosity.Detailed => ResponseReasoningSummaryVerbosity.Detailed, ReasoningSummaryVerbosity.Concise => ResponseReasoningSummaryVerbosity.Concise, _ => null - } - }; + }; + } + + options.ReasoningOptions = reasoning; } return Task.FromResult(options); diff --git a/src/Coven.Agents.OpenAI/ReasoningConfig.cs b/src/Coven.Agents.OpenAI/ReasoningConfig.cs index 190a4a9..72dc565 100644 --- a/src/Coven.Agents.OpenAI/ReasoningConfig.cs +++ b/src/Coven.Agents.OpenAI/ReasoningConfig.cs @@ -16,4 +16,9 @@ public sealed class ReasoningConfig /// Controls verbosity of returned reasoning summaries. /// public ReasoningSummaryVerbosity SummaryVerbosity { get; init; } = ReasoningSummaryVerbosity.Auto; + + /// + /// Whether to request reasoning summaries. Defaults to false. + /// + public bool IncludeSummary { get; init; } } diff --git a/src/samples/01.DiscordAgent/DiscordAgent.csproj b/src/samples/01.DiscordAgent/DiscordAgent.csproj index 304d2f2..00fc786 100644 --- a/src/samples/01.DiscordAgent/DiscordAgent.csproj +++ b/src/samples/01.DiscordAgent/DiscordAgent.csproj @@ -26,8 +26,4 @@ - - - - diff --git a/src/samples/01.DiscordAgent/Program.cs b/src/samples/01.DiscordAgent/Program.cs index 1937321..235b320 100644 --- a/src/samples/01.DiscordAgent/Program.cs +++ b/src/samples/01.DiscordAgent/Program.cs @@ -43,7 +43,13 @@ OpenAIClientConfig openAiConfig = new() { ApiKey = string.IsNullOrWhiteSpace(envOpenAiApiKey) ? defaultOpenAiApiKey : envOpenAiApiKey, - Model = string.IsNullOrWhiteSpace(envOpenAiModel) ? defaultOpenAiModel : envOpenAiModel + Model = string.IsNullOrWhiteSpace(envOpenAiModel) ? defaultOpenAiModel : envOpenAiModel, + Reasoning = new ReasoningConfig + { + Effort = ReasoningEffort.High, // or Medium/Low + IncludeSummary = true, // optional; default false + SummaryVerbosity = ReasoningSummaryVerbosity.Detailed + } }; // Register DI