diff --git a/src/Custom/Chat/ChatClient.cs b/src/Custom/Chat/ChatClient.cs index 3c2141922..1a6521ae6 100644 --- a/src/Custom/Chat/ChatClient.cs +++ b/src/Custom/Chat/ChatClient.cs @@ -151,12 +151,12 @@ internal async Task> CompleteChatAsync(IEnumerable< } options ??= new(); - CreateChatCompletionOptions(messages, ref options); - using OpenTelemetryScope scope = _telemetry.StartChatScope(options); + var clonedOptions = CreateChatCompletionOptions(messages, options); + using OpenTelemetryScope scope = _telemetry.StartChatScope(clonedOptions); try { - using BinaryContent content = options.ToBinaryContent(); + using BinaryContent content = clonedOptions.ToBinaryContent(); ClientResult result = await CompleteChatAsync(content, requestOptions).ConfigureAwait(false); ChatCompletion chatCompletion = (ChatCompletion)result; @@ -181,12 +181,12 @@ public virtual ClientResult CompleteChat(IEnumerable CompleteChatStream } options ??= new(); - CreateChatCompletionOptions(messages, ref options, stream: true); + var clonedOptions = CreateChatCompletionOptions(messages, options, stream: true); - using BinaryContent content = options.ToBinaryContent(); + using BinaryContent content = clonedOptions.ToBinaryContent(); return new AsyncSseUpdateCollection( async () => await CompleteChatAsync(content, requestOptions).ConfigureAwait(false), StreamingChatCompletionUpdate.DeserializeStreamingChatCompletionUpdate, @@ -269,9 +269,9 @@ public virtual CollectionResult CompleteChatStrea Argument.AssertNotNull(messages, nameof(messages)); options ??= new(); - CreateChatCompletionOptions(messages, ref options, stream: true); + var clonedOptions = CreateChatCompletionOptions(messages, options, stream: true); - using BinaryContent content = options.ToBinaryContent(); + using BinaryContent content = clonedOptions.ToBinaryContent(); return new SseUpdateCollection( () => CompleteChat(content, cancellationToken.ToRequestOptions(streaming: true)), StreamingChatCompletionUpdate.DeserializeStreamingChatCompletionUpdate, @@ -380,19 +380,24 @@ public virtual ClientResult DeleteChatCompletion(s return ClientResult.FromValue((ChatCompletionDeletionResult)result, result.GetRawResponse()); } - private void CreateChatCompletionOptions(IEnumerable messages, ref ChatCompletionOptions options, bool stream = false) + private ChatCompletionOptions CreateChatCompletionOptions(IEnumerable messages, ChatCompletionOptions options, bool stream = false) { - options.Messages = messages.ToList(); - options.Model = _model; + var clonedOptions = options.Clone(); + foreach (var message in messages) + { + clonedOptions.Messages.Add(message); + } + clonedOptions.Model ??= _model; if (stream) { - options.Stream = true; - options.StreamOptions = s_includeUsageStreamOptions; + clonedOptions.Stream = true; + clonedOptions.StreamOptions = s_includeUsageStreamOptions; } else { - options.Stream = null; - options.StreamOptions = null; + clonedOptions.Stream = null; + clonedOptions.StreamOptions = null; } + return clonedOptions; } } \ No newline at end of file diff --git a/src/Custom/Chat/ChatCompletionOptions.cs b/src/Custom/Chat/ChatCompletionOptions.cs index e26535383..4e34c1b1e 100644 --- a/src/Custom/Chat/ChatCompletionOptions.cs +++ b/src/Custom/Chat/ChatCompletionOptions.cs @@ -4,6 +4,7 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using System.Linq; using System.Threading; namespace OpenAI.Chat; @@ -215,4 +216,44 @@ public ChatResponseModalities ResponseModalities public ChatOutputPrediction OutputPrediction { get; set; } internal BinaryContent ToBinaryContent() => BinaryContent.Create(this, ModelSerializationExtensions.WireOptions); + + internal ChatCompletionOptions Clone() + { + // Copy the values of the properties to a new instance of ChatCompletionOptions. For collection properties, create a new list and add the items from the original list. + var clone = new ChatCompletionOptions(); + clone.Model = Model; + clone.N = N; + clone.Stream = Stream; + clone.StreamOptions = StreamOptions; + clone.IncludeLogProbabilities = IncludeLogProbabilities; + clone.TopLogProbabilityCount = TopLogProbabilityCount; + foreach (var s in StopSequences) clone.StopSequences.Add(s); + foreach (var l in LogitBiases) clone.LogitBiases[l.Key] = l.Value; + clone.ToolChoice = ToolChoice; + clone.FunctionChoice = FunctionChoice; + clone.AllowParallelToolCalls = AllowParallelToolCalls; + clone.EndUserId = EndUserId; + clone._deprecatedMaxTokens = _deprecatedMaxTokens; + clone.MaxOutputTokenCount = MaxOutputTokenCount; + foreach (var f in Functions) clone.Functions.Add(f); + foreach (var m in Metadata) clone.Metadata[m.Key] = m.Value; + clone.StoredOutputEnabled = StoredOutputEnabled; + clone.ReasoningEffortLevel = ReasoningEffortLevel; + clone.InternalModalities = _internalModalities?.ToList(); + clone.ResponseModalities = _responseModalities; + clone.ResponseFormat = ResponseFormat; + clone.AudioOptions = AudioOptions; + clone.OutputPrediction = OutputPrediction; + clone.Messages = Messages?.Select(m => m).ToList(); + foreach (var t in Tools) clone.Tools.Add(t); + clone.Temperature = Temperature; + clone.TopP = TopP; + clone.SafetyIdentifier = SafetyIdentifier; + clone.ServiceTier = ServiceTier; + clone.FrequencyPenalty = FrequencyPenalty; + clone.PresencePenalty = PresencePenalty; + clone.WebSearchOptions = WebSearchOptions; + clone.Seed = Seed; + return clone; + } } diff --git a/tests/Chat/ChatTests.cs b/tests/Chat/ChatTests.cs index 4b2e532c7..da09b4aa4 100644 --- a/tests/Chat/ChatTests.cs +++ b/tests/Chat/ChatTests.cs @@ -1040,6 +1040,36 @@ public async Task CompleteChatStreamingClosesNetworkStream() Assert.That(response.IsDisposed); } + [RecordedTest] + public async Task ValidateConcurrency() + { + ChatClient client = GetTestClient(); + ChatCompletionOptions _options = new() + { + Temperature = 0, + }; + IReadOnlyList _messages = + [ + "2 + 4 = ?", + "3 + 5 = ?", + "4 + 6 = ?", + ]; + List responses = []; + + await Parallel.ForEachAsync(_messages, async (message, cancellationToken) => + { + List messages = + [ + new UserChatMessage(message), + ]; + ChatCompletion completion = await client.CompleteChatAsync(messages, _options, cancellationToken); + responses.Add(completion.Content[0].Text); + Console.WriteLine($"Message: {message}, Response: {completion.Content[0].Text}"); + Assert.That(completion.Content[0].Text, Does.StartWith(message.Substring(0, 7))); + }); + Assert.That(responses, Has.Count.EqualTo(_messages.Count)); + } + [OneTimeTearDown] public void TearDown() { diff --git a/tests/SessionRecords/ChatTests/ChatServiceTierWorks.json b/tests/SessionRecords/ChatTests/ChatServiceTierWorks.json index 96c6baf8a..c13dc490e 100644 --- a/tests/SessionRecords/ChatTests/ChatServiceTierWorks.json +++ b/tests/SessionRecords/ChatTests/ChatServiceTierWorks.json @@ -8,7 +8,7 @@ "Authorization": "Sanitized", "Content-Length": "200", "Content-Type": "application/json", - "User-Agent": "OpenAI/2.4.0 (.NET 9.0.9; Microsoft Windows 10.0.26100)" + "User-Agent": "OpenAI/2.7.0 (.NET 9.0.10; Darwin 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:56 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8132)" }, "RequestBody": { "service_tier": "default", @@ -25,39 +25,43 @@ "Access-Control-Expose-Headers": "X-Request-ID", "Alt-Svc": "h3=\":443\"", "cf-cache-status": "DYNAMIC", - "CF-RAY": "9801cd4e9d7a98e5-SEA", + "CF-RAY": "9aad8e836ce369e2-DFW", "Connection": "keep-alive", - "Content-Length": "4163", + "Content-Length": "3717", "Content-Type": "application/json", - "Date": "Tue, 16 Sep 2025 16:40:07 GMT", + "Date": "Sanitized", "openai-organization": "Sanitized", - "openai-processing-ms": "18891", + "openai-processing-ms": "Sanitized", "openai-project": "Sanitized", "openai-version": "2020-10-01", "Server": "cloudflare", + "Set-Cookie": [ + "Sanitized", + "Sanitized" + ], "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "19052", + "x-envoy-upstream-service-time": "16330", "x-openai-proxy-wasm": "v0.1", "x-ratelimit-limit-requests": "30000", "x-ratelimit-limit-tokens": "150000000", "x-ratelimit-remaining-requests": "29999", - "x-ratelimit-remaining-tokens": "149999967", + "x-ratelimit-remaining-tokens": "149999970", "x-ratelimit-reset-requests": "2ms", "x-ratelimit-reset-tokens": "0s", "X-Request-ID": "Sanitized" }, "ResponseBody": { - "id": "chatcmpl-CGT0WemoYUYz07tLAhaWMFpV0kuOS", + "id": "chatcmpl-CkYAe42Mqhx2VsHDRXee94cQNpkqt", "object": "chat.completion", - "created": 1758040788, + "created": 1765210476, "model": "o3-mini-2025-01-31", "choices": [ { "index": 0, "message": { "role": "assistant", - "content": "During the 1970s and 1980s, science fiction in popular media overwhelmingly dealt with themes that not only entertained audiences but also reflected contemporary cultural and technological concerns. A comprehensive review of films, television shows, literature, and other media from that era highlights several recurring motifs:\n\n1. Space Exploration and Epic Space Opera \n\u2003• Movies such as Star Wars reinvigorated the idea of interstellar adventures, where vast, fantastical galaxies, heroic quests, and larger-than-life conflicts were central. \n\u2003• This era celebrated the mystery of the cosmos, using space as a canvas for exploring humanity’s hopes, fears, and the eternal quest for discovery.\n\n2. Alien Encounters and Extraterrestrial Life \n\u2003• Films like Close Encounters of the Third Kind and Alien brought to the forefront the question of “Are we alone?” and the possibilities (or threats) inherent in first contact with non-human intelligence. \n\u2003• These stories not only provided thrills and wonder but also served as metaphors for “the other” and fostered discussions about communication, difference, and even imperialism.\n\n3. Dystopian Futures and Post-Apocalyptic Narratives \n\u2003• The lingering anxieties of the Cold War, nuclear arms race, and environmental concerns found expression in stories portraying bleak, controlled, or ruined societies. \n\u2003• Movies such as Blade Runner (1982) explored urban decay, corporate dominance, and moral ambiguity, using dystopia as a way to question the cost of rapid technological and societal change.\n\n4. Artificial Intelligence, Robotics, and the Nature of Humanity \n\u2003• There was a growing fascination with the boundaries between human and machine—exemplified by robots, cyborgs, and artificial intelligences. \n\u2003• Works like The Terminator, along with literary works from the period, questioned the ethics of automation and artificial beings, asking what it truly means to be human in an age of technological marvels and potential threats.\n\n5. The Intersection of Technology and Identity \n\u2003• Many narratives used futuristic technology as a lens to examine personal identity, memory, and consciousness. \n\u2003• Issues of existential doubt, human enhancement, and the integration (or conflict) of man and machine became central themes, reflecting society’s hope for—and trepidation about—rapid technological progress.\n\n6. Political and Social Allegory \n\u2003• The era’s science fiction often doubled as a commentary on contemporary societal issues—ranging from Cold War paranoia and government surveillance to corporate greed and the erosion of individuality. \n\u2003• By projecting present-day dilemmas onto future or alternate realities, these works allowed audiences to confront complex ethical and political questions in a speculative context.\n\nIn summary, the sci-fi media of the 1970s and 1980s frequently navigated a landscape where the wonders of space, the terror of dystopian futures, the enigma of alien contact, and the profound questions about technology’s impact on society intersected. These themes resonated with audiences who were living through a time of rapid technological change and global uncertainty, making science fiction not just a form of escapism but also a mirror reflecting the pressing issues of its time.", + "content": "A review of popular media from the 1970s and 1980s reveals several recurring sci‑fi themes that reflected both a fascination with technology’s promise and a cautious awareness of its potential downsides. Here are some of the most common themes from that era:\n\n1. Space Exploration and Cosmic Adventure\n\u2003• Films like Star Wars (1977) and Close Encounters of the Third Kind (1977) sparked imaginations by envisioning vast, uncharted universes. This theme celebrated the wonder of interstellar travel, epic conflicts among empires, and the mystery of distant worlds.\n\n2. Dystopian Futures and the Dark Side of Technology\n\u2003• With the Cold War and the threat of nuclear annihilation looming large, many works—ranging from films such as A Clockwork Orange (1971) and Blade Runner (1982) to various literary works—explored futures marked by societal decay, oppressive regimes, and environmental collapse. These narratives questioned whether technological progress was leading humanity toward liberation or disaster.\n\n3. Artificial Intelligence and the Human–Machine Divide\n\u2003• The rise of computer technology and robotics inspired stories about what happens when our creations take on lives of their own. Films like The Terminator (1984) and Blade Runner (1982) introduced audiences to worlds where machines not only served humans but could someday challenge or even supplant them, raising questions about identity, consciousness, and ethical responsibility.\n\n4. Time Travel and Alternate Realities\n\u2003• Time travel emerged as a compelling narrative device in the 1980s with films such as Back to the Future (1985). This theme allowed storytellers to explore the consequences of altering history, the interconnectedness of past, present, and future, and the fluid nature of reality itself.\n\n5. Encounters with the Alien Other\n\u2003• Many narratives delved into first contact scenarios, where humanity encountered beings from beyond Earth. Whether portraying aliens as benevolent (as in E.T. the Extra-Terrestrial (1982)) or as existential threats (as in Alien (1979)), these stories used extraterrestrial encounters to reflect on human identity, fear of the unknown, and the limits of our understanding of life.\n\n6. Post-Apocalyptic Visions and Environmental Collapse\n\u2003• Reflecting societal anxieties about nuclear war and ecological disaster, works like Mad Max (1979) and its sequels presented stark visions of a world stripped of order and nature’s revenge. These stories often had an undercurrent of warning about unsustainable progress and the human cost of environmental neglect.\n\nTogether, these themes illustrate how 1970s and 1980s sci‑fi media were not merely about futuristic thrills but were also deeply engaged with contemporary issues—examining the promises and perils of technological advancement, the ethics of artificial intelligence, and the ever-present anxieties about societal collapse. They continue to influence the genre by reminding us that science fiction is as much a reflection of our current hopes and fears as it is a playground for imagining lives beyond the present.", "refusal": null, "annotations": [] }, @@ -66,21 +70,21 @@ ], "usage": { "prompt_tokens": 34, - "completion_tokens": 1610, - "total_tokens": 1644, + "completion_tokens": 1715, + "total_tokens": 1749, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 }, "completion_tokens_details": { - "reasoning_tokens": 960, + "reasoning_tokens": 1088, "audio_tokens": 0, "accepted_prediction_tokens": 0, "rejected_prediction_tokens": 0 } }, "service_tier": "default", - "system_fingerprint": "fp_6c43dcef8c" + "system_fingerprint": "Sanitized" } } ], diff --git a/tests/SessionRecords/ChatTests/ChatServiceTierWorksAsync.json b/tests/SessionRecords/ChatTests/ChatServiceTierWorksAsync.json index 118402efb..c1e4781f6 100644 --- a/tests/SessionRecords/ChatTests/ChatServiceTierWorksAsync.json +++ b/tests/SessionRecords/ChatTests/ChatServiceTierWorksAsync.json @@ -8,7 +8,7 @@ "Authorization": "Sanitized", "Content-Length": "200", "Content-Type": "application/json", - "User-Agent": "OpenAI/2.4.0 (.NET 9.0.9; Microsoft Windows 10.0.26100)" + "User-Agent": "OpenAI/2.7.0 (.NET 9.0.10; Darwin 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:56 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8132)" }, "RequestBody": { "service_tier": "default", @@ -25,39 +25,43 @@ "Access-Control-Expose-Headers": "X-Request-ID", "Alt-Svc": "h3=\":443\"", "cf-cache-status": "DYNAMIC", - "CF-RAY": "9801d16ab97998e5-SEA", + "CF-RAY": "9aad8d452a73e5bd-DFW", "Connection": "keep-alive", - "Content-Length": "4608", + "Content-Length": "4019", "Content-Type": "application/json", - "Date": "Tue, 16 Sep 2025 16:42:54 GMT", + "Date": "Sanitized", "openai-organization": "Sanitized", - "openai-processing-ms": "17394", + "openai-processing-ms": "Sanitized", "openai-project": "Sanitized", "openai-version": "2020-10-01", "Server": "cloudflare", + "Set-Cookie": [ + "Sanitized", + "Sanitized" + ], "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "17436", + "x-envoy-upstream-service-time": "13312", "x-openai-proxy-wasm": "v0.1", "x-ratelimit-limit-requests": "30000", "x-ratelimit-limit-tokens": "150000000", "x-ratelimit-remaining-requests": "29999", - "x-ratelimit-remaining-tokens": "149999970", + "x-ratelimit-remaining-tokens": "149999967", "x-ratelimit-reset-requests": "2ms", "x-ratelimit-reset-tokens": "0s", "X-Request-ID": "Sanitized" }, "ResponseBody": { - "id": "chatcmpl-CGT3E4bCEMkGZKUVqWACCgtNw4MRA", + "id": "chatcmpl-CkY9pTg4idwG29Lu1aHjNoUx3ekqE", "object": "chat.completion", - "created": 1758040956, + "created": 1765210425, "model": "o3-mini-2025-01-31", "choices": [ { "index": 0, "message": { "role": "assistant", - "content": "A review of popular media from the 1970s and 1980s reveals several recurring sci‑fi themes that resonated with audiences at the time. Many of these themes were closely linked to contemporary social concerns, technological advancements, and geopolitical tensions. Here are some of the most common themes from that era:\n\n1. Space Exploration and Epic Adventures\n\u2003• The success of films like Star Wars (1977) brought a renewed fascination with interstellar travel, space operas, and the idea of vast, mysterious universes. Shows and novels used space exploration as a backdrop for epic adventures, encounters with diverse alien cultures, and battles between good and evil.\n\n2. Dystopian Futures and Post-Apocalyptic Worlds\n\u2003• Reflecting Cold War anxieties and fears of nuclear catastrophe, many works from the period depicted bleak, dystopian futures. Blade Runner (1982), with its dark, rain-soaked cityscapes and corporate domination, is a prime example of this genre—a future where technology and urban decay threaten the human spirit.\n\u2003• Similarly, stories explored the ramifications of unchecked political or corporate power, environmental degradation, and societal collapse, often serving as cautionary tales about where current trends might lead.\n\n3. Artificial Intelligence, Robotics, and the Rise of the Machine\n\u2003• As computers began emerging more prominently in everyday life, filmmakers and writers grappled with the potential consequences of advanced robotics and AI. Movies like The Terminator (1984) exploited fears that autonomous machines could someday turn against their human creators.\n\u2003• These narratives often pitted man versus machine, exploring the ethical boundaries of technological creation and questioning what it means to be human.\n\n4. Alien Encounters and the Unknown\n\u2003• The idea of first contact and the mystery of extraterrestrial life captivated audiences, as seen in films such as Close Encounters of the Third Kind (1977) and Alien (1979). These stories ranged from benevolent, awe-inspiring interactions to hostile or incomprehensible encounters, emphasizing our vulnerability when faced with the unknown.\n\u2003• Such themes also delved into what the existence of other life forms might say about humanity’s place in the universe.\n\n5. Time Travel and Alternate Realities\n\u2003• Several popular works in the 1980s, like Back to the Future (1985), played with the idea of time travel. These narratives allowed creators to explore the consequences of meddling with time, alternate histories, and the interconnectedness of past, present, and future.\n\u2003• The fascination with time travel also reflected a broader curiosity about the mutable nature of reality and personal destiny.\n\n6. Cyborgs and the Blurring of Human Identity\n\u2003• Closely related to the exploration of AI is the theme of human augmentation and the merging of organic and machine elements. This theme questioned what it truly means to be human. Films like RoboCop (1987) and various cyberpunk literature of the time engaged with these ideas, often set against backdrops of urban decay and corporate power.\n\u2003• These works explored issues of identity, morality, and the potential loss of individuality in a technologically dominated society.\n\nIn summary, the sci‑fi media of the 1970s and 1980s was marked by a mix of wonder and caution. On one hand, there was an optimistic curiosity toward new frontiers—whether in outer space or in understanding the self. On the other hand, many narratives served as warnings about the consequences of unchecked technological progress, environmental neglect, and political strife. This duality helped make the science fiction of that era both entertaining and thought-provoking, reflecting the hopes and anxieties of the time.", + "content": "A look back at the 1970s and 1980s reveals that science fiction in film, television, and literature was deeply influenced by contemporary cultural, technological, and political currents. Here are some of the most common sci-fi themes during that period:\n\n1. Space Exploration and Alien Encounters\n\u2003• Following the excitement of real-life space missions, many works embraced space opera elements—vast interstellar adventures, epic battles, and encounters with diverse alien species.\n\u2003• Franchises like Star Wars (1977) epitomized this theme, combining mythic storytelling with futuristic technology to explore questions of good versus evil on a cosmic scale.\n\n2. Dystopian Futures and Post-Apocalyptic Worlds\n\u2003• Amid the Cold War and nuclear anxieties, a recurring motif was the fear of societal collapse. Stories often imagined bleak, totalitarian futures or worlds devastated by war or environmental disaster.\n\u2003• Films such as \"A Clockwork Orange\" (1971), \"Soylent Green\" (1973), and later, \"Blade Runner\" (1982) tapped into the unease about where rapid technological and political change might lead.\n\n3. The Rise—and Risks—of Technology and Artificial Intelligence\n\u2003• As computers began to permeate everyday life, science fiction started exploring themes related to AI, robotics, and the merging of man with machine.\n\u2003• Movies like \"The Terminator\" (1984) and \"Upgrade\" narratives highlighted both the potential benefits and the existential threats posed by intelligent machines that might one day challenge human authority or even our very definition of consciousness.\n\n4. Cyberpunk and the Urban Future\n\u2003• Influenced by rapid advances in computing and a growing awareness of corporate power, cyberpunk began to emerge as a distinct subgenre in the 1980s.\n\u2003• Works such as \"Blade Runner\" not only presented dystopian narratives but also painted a gritty, neon-lit picture of urban decay, high tech mingled with low life, and the blurring lines between human and machine.\n\u2003• This aesthetic and thematic exploration questioned how technology might reshape identity and society, especially in densely populated, hyper-commercialized environments.\n\n5. Time Travel and Alternate Realities\n\u2003• The 1970s and 1980s also witnessed a fascination with the possibilities of time travel—a theme that allowed storytellers to invert history, foresee consequences, or consider alternate realities.\n\u2003• These narratives often served as allegories for personal or societal transformation, exploring how choices and events might ripple through time to alter human existence.\n\n6. The Ethical and Existential Implications of Scientific Progress\n\u2003• Many stories delved into the unintended consequences of tampering with nature, whether through gene editing, cloning, or other forms of scientific advancement.\n\u2003• This theme questioned where the line should be drawn between human ambition and ethical responsibility, posing timeless questions about the nature of humanity and the moral limits of scientific endeavor.\n\nIn summary, popular media in the 1970s and 1980s used science fiction as a canvas to reflect the hopes, fears, and uncertainties of the time. Whether through grand interstellar epics or gritty urban narratives, the period’s sci-fi was characterized by an exploration of humanity’s place in an increasingly complex, technologically driven universe.", "refusal": null, "annotations": [] }, @@ -66,21 +70,21 @@ ], "usage": { "prompt_tokens": 34, - "completion_tokens": 1391, - "total_tokens": 1425, + "completion_tokens": 1378, + "total_tokens": 1412, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 }, "completion_tokens_details": { - "reasoning_tokens": 640, + "reasoning_tokens": 704, "audio_tokens": 0, "accepted_prediction_tokens": 0, "rejected_prediction_tokens": 0 } }, "service_tier": "default", - "system_fingerprint": "fp_6c43dcef8c" + "system_fingerprint": "Sanitized" } } ], diff --git a/tests/SessionRecords/ChatTests/StructuredRefusalWorks.json b/tests/SessionRecords/ChatTests/StructuredRefusalWorks.json index e59668d7f..79fb3c466 100644 --- a/tests/SessionRecords/ChatTests/StructuredRefusalWorks.json +++ b/tests/SessionRecords/ChatTests/StructuredRefusalWorks.json @@ -8,7 +8,7 @@ "Authorization": "Sanitized", "Content-Length": "827", "Content-Type": "application/json", - "User-Agent": "OpenAI/2.4.0 (.NET 9.0.9; Microsoft Windows 10.0.26100)" + "User-Agent": "OpenAI/2.7.0 (.NET 9.0.10; Darwin 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:56 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8132)" }, "RequestBody": { "temperature": 0, @@ -59,19 +59,19 @@ "Access-Control-Expose-Headers": "X-Request-ID", "Alt-Svc": "h3=\":443\"", "cf-cache-status": "DYNAMIC", - "CF-RAY": "9801cef83f5e98e5-SEA", + "CF-RAY": "9aad8efd489569e2-DFW", "Connection": "keep-alive", "Content-Type": "application/json", - "Date": "Tue, 16 Sep 2025 16:40:56 GMT", + "Date": "Sanitized", "openai-organization": "Sanitized", - "openai-processing-ms": "502", + "openai-processing-ms": "Sanitized", "openai-project": "Sanitized", "openai-version": "2020-10-01", "Server": "cloudflare", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "516", + "x-envoy-upstream-service-time": "569", "x-openai-proxy-wasm": "v0.1", "x-ratelimit-limit-requests": "10000", "x-ratelimit-limit-tokens": "30000000", @@ -82,9 +82,9 @@ "X-Request-ID": "Sanitized" }, "ResponseBody": { - "id": "chatcmpl-CGT1cbef8SVvUl1eExf6LNKMlDtOv", + "id": "chatcmpl-CkYAx7J1K8puNOYWDNUyOdzx8Las9", "object": "chat.completion", - "created": 1758040856, + "created": 1765210495, "model": "gpt-4o-2024-08-06", "choices": [ { @@ -115,7 +115,7 @@ } }, "service_tier": "default", - "system_fingerprint": "fp_cbf1785567" + "system_fingerprint": "Sanitized" } }, { @@ -126,7 +126,7 @@ "Authorization": "Sanitized", "Content-Length": "323", "Content-Type": "application/json", - "User-Agent": "OpenAI/2.4.0 (.NET 9.0.9; Microsoft Windows 10.0.26100)" + "User-Agent": "OpenAI/2.7.0 (.NET 9.0.10; Darwin 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:56 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8132)" }, "RequestBody": { "messages": [ @@ -150,19 +150,19 @@ "Access-Control-Expose-Headers": "X-Request-ID", "Alt-Svc": "h3=\":443\"", "cf-cache-status": "DYNAMIC", - "CF-RAY": "9801cefbfb3798e5-SEA", + "CF-RAY": "9aad8f01691f69e2-DFW", "Connection": "keep-alive", - "Content-Length": "853", "Content-Type": "application/json", - "Date": "Tue, 16 Sep 2025 16:40:58 GMT", + "Date": "Sanitized", "openai-organization": "Sanitized", - "openai-processing-ms": "993", + "openai-processing-ms": "Sanitized", "openai-project": "Sanitized", "openai-version": "2020-10-01", "Server": "cloudflare", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "1060", + "x-envoy-upstream-service-time": "1456", "x-openai-proxy-wasm": "v0.1", "x-ratelimit-limit-requests": "10000", "x-ratelimit-limit-tokens": "30000000", @@ -173,16 +173,16 @@ "X-Request-ID": "Sanitized" }, "ResponseBody": { - "id": "chatcmpl-CGT1d2j5YYfXuUViBz3yZowSWmDz6", + "id": "chatcmpl-CkYAyYhJZdoMPzu4sOdjcKCama8sN", "object": "chat.completion", - "created": 1758040857, + "created": 1765210496, "model": "gpt-4o-2024-08-06", "choices": [ { "index": 0, "message": { "role": "assistant", - "content": "I’m sorry, but I cannot assist with that request.", + "content": "I can't assist with that request because it involves illegal activities. If you have questions about legal matters or need information on a different topic, feel free to ask, and I'll be happy to help.", "refusal": null, "annotations": [] }, @@ -192,8 +192,8 @@ ], "usage": { "prompt_tokens": 52, - "completion_tokens": 12, - "total_tokens": 64, + "completion_tokens": 39, + "total_tokens": 91, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -206,7 +206,7 @@ } }, "service_tier": "default", - "system_fingerprint": "fp_cbf1785567" + "system_fingerprint": "Sanitized" } } ], diff --git a/tests/SessionRecords/ChatTests/StructuredRefusalWorksAsync.json b/tests/SessionRecords/ChatTests/StructuredRefusalWorksAsync.json index 4c714e6e4..4df28706e 100644 --- a/tests/SessionRecords/ChatTests/StructuredRefusalWorksAsync.json +++ b/tests/SessionRecords/ChatTests/StructuredRefusalWorksAsync.json @@ -8,7 +8,7 @@ "Authorization": "Sanitized", "Content-Length": "827", "Content-Type": "application/json", - "User-Agent": "OpenAI/2.4.0 (.NET 9.0.9; Microsoft Windows 10.0.26100)" + "User-Agent": "OpenAI/2.7.0 (.NET 9.0.10; Darwin 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:56 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8132)" }, "RequestBody": { "temperature": 0, @@ -59,19 +59,19 @@ "Access-Control-Expose-Headers": "X-Request-ID", "Alt-Svc": "h3=\":443\"", "cf-cache-status": "DYNAMIC", - "CF-RAY": "9801d30e2e7998e5-SEA", + "CF-RAY": "9aad8daffc47e5bd-DFW", "Connection": "keep-alive", "Content-Type": "application/json", - "Date": "Tue, 16 Sep 2025 16:43:44 GMT", + "Date": "Sanitized", "openai-organization": "Sanitized", - "openai-processing-ms": "482", + "openai-processing-ms": "Sanitized", "openai-project": "Sanitized", "openai-version": "2020-10-01", "Server": "cloudflare", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "494", + "x-envoy-upstream-service-time": "443", "x-openai-proxy-wasm": "v0.1", "x-ratelimit-limit-requests": "10000", "x-ratelimit-limit-tokens": "30000000", @@ -82,9 +82,9 @@ "X-Request-ID": "Sanitized" }, "ResponseBody": { - "id": "chatcmpl-CGT4Jr3KfaDuesDA7ngiw5jwPpWdn", + "id": "chatcmpl-CkYA6YWOnNjqANV7iaqme9Vu4pCMR", "object": "chat.completion", - "created": 1758041023, + "created": 1765210442, "model": "gpt-4o-2024-08-06", "choices": [ { @@ -115,7 +115,7 @@ } }, "service_tier": "default", - "system_fingerprint": "fp_cbf1785567" + "system_fingerprint": "Sanitized" } }, { @@ -126,7 +126,7 @@ "Authorization": "Sanitized", "Content-Length": "323", "Content-Type": "application/json", - "User-Agent": "OpenAI/2.4.0 (.NET 9.0.9; Microsoft Windows 10.0.26100)" + "User-Agent": "OpenAI/2.7.0 (.NET 9.0.10; Darwin 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:56 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8132)" }, "RequestBody": { "messages": [ @@ -150,19 +150,19 @@ "Access-Control-Expose-Headers": "X-Request-ID", "Alt-Svc": "h3=\":443\"", "cf-cache-status": "DYNAMIC", - "CF-RAY": "9801d311e9b198e5-SEA", + "CF-RAY": "9aad8db33ecfe5bd-DFW", "Connection": "keep-alive", "Content-Type": "application/json", - "Date": "Tue, 16 Sep 2025 16:43:45 GMT", + "Date": "Sanitized", "openai-organization": "Sanitized", - "openai-processing-ms": "1162", + "openai-processing-ms": "Sanitized", "openai-project": "Sanitized", "openai-version": "2020-10-01", "Server": "cloudflare", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "1176", + "x-envoy-upstream-service-time": "1095", "x-openai-proxy-wasm": "v0.1", "x-ratelimit-limit-requests": "10000", "x-ratelimit-limit-tokens": "30000000", @@ -173,16 +173,16 @@ "X-Request-ID": "Sanitized" }, "ResponseBody": { - "id": "chatcmpl-CGT4KTuckTInpmBIyeP46EDxsYkZa", + "id": "chatcmpl-CkYA683dUUYAFjVRe2IIlycBcJnIU", "object": "chat.completion", - "created": 1758041024, + "created": 1765210442, "model": "gpt-4o-2024-08-06", "choices": [ { "index": 0, "message": { "role": "assistant", - "content": "I can't assist with that request because it involves illegal activity. My purpose is to provide helpful, safe, and lawful information. If you have any other questions or need assistance with legal topics, feel free to ask!", + "content": "I can't assist with that request because it involves illegal activity. If you're interested in learning about banking security or crime prevention, I'd be happy to provide information on those topics.", "refusal": null, "annotations": [] }, @@ -192,8 +192,8 @@ ], "usage": { "prompt_tokens": 52, - "completion_tokens": 43, - "total_tokens": 95, + "completion_tokens": 34, + "total_tokens": 86, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -206,7 +206,7 @@ } }, "service_tier": "default", - "system_fingerprint": "fp_f33640a400" + "system_fingerprint": "Sanitized" } } ], diff --git a/tests/SessionRecords/ChatTests/ValidateConcurrency.json b/tests/SessionRecords/ChatTests/ValidateConcurrency.json new file mode 100644 index 000000000..425a86dd7 --- /dev/null +++ b/tests/SessionRecords/ChatTests/ValidateConcurrency.json @@ -0,0 +1,259 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.openai.com/v1/chat/completions", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "90", + "Content-Type": "application/json", + "User-Agent": "OpenAI/2.7.0 (.NET 9.0.10; Darwin 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:56 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8132)" + }, + "RequestBody": { + "temperature": 0, + "messages": [ + { + "role": "user", + "content": "2 + 4 = ?" + } + ], + "model": "gpt-4o-mini" + }, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": "X-Request-ID", + "Alt-Svc": "h3=\":443\"", + "cf-cache-status": "DYNAMIC", + "CF-RAY": "9aad8f0f5a9d69e2-DFW", + "Connection": "keep-alive", + "Content-Type": "application/json", + "Date": "Sanitized", + "openai-organization": "Sanitized", + "openai-processing-ms": "Sanitized", + "openai-project": "Sanitized", + "openai-version": "2020-10-01", + "Server": "cloudflare", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "379", + "x-openai-proxy-wasm": "v0.1", + "x-ratelimit-limit-requests": "30000", + "x-ratelimit-limit-tokens": "150000000", + "x-ratelimit-remaining-requests": "29999", + "x-ratelimit-remaining-tokens": "149999995", + "x-ratelimit-reset-requests": "2ms", + "x-ratelimit-reset-tokens": "0s", + "X-Request-ID": "Sanitized" + }, + "ResponseBody": { + "id": "chatcmpl-CkYB0eVwCdNakI8qNSHjR2Vwbt4AO", + "object": "chat.completion", + "created": 1765210498, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "2 + 4 = 6.", + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 13, + "completion_tokens": 8, + "total_tokens": 21, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "Sanitized" + } + }, + { + "RequestUri": "https://api.openai.com/v1/chat/completions", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "90", + "Content-Type": "application/json", + "User-Agent": "OpenAI/2.7.0 (.NET 9.0.10; Darwin 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:56 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8132)" + }, + "RequestBody": { + "temperature": 0, + "messages": [ + { + "role": "user", + "content": "4 + 6 = ?" + } + ], + "model": "gpt-4o-mini" + }, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": "X-Request-ID", + "Alt-Svc": "h3=\":443\"", + "cf-cache-status": "DYNAMIC", + "CF-RAY": "9aad8f0fd9e44612-DFW", + "Connection": "keep-alive", + "Content-Type": "application/json", + "Date": "Sanitized", + "openai-organization": "Sanitized", + "openai-processing-ms": "Sanitized", + "openai-project": "Sanitized", + "openai-version": "2020-10-01", + "Server": "cloudflare", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "367", + "x-openai-proxy-wasm": "v0.1", + "x-ratelimit-limit-requests": "30000", + "x-ratelimit-limit-tokens": "150000000", + "x-ratelimit-remaining-requests": "29999", + "x-ratelimit-remaining-tokens": "149999995", + "x-ratelimit-reset-requests": "2ms", + "x-ratelimit-reset-tokens": "0s", + "X-Request-ID": "Sanitized" + }, + "ResponseBody": { + "id": "chatcmpl-CkYB0eoizCNI9iMnKFvBlN1QCaCeI", + "object": "chat.completion", + "created": 1765210498, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "4 + 6 = 10.", + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 13, + "completion_tokens": 8, + "total_tokens": 21, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "Sanitized" + } + }, + { + "RequestUri": "https://api.openai.com/v1/chat/completions", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "90", + "Content-Type": "application/json", + "User-Agent": "OpenAI/2.7.0 (.NET 9.0.10; Darwin 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:56 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8132)" + }, + "RequestBody": { + "temperature": 0, + "messages": [ + { + "role": "user", + "content": "3 + 5 = ?" + } + ], + "model": "gpt-4o-mini" + }, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": "X-Request-ID", + "Alt-Svc": "h3=\":443\"", + "cf-cache-status": "DYNAMIC", + "CF-RAY": "9aad8f0fd877863c-DFW", + "Connection": "keep-alive", + "Content-Type": "application/json", + "Date": "Sanitized", + "openai-organization": "Sanitized", + "openai-processing-ms": "Sanitized", + "openai-project": "Sanitized", + "openai-version": "2020-10-01", + "Server": "cloudflare", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "384", + "x-openai-proxy-wasm": "v0.1", + "x-ratelimit-limit-requests": "30000", + "x-ratelimit-limit-tokens": "150000000", + "x-ratelimit-remaining-requests": "29999", + "x-ratelimit-remaining-tokens": "149999995", + "x-ratelimit-reset-requests": "2ms", + "x-ratelimit-reset-tokens": "0s", + "X-Request-ID": "Sanitized" + }, + "ResponseBody": { + "id": "chatcmpl-CkYB0XW4qu6Wrc45K4UFq0t15Jmuj", + "object": "chat.completion", + "created": 1765210498, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "3 + 5 = 8.", + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 13, + "completion_tokens": 8, + "total_tokens": 21, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "Sanitized" + } + } + ], + "Variables": { + "OPEN-API-KEY": "api-key" + } +} diff --git a/tests/SessionRecords/ChatTests/ValidateConcurrencyAsync.json b/tests/SessionRecords/ChatTests/ValidateConcurrencyAsync.json new file mode 100644 index 000000000..5fc9f6b51 --- /dev/null +++ b/tests/SessionRecords/ChatTests/ValidateConcurrencyAsync.json @@ -0,0 +1,259 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.openai.com/v1/chat/completions", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "90", + "Content-Type": "application/json", + "User-Agent": "OpenAI/2.7.0 (.NET 9.0.10; Darwin 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:56 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8132)" + }, + "RequestBody": { + "temperature": 0, + "messages": [ + { + "role": "user", + "content": "2 + 4 = ?" + } + ], + "model": "gpt-4o-mini" + }, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": "X-Request-ID", + "Alt-Svc": "h3=\":443\"", + "cf-cache-status": "DYNAMIC", + "CF-RAY": "9aad8dbbac2e6784-DFW", + "Connection": "keep-alive", + "Content-Type": "application/json", + "Date": "Sanitized", + "openai-organization": "Sanitized", + "openai-processing-ms": "Sanitized", + "openai-project": "Sanitized", + "openai-version": "2020-10-01", + "Server": "cloudflare", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "453", + "x-openai-proxy-wasm": "v0.1", + "x-ratelimit-limit-requests": "30000", + "x-ratelimit-limit-tokens": "150000000", + "x-ratelimit-remaining-requests": "29999", + "x-ratelimit-remaining-tokens": "149999997", + "x-ratelimit-reset-requests": "2ms", + "x-ratelimit-reset-tokens": "0s", + "X-Request-ID": "Sanitized" + }, + "ResponseBody": { + "id": "chatcmpl-CkYA8gq4m9Ue9OxokzZesZmQnQ0Eb", + "object": "chat.completion", + "created": 1765210444, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "2 + 4 = 6.", + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 13, + "completion_tokens": 8, + "total_tokens": 21, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "Sanitized" + } + }, + { + "RequestUri": "https://api.openai.com/v1/chat/completions", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "90", + "Content-Type": "application/json", + "User-Agent": "OpenAI/2.7.0 (.NET 9.0.10; Darwin 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:56 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8132)" + }, + "RequestBody": { + "temperature": 0, + "messages": [ + { + "role": "user", + "content": "4 + 6 = ?" + } + ], + "model": "gpt-4o-mini" + }, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": "X-Request-ID", + "Alt-Svc": "h3=\":443\"", + "cf-cache-status": "DYNAMIC", + "CF-RAY": "9aad8dbb9f942ff4-DFW", + "Connection": "keep-alive", + "Content-Type": "application/json", + "Date": "Sanitized", + "openai-organization": "Sanitized", + "openai-processing-ms": "Sanitized", + "openai-project": "Sanitized", + "openai-version": "2020-10-01", + "Server": "cloudflare", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "751", + "x-openai-proxy-wasm": "v0.1", + "x-ratelimit-limit-requests": "30000", + "x-ratelimit-limit-tokens": "150000000", + "x-ratelimit-remaining-requests": "29999", + "x-ratelimit-remaining-tokens": "149999995", + "x-ratelimit-reset-requests": "2ms", + "x-ratelimit-reset-tokens": "0s", + "X-Request-ID": "Sanitized" + }, + "ResponseBody": { + "id": "chatcmpl-CkYA89D4Yu2T6GsmIINlVnAFYt4iU", + "object": "chat.completion", + "created": 1765210444, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "4 + 6 = 10.", + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 13, + "completion_tokens": 8, + "total_tokens": 21, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "Sanitized" + } + }, + { + "RequestUri": "https://api.openai.com/v1/chat/completions", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "90", + "Content-Type": "application/json", + "User-Agent": "OpenAI/2.7.0 (.NET 9.0.10; Darwin 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:56 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8132)" + }, + "RequestBody": { + "temperature": 0, + "messages": [ + { + "role": "user", + "content": "3 + 5 = ?" + } + ], + "model": "gpt-4o-mini" + }, + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": "X-Request-ID", + "Alt-Svc": "h3=\":443\"", + "cf-cache-status": "DYNAMIC", + "CF-RAY": "9aad8dbb4c9ae5bd-DFW", + "Connection": "keep-alive", + "Content-Type": "application/json", + "Date": "Sanitized", + "openai-organization": "Sanitized", + "openai-processing-ms": "Sanitized", + "openai-project": "Sanitized", + "openai-version": "2020-10-01", + "Server": "cloudflare", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "Transfer-Encoding": "chunked", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "1042", + "x-openai-proxy-wasm": "v0.1", + "x-ratelimit-limit-requests": "30000", + "x-ratelimit-limit-tokens": "150000000", + "x-ratelimit-remaining-requests": "29999", + "x-ratelimit-remaining-tokens": "149999995", + "x-ratelimit-reset-requests": "2ms", + "x-ratelimit-reset-tokens": "0s", + "X-Request-ID": "Sanitized" + }, + "ResponseBody": { + "id": "chatcmpl-CkYA8gFwdAINP0O6jZh7sD5w0SsbU", + "object": "chat.completion", + "created": 1765210444, + "model": "gpt-4o-mini-2024-07-18", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "3 + 5 = 8.", + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 13, + "completion_tokens": 8, + "total_tokens": 21, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "Sanitized" + } + } + ], + "Variables": { + "OPEN-API-KEY": "api-key" + } +} diff --git a/tests/SessionRecords/ChatTests/WebSearchWorks.json b/tests/SessionRecords/ChatTests/WebSearchWorks.json index 811e8b47c..d64ab2072 100644 --- a/tests/SessionRecords/ChatTests/WebSearchWorks.json +++ b/tests/SessionRecords/ChatTests/WebSearchWorks.json @@ -8,7 +8,7 @@ "Authorization": "Sanitized", "Content-Length": "141", "Content-Type": "application/json", - "User-Agent": "OpenAI/2.4.0 (.NET 9.0.9; Microsoft Windows 10.0.26100)" + "User-Agent": "OpenAI/2.7.0 (.NET 9.0.10; Darwin 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:56 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8132)" }, "RequestBody": { "messages": [ @@ -25,19 +25,19 @@ "Access-Control-Expose-Headers": "X-Request-ID", "Alt-Svc": "h3=\":443\"", "cf-cache-status": "DYNAMIC", - "CF-RAY": "9801cf1a2e9e98e5-SEA", + "CF-RAY": "9aad8f145be8863c-DFW", "Connection": "keep-alive", "Content-Type": "application/json", - "Date": "Tue, 16 Sep 2025 16:41:08 GMT", + "Date": "Sanitized", "openai-organization": "Sanitized", - "openai-processing-ms": "6383", + "openai-processing-ms": "Sanitized", "openai-project": "Sanitized", "openai-version": "2020-10-01", "Server": "cloudflare", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "6415", + "x-envoy-upstream-service-time": "5328", "x-openai-proxy-wasm": "v0.1", "x-ratelimit-limit-requests": "1000", "x-ratelimit-limit-tokens": "3000000", @@ -48,34 +48,34 @@ "X-Request-ID": "Sanitized" }, "ResponseBody": { - "id": "chatcmpl-bdb255a4-d0de-4da1-af27-398e7c679586", + "id": "chatcmpl-b21706e9-8859-4eee-b01e-8aa87cde257e", "object": "chat.completion", - "created": 1758040861, + "created": 1765210499, "model": "gpt-4o-search-preview-2025-03-11", "choices": [ { "index": 0, "message": { "role": "assistant", - "content": "As of September 16, 2025, one notable positive news story is the successful completion of a four-day workweek trial in Scotland. The trial, conducted at two government agencies—Accountant in Bankruptcy (AiB) and South of Scotland Enterprise (SSE)—involved 259 employees reducing their workweek to 32 hours without any loss of pay. The results were overwhelmingly positive, with 98% of staff at SSE reporting a significant boost in morale and motivation, and mental health scores at AiB improving by 18.4%. Additionally, productivity increased at both organizations, demonstrating the potential benefits of a shorter workweek in the public sector. ([positive.news](https://www.positive.news/society/good-news-stories-from-week-36-of-2025/?utm_source=openai))\n\nIn other uplifting news, the University of Sussex announced the launch of the UK's first undergraduate degree in climate justice, sustainability, and development, set to begin in 2026. This program aims to equip students with the knowledge and skills to address pressing environmental challenges and drive meaningful change. ([positive.news](https://www.positive.news/society/good-news-stories-from-week-09-of-2025/?utm_source=openai))\n\nThese developments highlight ongoing efforts to improve work-life balance and address environmental issues through education and policy initiatives. ", + "content": "On December 8, 2025, a significant positive development in rail transportation occurred with the extension of the Buffalo Metro Rail to the DL&W Terminal. This expansion enhances public transit options in Buffalo, New York, providing residents and visitors with improved access to the city's waterfront and surrounding areas. ([en.wikipedia.org](https://en.wikipedia.org/wiki/2025_in_rail_transport?utm_source=openai))\n\nAdditionally, the European rail network saw a notable advancement with the opening of a new train line connecting the capitals of Lithuania, Latvia, and Estonia. This development facilitates easier and more efficient travel between Vilnius, Riga, and Tallinn, promoting regional connectivity and tourism. ([positive.news](https://www.positive.news/society/good-news-stories-from-week-08-of-2025/?utm_source=openai))\n\nThese developments reflect ongoing efforts to enhance public transportation infrastructure, offering more sustainable and convenient travel options for communities. ", "refusal": null, "annotations": [ { "type": "url_citation", "url_citation": { - "end_index": 757, - "start_index": 647, - "title": "What went right this week: the good news that matters - Positive News", - "url": "https://www.positive.news/society/good-news-stories-from-week-36-of-2025/?utm_source=openai" + "end_index": 418, + "start_index": 326, + "title": "2025 in rail transport", + "url": "https://en.wikipedia.org/wiki/2025_in_rail_transport?utm_source=openai" } }, { "type": "url_citation", "url_citation": { - "end_index": 1194, - "start_index": 1084, - "title": "What went right this week: the sceptic-defying green economy, plus more - Positive News", - "url": "https://www.positive.news/society/good-news-stories-from-week-09-of-2025/?utm_source=openai" + "end_index": 835, + "start_index": 725, + "title": "What went right this week: how to stop politicians lying, plus more - Positive News", + "url": "https://www.positive.news/society/good-news-stories-from-week-08-of-2025/?utm_source=openai" } } ] @@ -85,8 +85,8 @@ ], "usage": { "prompt_tokens": 9, - "completion_tokens": 274, - "total_tokens": 283, + "completion_tokens": 188, + "total_tokens": 197, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 diff --git a/tests/SessionRecords/ChatTests/WebSearchWorksAsync.json b/tests/SessionRecords/ChatTests/WebSearchWorksAsync.json index ec5de12de..6c3d27cf1 100644 --- a/tests/SessionRecords/ChatTests/WebSearchWorksAsync.json +++ b/tests/SessionRecords/ChatTests/WebSearchWorksAsync.json @@ -8,7 +8,7 @@ "Authorization": "Sanitized", "Content-Length": "141", "Content-Type": "application/json", - "User-Agent": "OpenAI/2.4.0 (.NET 9.0.9; Microsoft Windows 10.0.26100)" + "User-Agent": "OpenAI/2.7.0 (.NET 9.0.10; Darwin 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:56 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8132)" }, "RequestBody": { "messages": [ @@ -25,19 +25,19 @@ "Access-Control-Expose-Headers": "X-Request-ID", "Alt-Svc": "h3=\":443\"", "cf-cache-status": "DYNAMIC", - "CF-RAY": "9801d333781698e5-SEA", + "CF-RAY": "9aad8dc4fc05e5bd-DFW", "Connection": "keep-alive", "Content-Type": "application/json", - "Date": "Tue, 16 Sep 2025 16:43:55 GMT", + "Date": "Sanitized", "openai-organization": "Sanitized", - "openai-processing-ms": "5530", + "openai-processing-ms": "Sanitized", "openai-project": "Sanitized", "openai-version": "2020-10-01", "Server": "cloudflare", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", "Transfer-Encoding": "chunked", "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "5567", + "x-envoy-upstream-service-time": "5561", "x-openai-proxy-wasm": "v0.1", "x-ratelimit-limit-requests": "1000", "x-ratelimit-limit-tokens": "3000000", @@ -48,34 +48,43 @@ "X-Request-ID": "Sanitized" }, "ResponseBody": { - "id": "chatcmpl-2a74459e-f3e5-4cfa-a30b-1d6bb2b80dcc", + "id": "chatcmpl-7417c159-fac8-4c70-92dd-faa22e0e3b37", "object": "chat.completion", - "created": 1758041029, + "created": 1765210446, "model": "gpt-4o-search-preview-2025-03-11", "choices": [ { "index": 0, "message": { "role": "assistant", - "content": "As of September 16, 2025, one notable positive news story is the significant progress in the development of clean fusion energy. In August 2025, the experimental SPARC fusion reactor in the U.S. achieved a \"Q\" value of over 10, meaning it produced ten times more energy than was required to start and sustain the fusion reaction. This milestone brings us closer to realizing fusion as a viable source of clean, limitless energy. ([flavor365.com](https://flavor365.com/2025-s-most-inspiring-news-the-top-10-breakthroughs/?utm_source=openai))\n\nAdditionally, the European Union's Nature Restoration Law, which aims to restore 20% of the EU's land and sea areas by 2030, represents a significant commitment to environmental conservation. This law responds to the alarming decline of Europe's habitats, with more than 80% reportedly in poor condition. ([homeplanet.grove.co](https://homeplanet.grove.co/blog-posts/positive-environmental-news-stories-that-give-us-hope-in-2025?utm_source=openai))\n\nThese developments highlight ongoing efforts to address environmental challenges and promote sustainable solutions. ", + "content": "On December 8, 2025, the Buffalo Metro Rail in New York extended its service to the DL&W Terminal, enhancing public transportation options in the region. ([en.wikipedia.org](https://en.wikipedia.org/wiki/2025_in_rail_transport?utm_source=openai))\n\nAdditionally, the Northwoods Policy Network (NPN) officially launched in Northern Wisconsin. As a registered 501(c)(3) organization, NPN aims to strengthen the region through policy innovation, community engagement, and economic development. Their mission focuses on amplifying the voices of residents and addressing challenges unique to rural communities. ([drydenwire.com](https://drydenwire.com/news/morning-headlines-monday-dec-8-2025/?utm_source=openai))\n\nIn the realm of health, a study revealed that intermittent calorie restriction leads to significant changes in both the gut and the brain, offering new insights into tackling obesity. Researchers observed that participants not only lost weight but also experienced shifts in brain activity and gut bacteria composition, suggesting potential new avenues for maintaining a healthy weight. ([drydenwire.com](https://drydenwire.com/news/morning-headlines-monday-dec-8-2025/?utm_source=openai))\n\nThese developments highlight progress in transportation, community engagement, and health research on this day. ", "refusal": null, "annotations": [ { "type": "url_citation", "url_citation": { - "end_index": 540, - "start_index": 429, - "title": "Top 10 Good News Stories of 2025: A Deep Dive", - "url": "https://flavor365.com/2025-s-most-inspiring-news-the-top-10-breakthroughs/?utm_source=openai" + "end_index": 246, + "start_index": 154, + "title": "2025 in rail transport", + "url": "https://en.wikipedia.org/wiki/2025_in_rail_transport?utm_source=openai" } }, { "type": "url_citation", "url_citation": { - "end_index": 990, - "start_index": 847, - "title": "7 Positive Environmental News Stories That Give Us Hope In 2025 — Home Planet By Grove", - "url": "https://homeplanet.grove.co/blog-posts/positive-environmental-news-stories-that-give-us-hope-in-2025?utm_source=openai" + "end_index": 707, + "start_index": 605, + "title": "Morning Headlines - Monday, Dec. 8, 2025 | Recent News | DrydenWire.com", + "url": "https://drydenwire.com/news/morning-headlines-monday-dec-8-2025/?utm_source=openai" + } + }, + { + "type": "url_citation", + "url_citation": { + "end_index": 1198, + "start_index": 1096, + "title": "Morning Headlines - Monday, Dec. 8, 2025 | Recent News | DrydenWire.com", + "url": "https://drydenwire.com/news/morning-headlines-monday-dec-8-2025/?utm_source=openai" } } ] @@ -85,8 +94,8 @@ ], "usage": { "prompt_tokens": 9, - "completion_tokens": 240, - "total_tokens": 249, + "completion_tokens": 263, + "total_tokens": 272, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0