Skip to content

Instantly share code, notes, and snippets.

@christianarg
christianarg / HttpDiagnosticListener.cs
Last active November 8, 2025 10:26
Debug any LLM HTTP Calls in c# / dotnet. Actually Debug any library HTTP calls
using System.Diagnostics;
/// <summary>
/// Sets up a DiagnosticListener to log HTTP requests made by HttpClient.
/// Created it with the help of ChatGPT some time ago.
/// I wouldn't enable in production at all, but it's useful for debugging purposes.
///
/// Used to debug AI Frameworks HTTP calls since of them don't show exactly what is being sent.
///
/// Usage:
@christianarg
christianarg / OpenAiResponsesApiNetSdkReasoningAndVerbosityWithMicrosoftAgentFramework.cs
Created October 24, 2025 08:45
How to pass reasoning and verbosity parameters to OpenAi Models with Responses api using Microsoft Agent Framework net sdk
var agent = new AzureOpenAIClient(
new Uri(""), // endpoint
new DefaultAzureCredential())
.GetOpenAIResponseClient("gpt-5")
// configure reasoning https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/GettingStarted/AgentWithOpenAI/Agent_OpenAI_Step02_Reasoning/Program.cs
// verbosity param https://github.com/openai/openai-dotnet/issues/593
.AsIChatClient().AsBuilder()
.ConfigureOptions(o =>
{
o.RawRepresentationFactory = _ => ((IJsonModel<ResponseCreationOptions>)new ResponseCreationOptions())
/*
source: https://www.sqlshack.com/import-json-data-into-sql-server/
sample json
[
{
"id": "1",
"name": "paco"
},