Refactor ChatResponseMetadata Builder methods

- Refactor builder methods in `ChatResponseMetadata` to remove `with` prefixes and introduce new methods with updated naming conventions.
- Deprecate existing `with*` methods while maintaining backward compatibility.
- Ensure dependent files and tests are compatible with the updated `ChatResponseMetadata` class.
This commit is contained in:
Alexandros Pappas
2024-12-16 17:52:07 +01:00
committed by Ilayaperumal Gopinathan
parent 8c51f7a84c
commit 19e61bf71a
23 changed files with 194 additions and 122 deletions

View File

@@ -55,6 +55,7 @@ import org.springframework.util.CollectionUtils;
* @author Ben Middleton
* @author Christian Tzolov
* @author Wei Jiang
* @author Alexandros Pappas
* @since 1.0.0
*/
public class BedrockAnthropic3ChatModel implements ChatModel, StreamingChatModel {
@@ -92,9 +93,9 @@ public class BedrockAnthropic3ChatModel implements ChatModel, StreamingChatModel
.toList();
ChatResponseMetadata metadata = ChatResponseMetadata.builder()
.withId(response.id())
.withModel(response.model())
.withUsage(extractUsage(response))
.id(response.id())
.model(response.model())
.usage(extractUsage(response))
.build();
return new ChatResponse(generations, metadata);