Interface ChatClient.CallResponseSpec

All Known Implementing Classes:
DefaultChatClient.DefaultCallResponseSpec
Enclosing interface:
ChatClient

public static interface ChatClient.CallResponseSpec
  • Method Summary

    Modifier and Type
    Method
    Description
     
    @Nullable org.springframework.ai.chat.model.ChatResponse
     
    @Nullable String
     
    <T> @Nullable T
    entity(Class<T> type)
    Deserializes the response into a T instance.
    <T> @Nullable T
    entity(Class<T> type, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer)
    Deserializes the response into a T instance, with behaviour configured via the entityParamSpecConsumer.
    <T> @Nullable T
    entity(org.springframework.ai.converter.StructuredOutputConverter<T> structuredOutputConverter)
    Deserializes the response using the given converter.
    <T> @Nullable T
    entity(org.springframework.ai.converter.StructuredOutputConverter<T> structuredOutputConverter, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer)
    Deserializes the response using the given converter, with behaviour configured via the entityParamSpecConsumer.
    <T> @Nullable T
    entity(org.springframework.core.ParameterizedTypeReference<T> type)
    Deserializes the response into a T instance.
    <T> @Nullable T
    entity(org.springframework.core.ParameterizedTypeReference<T> type, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer)
    Deserializes the response into a T instance, with behaviour configured via the entityParamSpecConsumer.
    <T> ResponseEntity<org.springframework.ai.chat.model.ChatResponse,T>
    Returns a ResponseEntity containing both the complete ChatResponse object and a specific entity type.
    <T> ResponseEntity<org.springframework.ai.chat.model.ChatResponse,T>
    responseEntity(Class<T> type, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer)
    Returns a ResponseEntity containing both the complete ChatResponse object and a specific entity type, with behaviour configured via the entityParamSpecConsumer.
    <T> ResponseEntity<org.springframework.ai.chat.model.ChatResponse,T>
    responseEntity(org.springframework.ai.converter.StructuredOutputConverter<T> structuredOutputConverter)
    Returns a ResponseEntity containing both the complete ChatResponse object and an entity converted using a specified StructuredOutputConverter.
    <T> ResponseEntity<org.springframework.ai.chat.model.ChatResponse,T>
    responseEntity(org.springframework.ai.converter.StructuredOutputConverter<T> structuredOutputConverter, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer)
    Returns a ResponseEntity containing both the complete ChatResponse object and an entity converted using a specified StructuredOutputConverter, with behaviour configured via the entityParamSpecConsumer.
    <T> ResponseEntity<org.springframework.ai.chat.model.ChatResponse,T>
    responseEntity(org.springframework.core.ParameterizedTypeReference<T> type)
    Returns a ResponseEntity containing both the complete ChatResponse object and a Collection of entity types.
    <T> ResponseEntity<org.springframework.ai.chat.model.ChatResponse,T>
    responseEntity(org.springframework.core.ParameterizedTypeReference<T> type, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer)
    Returns a ResponseEntity containing both the complete ChatResponse object and a specific entity type, with behaviour configured via the entityParamSpecConsumer.
  • Method Details

    • entity

      <T> @Nullable T entity(org.springframework.core.ParameterizedTypeReference<T> type, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer)
      Deserializes the response into a T instance, with behaviour configured via the entityParamSpecConsumer.
      Parameters:
      type - the target parameterized type
      entityParamSpecConsumer - configures options such as ChatClient.EntityParamSpec.useProviderStructuredOutput() and ChatClient.EntityParamSpec.validateSchema()
      Returns:
      the deserialized entity, or null if the response is empty
    • entity

      <T> @Nullable T entity(org.springframework.core.ParameterizedTypeReference<T> type)
      Deserializes the response into a T instance.
      Parameters:
      type - the target parameterized type
      Returns:
      the deserialized entity, or null if the response is empty
    • entity

      <T> @Nullable T entity(org.springframework.ai.converter.StructuredOutputConverter<T> structuredOutputConverter, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer)
      Deserializes the response using the given converter, with behaviour configured via the entityParamSpecConsumer.
      Parameters:
      structuredOutputConverter - the converter for parsing and schema resolution
      entityParamSpecConsumer - configures options such as ChatClient.EntityParamSpec.useProviderStructuredOutput() and ChatClient.EntityParamSpec.validateSchema()
      Returns:
      the deserialized entity, or null if the response is empty
    • entity

      <T> @Nullable T entity(org.springframework.ai.converter.StructuredOutputConverter<T> structuredOutputConverter)
      Deserializes the response using the given converter.
      Parameters:
      structuredOutputConverter - the converter for parsing and schema resolution
      Returns:
      the deserialized entity, or null if the response is empty
    • entity

      <T> @Nullable T entity(Class<T> type, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer)
      Deserializes the response into a T instance, with behaviour configured via the entityParamSpecConsumer.
      Parameters:
      type - the target class
      entityParamSpecConsumer - configures options such as ChatClient.EntityParamSpec.useProviderStructuredOutput() and ChatClient.EntityParamSpec.validateSchema()
      Returns:
      the deserialized entity, or null if the response is empty
    • entity

      <T> @Nullable T entity(Class<T> type)
      Deserializes the response into a T instance.
      Parameters:
      type - the target class
      Returns:
      the deserialized entity, or null if the response is empty
    • chatClientResponse

      ChatClientResponse chatClientResponse()
    • chatResponse

      @Nullable org.springframework.ai.chat.model.ChatResponse chatResponse()
    • content

      @Nullable String content()
    • responseEntity

      <T> ResponseEntity<org.springframework.ai.chat.model.ChatResponse,T> responseEntity(Class<T> type, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer)
      Returns a ResponseEntity containing both the complete ChatResponse object and a specific entity type, with behaviour configured via the entityParamSpecConsumer.
      Parameters:
      type - the target class
      entityParamSpecConsumer - configures options such as ChatClient.EntityParamSpec.useProviderStructuredOutput() and ChatClient.EntityParamSpec.validateSchema()
      Returns:
      the ResponseEntity containing both the complete ChatResponse object and the deserialized entity
    • responseEntity

      <T> ResponseEntity<org.springframework.ai.chat.model.ChatResponse,T> responseEntity(Class<T> type)
      Returns a ResponseEntity containing both the complete ChatResponse object and a specific entity type.
      Parameters:
      type - the target class
      Returns:
      the ResponseEntity containing both the complete ChatResponse object and the deserialized entity
    • responseEntity

      <T> ResponseEntity<org.springframework.ai.chat.model.ChatResponse,T> responseEntity(org.springframework.core.ParameterizedTypeReference<T> type, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer)
      Returns a ResponseEntity containing both the complete ChatResponse object and a specific entity type, with behaviour configured via the entityParamSpecConsumer.
      Parameters:
      type - the target parameterized type
      entityParamSpecConsumer - configures options such as ChatClient.EntityParamSpec.useProviderStructuredOutput() and ChatClient.EntityParamSpec.validateSchema()
      Returns:
      the ResponseEntity containing both the complete ChatResponse object and the deserialized entity
    • responseEntity

      <T> ResponseEntity<org.springframework.ai.chat.model.ChatResponse,T> responseEntity(org.springframework.core.ParameterizedTypeReference<T> type)
      Returns a ResponseEntity containing both the complete ChatResponse object and a Collection of entity types.
      Parameters:
      type - the target parameterized type
      Returns:
      the ResponseEntity containing both the complete ChatResponse object and the deserialized entities
    • responseEntity

      <T> ResponseEntity<org.springframework.ai.chat.model.ChatResponse,T> responseEntity(org.springframework.ai.converter.StructuredOutputConverter<T> structuredOutputConverter, Consumer<ChatClient.EntityParamSpec> entityParamSpecConsumer)
      Returns a ResponseEntity containing both the complete ChatResponse object and an entity converted using a specified StructuredOutputConverter, with behaviour configured via the entityParamSpecConsumer.
      Parameters:
      structuredOutputConverter - the converter for parsing and schema resolution
      entityParamSpecConsumer - configures options such as ChatClient.EntityParamSpec.useProviderStructuredOutput() and ChatClient.EntityParamSpec.validateSchema()
      Returns:
      the ResponseEntity containing both the complete ChatResponse object and the deserialized entity
    • responseEntity

      <T> ResponseEntity<org.springframework.ai.chat.model.ChatResponse,T> responseEntity(org.springframework.ai.converter.StructuredOutputConverter<T> structuredOutputConverter)
      Returns a ResponseEntity containing both the complete ChatResponse object and an entity converted using a specified StructuredOutputConverter.
      Parameters:
      structuredOutputConverter - the converter for parsing and schema resolution
      Returns:
      the ResponseEntity containing both the complete ChatResponse object and the deserialized entity