Package org.springframework.ai.model
Class MutableResponseMetadata
java.lang.Object
org.springframework.ai.model.MutableResponseMetadata
- All Implemented Interfaces:
ResponseMetadata
- Direct Known Subclasses:
AudioTranscriptionResponseMetadata,ImageResponseMetadata,OpenAiAudioSpeechResponseMetadata
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the entries from the context.<T> TcomputeIfAbsent(String key, Function<Object, ? extends T> mappingFunction) Returns an element or calls a mapping function if entry not present.booleancontainsKey(Object key) Checks if context contains a key.entrySet()<T> TGets an entry from the context.<T> TgetOrDefault(Object key, T defaultObject) Returns an element or default if not present.<T> TgetRequired(Object key) Gets an entry from the context.booleanisEmpty()Returnstrueif this map contains no key-value mappings.keySet()Puts an element to the context.Removes an entry from the context.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.ai.model.ResponseMetadata
getOrDefault
-
Constructor Details
-
MutableResponseMetadata
public MutableResponseMetadata()
-
-
Method Details
-
put
Puts an element to the context.- Type Parameters:
T- value type- Parameters:
key- keyobject- value- Returns:
- this for chaining
-
get
Gets an entry from the context. Returnsnullwhen entry is not present.- Specified by:
getin interfaceResponseMetadata- Type Parameters:
T- value type- Parameters:
key- key- Returns:
- entry or
nullif not present
-
remove
Removes an entry from the context.- Parameters:
key- key by which to remove an entry- Returns:
- the previous value associated with the key, or null if there was no mapping for the key
-
getRequired
Gets an entry from the context. Throws exception when entry is not present.- Specified by:
getRequiredin interfaceResponseMetadata- Type Parameters:
T- value type- Parameters:
key- key- Returns:
- entry
- Throws:
IllegalArgumentException- if not present
-
containsKey
Checks if context contains a key.- Specified by:
containsKeyin interfaceResponseMetadata- Parameters:
key- key- Returns:
truewhen the context contains the entry with the given key
-
getOrDefault
Returns an element or default if not present.- Specified by:
getOrDefaultin interfaceResponseMetadata- Type Parameters:
T- value type- Parameters:
key- keydefaultObject- default object to return- Returns:
- object or default if not present
-
entrySet
- Specified by:
entrySetin interfaceResponseMetadata
-
keySet
- Specified by:
keySetin interfaceResponseMetadata
-
isEmpty
public boolean isEmpty()Description copied from interface:ResponseMetadataReturnstrueif this map contains no key-value mappings.- Specified by:
isEmptyin interfaceResponseMetadata- Returns:
trueif this map contains no key-value mappings
-
computeIfAbsent
Returns an element or calls a mapping function if entry not present. The function will insert the value to the map.- Type Parameters:
T- value type- Parameters:
key- keymappingFunction- mapping function- Returns:
- object or one derived from the mapping function if not present
-
clear
public void clear()Clears the entries from the context. -
getRawMap
-