spring-ai icon indicating copy to clipboard operation
spring-ai copied to clipboard

GH-2518: Remove requestOptions from observation context objects

Open sobychacko opened this issue 6 months ago • 0 comments
trafficstars

Fixes: #2518

Issue: https://github.com/spring-projects/spring-ai/issues/2518

This commit removes the deprecated requestOptions field from ChatModelObservationContext and EmbeddingModelObservationContext classes. Instead of passing options separately, the code now retrieves them directly from the request objects (prompt.getOptions() or embeddingRequest.getOptions()).

Key changes:

  • Removed requestOptions parameter from observation context builders
  • Updated all model implementations to stop passing options separately
  • Fixed EmbeddingRequest handling in several model implementations
  • Added buildEmbeddingRequest method in models to properly merge options

This change simplifies the API and removes duplication, as options are already available in the request objects themselves.

sobychacko avatar Apr 26 '25 01:04 sobychacko