-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Description
It seems that all API call result is used for getBody() only, for example:
spring-ai/models/spring-ai-openai/src/main/java/org/springframework/ai/openai/OpenAiChatModel.java
Lines 199 to 202 in db9ac2f
| ResponseEntity<ChatCompletion> completionEntity = this.retryTemplate | |
| .execute(ctx -> this.openAiApi.chatCompletionEntity(request, getAdditionalHttpHeaders(prompt))); | |
| var chatCompletion = completionEntity.getBody(); |
I think it's better to return domain object directly instead of spring-web API, make it be parity to method parameters, like ChromaApi does:
Lines 128 to 137 in db9ac2f
| public Tenant getTenant(String tenantName) { | |
| try { | |
| return this.restClient.get() | |
| .uri("/api/v2/tenants/{tenant_name}", tenantName) | |
| .headers(this::httpHeaders) | |
| .retrieve() | |
| .toEntity(Tenant.class) | |
| .getBody(); | |
| } |
CAUTION: It's breaking changes.