发布

  • [OPIK-5845] [BE] fix: fix dataset expansion for test suites and all LLM providers (#6277)

    frostbyte_neo 发布于 2026-04-15 15:02:12 +00:00

    • [OPIK-5845] [BE] fix: fix dataset expansion for test suites and all LLM providers
    • Add maxCompletionTokens (4000) to expansion requests, fixing Anthropic
      models that require this field
    • Re-throw ClientErrorException/ServerErrorException with original
      messages instead of wrapping in generic BadRequestException
    • Skip _generated/_generation_model metadata for test suite expansions
      so synthetic fields don't pollute data passed to agents in local
      runner scenarios

    Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

    • refactor(expansion): use proper HTTP status codes for error handling
    • Catch BadRequestException separately to preserve validation errors
    • Rethrow ClientErrorException/ServerErrorException from LLM providers
    • Use InternalServerErrorException for unexpected failures instead of
      mapping everything to 400 BadRequest
    • Use generic message for 500s, log full details server-side

    Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

    • fix(expansion): address PR review comments
    • Use lighter getById() instead of findById() to avoid unnecessary
      dataset enrichment when only the type is needed
    • Extract buildDatasetItem() to DRY the duplicated item construction
    • Make maxCompletionTokens provider-aware: only set for Anthropic by
      default (4000), skip for other providers to avoid impacting results
    • Allow users to override maxCompletionTokens via the API request
    • Inject LlmProviderFactory to resolve provider from model name

    Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

    • test(expansion): add unit tests and @Min validation for maxCompletionTokens

    Add DatasetExpansionServiceTest covering maxCompletionTokens resolution,
    dataset item building (metadata for regular vs test suite), and error
    handling. Add @Min(100) validation on maxCompletionTokens field.

    Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com


    Co-authored-by: Claude Opus 4.6 noreply@anthropic.com

    下载附件