apiops icon indicating copy to clipboard operation
apiops copied to clipboard

Add support for large language model diagnostics in API and common modules

Open suzuki-shm opened this issue 1 month ago • 1 comments

Resolves #785


This pull request adds support for configuring and testing Large Language Model (LLM) diagnostics in the API and workspace diagnostic systems. The changes introduce new model and contract types to represent LLM settings, update test data generation, and refactor integration test helpers to handle these new structures.

Details

Large Language Model diagnostics support

  • Added new contract types (LargeLanguageModelSettings and LargeLanguageModelMessageSettings) to ApiDiagnostic.cs, Diagnostic.cs, and WorkspaceDiagnostic.cs for serializing LLM diagnostic options, including logs, requests, and responses.
  • Extended the main diagnostic models (ApiDiagnosticModel, DiagnosticModel) and their test generators to include an optional LargeLanguageModel property and generation logic for LLM settings.

Integration test refactoring

  • Refactored integration test helpers in ApiDiagnostic.cs and Diagnostic.cs to use a new MapToDto function, which maps the extended model to DTOs including LLM settings, replacing the previous getDto implementation.
  • Updated normalization logic in integration tests to handle LLM settings, ensuring consistent test output and comparison for diagnostics with LLM configuration.

Test data generation

  • Updated generators for diagnostic model updates and DTO overrides to include LLM settings, enabling richer test coverage for diagnostics involving LLMs.

Results

Here is the screenshot of extracted properties from my APIM resource. image

suzuki-shm avatar Nov 20 '25 07:11 suzuki-shm

@microsoft-github-policy-service agree

suzuki-shm avatar Nov 20 '25 07:11 suzuki-shm

@suzuki-shm can you please create a new PR to carry the changes against the new code base which is located in the V7 feature branch?

waelkdouh avatar Dec 04 '25 13:12 waelkdouh

Thanks for the great PR. Unfortunately, we intentionally don't support this yet in ApiOps.

LLM diagnostics are only available in a preview version (2025-03-01-preview) of the APIM REST API. The latest GA version (2024-05-01) doesn't have this.

Once it's GA, we will quickly add support for this in ApiOps. We've had issues with preview APIs before, and as a rule of thumb, we avoid supporting them.

I'll update the issue with a workaround.

guythetechie avatar Dec 04 '25 14:12 guythetechie