Skip to content

chore: Modify // @formatter label position and add a blank line to files #3538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 @@ -244,6 +244,7 @@ public ChatResponse call(Prompt prompt) {
.provider(ZhiPuApiConstants.PROVIDER_NAME)
.build();

// @formatter:off
ChatResponse response = ChatModelObservationDocumentation.CHAT_MODEL_OPERATION
.observation(this.observationConvention, DEFAULT_OBSERVATION_CONVENTION, () -> observationContext,
this.observationRegistry)
Expand All @@ -262,13 +263,11 @@ public ChatResponse call(Prompt prompt) {
List<Choice> choices = chatCompletion.choices();

List<Generation> generations = choices.stream().map(choice -> {
// @formatter:off
Map<String, Object> metadata = Map.of(
"id", chatCompletion.id(),
"role", choice.message().role() != null ? choice.message().role().name() : "",
"finishReason", choice.finishReason() != null ? choice.finishReason().name() : ""
);
// @formatter:on
return buildGeneration(choice, metadata);
}).toList();

Expand All @@ -278,6 +277,7 @@ public ChatResponse call(Prompt prompt) {

return chatResponse;
});
// @formatter:on
if (this.toolExecutionEligibilityPredicate.isToolExecutionRequired(requestPrompt.getOptions(), response)) {
var toolExecutionResult = this.toolCallingManager.executeToolCalls(requestPrompt, response);
if (toolExecutionResult.returnDirect()) {
Expand Down Expand Up @@ -326,12 +326,13 @@ public Flux<ChatResponse> stream(Prompt prompt) {

observation.parentObservation(contextView.getOrDefault(ObservationThreadLocalAccessor.KEY, null)).start();

// @formatter:off
Flux<ChatResponse> chatResponse = completionChunks.map(this::chunkToChatCompletion)
.switchMap(chatCompletion -> Mono.just(chatCompletion).map(chatCompletion2 -> {
try {
String id = chatCompletion2.id();

// @formatter:off

List<Generation> generations = chatCompletion2.choices().stream().map(choice -> {
if (choice.message().role() != null) {
roleMap.putIfAbsent(id, choice.message().role().name());
Expand All @@ -353,8 +354,7 @@ public Flux<ChatResponse> stream(Prompt prompt) {
}

}));

// @formatter:off

Flux<ChatResponse> flux = chatResponse.flatMap(response -> {
if (this.toolExecutionEligibilityPredicate.isToolExecutionRequired(requestPrompt.getOptions(), response)) {
return Flux.defer(() -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
org.springframework.aot.hint.RuntimeHintsRegistrar=\
org.springframework.ai.zhipuai.aot.ZhiPuAiRuntimeHints
org.springframework.ai.zhipuai.aot.ZhiPuAiRuntimeHints
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
You are an AI assistant that helps people find information.
Your name is {name}.
You should reply to the user's request with your name and also in the style of a {voice}.
You should reply to the user's request with your name and also in the style of a {voice}.
Loading