Class ModelObservationContext<REQ,RES>

java.lang.Object
io.micrometer.observation.Observation.Context
org.springframework.ai.model.observation.ModelObservationContext<REQ,RES>
Type Parameters:
REQ - type of the request object
RES - type of the response object
All Implemented Interfaces:
io.micrometer.observation.Observation.ContextView
Direct Known Subclasses:
ChatModelObservationContext, EmbeddingModelObservationContext, ImageModelObservationContext

public class ModelObservationContext<REQ,RES> extends io.micrometer.observation.Observation.Context
Context used when sending a request to a machine learning model and waiting for a response from the model provider.
Since:
1.0.0
Author:
Thomas Vitale
  • Constructor Summary

    Constructors
    Constructor
    Description
    ModelObservationContext(REQ request, AiOperationMetadata operationMetadata)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
     
    void
    setResponse(RES response)
     

    Methods inherited from class io.micrometer.observation.Observation.Context

    addHighCardinalityKeyValue, addHighCardinalityKeyValues, addLowCardinalityKeyValue, addLowCardinalityKeyValues, clear, computeIfAbsent, containsKey, get, getAllKeyValues, getContextualName, getError, getHighCardinalityKeyValue, getHighCardinalityKeyValues, getLowCardinalityKeyValue, getLowCardinalityKeyValues, getName, getOrDefault, getParentObservation, getRequired, put, remove, removeHighCardinalityKeyValue, removeHighCardinalityKeyValues, removeLowCardinalityKeyValue, removeLowCardinalityKeyValues, setContextualName, setError, setName, setParentObservation, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.micrometer.observation.Observation.ContextView

    getOrDefault
  • Constructor Details

    • ModelObservationContext

      public ModelObservationContext(REQ request, AiOperationMetadata operationMetadata)
  • Method Details

    • getRequest

      public REQ getRequest()
    • getOperationMetadata

      public AiOperationMetadata getOperationMetadata()
    • getResponse

      @Nullable public RES getResponse()
    • setResponse

      public void setResponse(RES response)