Class DefaultChatClient.DefaultCallResponseSpec
java.lang.Object
org.springframework.ai.chat.client.DefaultChatClient.DefaultCallResponseSpec
- All Implemented Interfaces:
ChatClient.CallResponseSpec
- Enclosing class:
- DefaultChatClient
public static class DefaultChatClient.DefaultCallResponseSpec
extends Object
implements ChatClient.CallResponseSpec
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultCallResponseSpec(ChatClientRequest chatClientRequest, BaseAdvisorChain advisorChain, io.micrometer.observation.ObservationRegistry observationRegistry, ChatClientObservationConvention observationConvention) -
Method Summary
Modifier and TypeMethodDescription@Nullable ChatResponse@Nullable Stringcontent()protected <T> ResponseEntity<ChatResponse,T> doResponseEntity(StructuredOutputConverter<T> outputConverter) protected <T> ResponseEntity<ChatResponse,T> doResponseEntity(StructuredOutputConverter<T> outputConverter, BaseAdvisorChain advisorChain) <T> @Nullable TDeserializes the response into aTinstance.<T> @Nullable Tentity(Class<T> type, Consumer<ChatClient.EntityParamSpec> entitySpecConsumer) Deserializes the response into aTinstance, with behaviour configured via theentityParamSpecConsumer.<T> @Nullable Tentity(StructuredOutputConverter<T> structuredOutputConverter) Deserializes the response using the given converter.<T> @Nullable Tentity(StructuredOutputConverter<T> structuredOutputConverter, Consumer<ChatClient.EntityParamSpec> entitySpecConsumer) Deserializes the response using the given converter, with behaviour configured via theentityParamSpecConsumer.<T> @Nullable Tentity(org.springframework.core.ParameterizedTypeReference<T> type) Deserializes the response into aTinstance.<T> @Nullable Tentity(org.springframework.core.ParameterizedTypeReference<T> type, Consumer<ChatClient.EntityParamSpec> entitySpecConsumer) Deserializes the response into aTinstance, with behaviour configured via theentityParamSpecConsumer.<T> ResponseEntity<ChatResponse,T> responseEntity(Class<T> type) Returns aResponseEntitycontaining both the completeChatResponseobject and a specific entity type.<T> ResponseEntity<ChatResponse,T> responseEntity(Class<T> type, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer) Returns aResponseEntitycontaining both the completeChatResponseobject and a specific entity type, with behaviour configured via theentityParamSpecConsumer.<T> ResponseEntity<ChatResponse,T> responseEntity(StructuredOutputConverter<T> structuredOutputConverter) Returns aResponseEntitycontaining both the completeChatResponseobject and an entity converted using a specifiedStructuredOutputConverter.<T> ResponseEntity<ChatResponse,T> responseEntity(StructuredOutputConverter<T> structuredOutputConverter, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer) Returns aResponseEntitycontaining both the completeChatResponseobject and an entity converted using a specifiedStructuredOutputConverter, with behaviour configured via theentityParamSpecConsumer.<T> ResponseEntity<ChatResponse,T> responseEntity(org.springframework.core.ParameterizedTypeReference<T> type) Returns aResponseEntitycontaining both the completeChatResponseobject and aCollectionof entity types.<T> ResponseEntity<ChatResponse,T> responseEntity(org.springframework.core.ParameterizedTypeReference<T> type, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer) Returns aResponseEntitycontaining both the completeChatResponseobject and a specific entity type, with behaviour configured via theentityParamSpecConsumer.
-
Constructor Details
-
DefaultCallResponseSpec
public DefaultCallResponseSpec(ChatClientRequest chatClientRequest, BaseAdvisorChain advisorChain, io.micrometer.observation.ObservationRegistry observationRegistry, ChatClientObservationConvention observationConvention)
-
-
Method Details
-
responseEntity
public <T> ResponseEntity<ChatResponse,T> responseEntity(Class<T> type, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer) Description copied from interface:ChatClient.CallResponseSpecReturns aResponseEntitycontaining both the completeChatResponseobject and a specific entity type, with behaviour configured via theentityParamSpecConsumer.- Specified by:
responseEntityin interfaceChatClient.CallResponseSpec- Parameters:
type- the target classentityParamSpecConsumer- configures options such asChatClient.EntityParamSpec.useProviderStructuredOutput()andChatClient.EntityParamSpec.validateSchema()- Returns:
- the
ResponseEntitycontaining both the completeChatResponseobject and the deserialized entity
-
responseEntity
Description copied from interface:ChatClient.CallResponseSpecReturns aResponseEntitycontaining both the completeChatResponseobject and a specific entity type.- Specified by:
responseEntityin interfaceChatClient.CallResponseSpec- Parameters:
type- the target class- Returns:
- the
ResponseEntitycontaining both the completeChatResponseobject and the deserialized entity
-
responseEntity
public <T> ResponseEntity<ChatResponse,T> responseEntity(org.springframework.core.ParameterizedTypeReference<T> type, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer) Description copied from interface:ChatClient.CallResponseSpecReturns aResponseEntitycontaining both the completeChatResponseobject and a specific entity type, with behaviour configured via theentityParamSpecConsumer.- Specified by:
responseEntityin interfaceChatClient.CallResponseSpec- Parameters:
type- the target parameterized typeentityParamSpecConsumer- configures options such asChatClient.EntityParamSpec.useProviderStructuredOutput()andChatClient.EntityParamSpec.validateSchema()- Returns:
- the
ResponseEntitycontaining both the completeChatResponseobject and the deserialized entity
-
responseEntity
public <T> ResponseEntity<ChatResponse,T> responseEntity(org.springframework.core.ParameterizedTypeReference<T> type) Description copied from interface:ChatClient.CallResponseSpecReturns aResponseEntitycontaining both the completeChatResponseobject and aCollectionof entity types.- Specified by:
responseEntityin interfaceChatClient.CallResponseSpec- Parameters:
type- the target parameterized type- Returns:
- the
ResponseEntitycontaining both the completeChatResponseobject and the deserialized entities
-
responseEntity
public <T> ResponseEntity<ChatResponse,T> responseEntity(StructuredOutputConverter<T> structuredOutputConverter, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer) Description copied from interface:ChatClient.CallResponseSpecReturns aResponseEntitycontaining both the completeChatResponseobject and an entity converted using a specifiedStructuredOutputConverter, with behaviour configured via theentityParamSpecConsumer.- Specified by:
responseEntityin interfaceChatClient.CallResponseSpec- Parameters:
structuredOutputConverter- the converter for parsing and schema resolutionentityParamSpecConsumer- configures options such asChatClient.EntityParamSpec.useProviderStructuredOutput()andChatClient.EntityParamSpec.validateSchema()- Returns:
- the
ResponseEntitycontaining both the completeChatResponseobject and the deserialized entity
-
responseEntity
public <T> ResponseEntity<ChatResponse,T> responseEntity(StructuredOutputConverter<T> structuredOutputConverter) Description copied from interface:ChatClient.CallResponseSpecReturns aResponseEntitycontaining both the completeChatResponseobject and an entity converted using a specifiedStructuredOutputConverter.- Specified by:
responseEntityin interfaceChatClient.CallResponseSpec- Parameters:
structuredOutputConverter- the converter for parsing and schema resolution- Returns:
- the
ResponseEntitycontaining both the completeChatResponseobject and the deserialized entity
-
doResponseEntity
protected <T> ResponseEntity<ChatResponse,T> doResponseEntity(StructuredOutputConverter<T> outputConverter) -
doResponseEntity
protected <T> ResponseEntity<ChatResponse,T> doResponseEntity(StructuredOutputConverter<T> outputConverter, BaseAdvisorChain advisorChain) -
entity
public <T> @Nullable T entity(org.springframework.core.ParameterizedTypeReference<T> type, Consumer<ChatClient.EntityParamSpec> entitySpecConsumer) Description copied from interface:ChatClient.CallResponseSpecDeserializes the response into aTinstance, with behaviour configured via theentityParamSpecConsumer.- Specified by:
entityin interfaceChatClient.CallResponseSpec- Parameters:
type- the target parameterized typeentitySpecConsumer- configures options such asChatClient.EntityParamSpec.useProviderStructuredOutput()andChatClient.EntityParamSpec.validateSchema()- Returns:
- the deserialized entity, or
nullif the response is empty
-
entity
public <T> @Nullable T entity(Class<T> type, Consumer<ChatClient.EntityParamSpec> entitySpecConsumer) Description copied from interface:ChatClient.CallResponseSpecDeserializes the response into aTinstance, with behaviour configured via theentityParamSpecConsumer.- Specified by:
entityin interfaceChatClient.CallResponseSpec- Parameters:
type- the target classentitySpecConsumer- configures options such asChatClient.EntityParamSpec.useProviderStructuredOutput()andChatClient.EntityParamSpec.validateSchema()- Returns:
- the deserialized entity, or
nullif the response is empty
-
entity
public <T> @Nullable T entity(org.springframework.core.ParameterizedTypeReference<T> type) Description copied from interface:ChatClient.CallResponseSpecDeserializes the response into aTinstance.- Specified by:
entityin interfaceChatClient.CallResponseSpec- Parameters:
type- the target parameterized type- Returns:
- the deserialized entity, or
nullif the response is empty
-
entity
public <T> @Nullable T entity(StructuredOutputConverter<T> structuredOutputConverter, Consumer<ChatClient.EntityParamSpec> entitySpecConsumer) Description copied from interface:ChatClient.CallResponseSpecDeserializes the response using the given converter, with behaviour configured via theentityParamSpecConsumer.- Specified by:
entityin interfaceChatClient.CallResponseSpec- Parameters:
structuredOutputConverter- the converter for parsing and schema resolutionentitySpecConsumer- configures options such asChatClient.EntityParamSpec.useProviderStructuredOutput()andChatClient.EntityParamSpec.validateSchema()- Returns:
- the deserialized entity, or
nullif the response is empty
-
entity
Description copied from interface:ChatClient.CallResponseSpecDeserializes the response using the given converter.- Specified by:
entityin interfaceChatClient.CallResponseSpec- Parameters:
structuredOutputConverter- the converter for parsing and schema resolution- Returns:
- the deserialized entity, or
nullif the response is empty
-
entity
Description copied from interface:ChatClient.CallResponseSpecDeserializes the response into aTinstance.- Specified by:
entityin interfaceChatClient.CallResponseSpec- Parameters:
type- the target class- Returns:
- the deserialized entity, or
nullif the response is empty
-
chatClientResponse
- Specified by:
chatClientResponsein interfaceChatClient.CallResponseSpec
-
chatResponse
- Specified by:
chatResponsein interfaceChatClient.CallResponseSpec
-
content
- Specified by:
contentin interfaceChatClient.CallResponseSpec
-