Skip to content

Commit c4fa383

Browse files
committed
OPIK-610 PR comments
1 parent 59604a1 commit c4fa383

File tree

4 files changed

+25
-23
lines changed

4 files changed

+25
-23
lines changed

apps/opik-backend/config.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ llmProviderClient:
224224
# Default: 60s
225225
# Description: Write timeout for LLM providers
226226
writeTimeout: ${LLM_PROVIDER_CLIENT_WRITE_TIMEOUT:-60s}
227+
# Default: false
228+
# Description: Whether or not to log requests
229+
logRequests: ${LLM_PROVIDER_CLIENT_LOG_REQUESTS:-false}
230+
# Default: false
231+
# Description: Whether or not to log responses
232+
logResponses: ${LLM_PROVIDER_CLIENT_LOG_RESPONSES:-false}
227233
# Configuration for OpenAI client
228234
openAiClient:
229235
# Default:
@@ -233,13 +239,7 @@ llmProviderClient:
233239
anthropicClient:
234240
# Default: https://api.anthropic.com/v1/
235241
# Description: Anthropic API base URL
236-
baseUrl: ${LLM_PROVIDER_ANTHROPIC_BASE_URL:-https://api.anthropic.com/v1/}
242+
url: ${LLM_PROVIDER_ANTHROPIC_BASE_URL:-https://api.anthropic.com/v1/}
237243
# Default: 2023-06-01
238244
# Description: Anthropic API version https://docs.anthropic.com/en/api/versioning
239245
version: ${LLM_PROVIDER_ANTHROPIC_VERSION:-'2023-06-01'}
240-
# Default: false
241-
# Description: Whether or not to log requests
242-
logRequests: ${LLM_PROVIDER_ANTHROPIC_LOG_REQUESTS:-false}
243-
# Default: false
244-
# Description: Whether or not to log responses
245-
logResponses: ${LLM_PROVIDER_ANTHROPIC_LOG_RESPONSES:-false}

apps/opik-backend/src/main/java/com/comet/opik/domain/llmproviders/LlmProviderAnthropic.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ private ChatCompletionChoice toChatCompletionChoice(
168168
private AnthropicClient newClient(String apiKey) {
169169
var anthropicClientBuilder = AnthropicClient.builder();
170170
Optional.ofNullable(llmProviderClientConfig.getAnthropicClient())
171-
.map(LlmProviderClientConfig.AnthropicClientConfig::baseUrl)
172-
.ifPresent(baseUrl -> {
173-
if (StringUtils.isNotEmpty(baseUrl)) {
174-
anthropicClientBuilder.baseUrl(baseUrl);
171+
.map(LlmProviderClientConfig.AnthropicClientConfig::url)
172+
.ifPresent(url -> {
173+
if (StringUtils.isNotEmpty(url)) {
174+
anthropicClientBuilder.baseUrl(url);
175175
}
176176
});
177177
Optional.ofNullable(llmProviderClientConfig.getAnthropicClient())
@@ -181,11 +181,9 @@ private AnthropicClient newClient(String apiKey) {
181181
anthropicClientBuilder.version(version);
182182
}
183183
});
184-
Optional.ofNullable(llmProviderClientConfig.getAnthropicClient())
185-
.map(LlmProviderClientConfig.AnthropicClientConfig::logRequests)
184+
Optional.ofNullable(llmProviderClientConfig.getLogRequests())
186185
.ifPresent(anthropicClientBuilder::logRequests);
187-
Optional.ofNullable(llmProviderClientConfig.getAnthropicClient())
188-
.map(LlmProviderClientConfig.AnthropicClientConfig::logResponses)
186+
Optional.ofNullable(llmProviderClientConfig.getLogResponses())
189187
.ifPresent(anthropicClientBuilder::logResponses);
190188
// anthropic client builder only receives one timeout variant
191189
Optional.ofNullable(llmProviderClientConfig.getCallTimeout())

apps/opik-backend/src/main/java/com/comet/opik/infrastructure/LlmProviderClientConfig.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class LlmProviderClientConfig {
1515
public record OpenAiClientConfig(String url) {
1616
}
1717

18-
public record AnthropicClientConfig(String baseUrl, String version, boolean logRequests, boolean logResponses) {
18+
public record AnthropicClientConfig(String url, String version) {
1919
}
2020

2121
@Min(1)
@@ -40,6 +40,10 @@ public record AnthropicClientConfig(String baseUrl, String version, boolean logR
4040
@MinDuration(value = 1, unit = TimeUnit.MILLISECONDS)
4141
private Duration writeTimeout;
4242

43+
private Boolean logRequests;
44+
45+
private Boolean logResponses;
46+
4347
@Valid
4448
private LlmProviderClientConfig.OpenAiClientConfig openAiClient;
4549

apps/opik-backend/src/test/resources/config-test.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ llmProviderClient:
187187
# Default: 60s
188188
# Description: Call timeout for LLM providers
189189
callTimeout: 60s
190+
# Default: false
191+
# Description: Whether or not to log requests
192+
logRequests: false
193+
# Default: false
194+
# Description: Whether or not to log responses
195+
logResponses: false
190196
openAiClient:
191197
# See demo endpoint Langchain4j documentation: https://docs.langchain4j.dev/get-started
192198
# Not https but only used for testing purposes. It's fine as long as not sensitive data is sent.
@@ -195,13 +201,7 @@ llmProviderClient:
195201
anthropicClient:
196202
# Default: https://api.anthropic.com/v1/
197203
# Description: Anthropic API base URL
198-
baseUrl: https://api.anthropic.com/v1/
204+
url: https://api.anthropic.com/v1/
199205
# Default: 2023-06-01
200206
# Description: Anthropic API version https://docs.anthropic.com/en/api/versioning
201207
version: '2023-06-01'
202-
# Default: false
203-
# Description: Whether or not to log requests
204-
logRequests: false
205-
# Default: false
206-
# Description: Whether or not to log responses
207-
logResponses: false

0 commit comments

Comments
 (0)