Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import org.springframework.ai.model.function.FunctionCallback;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.io.Resource;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.MimeType;

/**
Expand All @@ -49,6 +51,7 @@
* @author Christian Tzolov
* @author Josh Long
* @author Arjen Poutsma
* @author Thomas Vitale
* @since 1.0.0
*/
public interface ChatClient {
Expand All @@ -62,7 +65,9 @@ static ChatClient create(ChatModel chatModel, ObservationRegistry observationReg
}

static ChatClient create(ChatModel chatModel, ObservationRegistry observationRegistry,
ChatClientObservationConvention observationConvention) {
@Nullable ChatClientObservationConvention observationConvention) {
Assert.notNull(chatModel, "chatModel cannot be null");
Assert.notNull(observationRegistry, "observationRegistry cannot be null");
return builder(chatModel, observationRegistry, observationConvention).build();
}

Expand All @@ -71,7 +76,9 @@ static Builder builder(ChatModel chatModel) {
}

static Builder builder(ChatModel chatModel, ObservationRegistry observationRegistry,
ChatClientObservationConvention customObservationConvention) {
@Nullable ChatClientObservationConvention customObservationConvention) {
Assert.notNull(chatModel, "chatModel cannot be null");
Assert.notNull(observationRegistry, "observationRegistry cannot be null");
return new DefaultChatClientBuilder(chatModel, observationRegistry, customObservationConvention);
}

Expand Down Expand Up @@ -136,14 +143,19 @@ interface AdvisorSpec {

interface CallResponseSpec {

@Nullable
<T> T entity(ParameterizedTypeReference<T> type);

@Nullable
<T> T entity(StructuredOutputConverter<T> structuredOutputConverter);

@Nullable
<T> T entity(Class<T> type);

@Nullable
ChatResponse chatResponse();

@Nullable
String content();

<T> ResponseEntity<ChatResponse, T> responseEntity(Class<T> type);
Expand Down
Loading