-
Notifications
You must be signed in to change notification settings - Fork 266
Make KoogHttpClient auto closable and add clientName #1184
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
base: develop
Are you sure you want to change the base?
Conversation
Make KoogHttpClient auto closable Rollback renames
d61a561 to
23a0237
Compare
23a0237 to
33321b0
Compare
Qodana for JVM1137 new problems were found
@@ Code coverage @@
+ 72% total lines covered
16659 lines analyzed, 12063 lines covered
# Calculated according to the filters of your coverage tool☁️ View the detailed Qodana report Contact Qodana teamContact us at [email protected]
|
kpavlov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a bunch, @tiginamaria! It’s almost there, but let’s keep the client name parameter and add @EncodeDefault for safety.
http-client/http-client-java/src/main/kotlin/ai/koog/http/client/java/JavaKoogHttpClient.kt
Show resolved
Hide resolved
http-client/http-client-java/src/main/kotlin/ai/koog/http/client/java/JavaKoogHttpClient.kt
Show resolved
Hide resolved
.../commonMain/kotlin/ai/koog/prompt/executor/clients/anthropic/models/AnthropicChatMessages.kt
Show resolved
Hide resolved
.../commonMain/kotlin/ai/koog/prompt/executor/clients/anthropic/models/AnthropicChatMessages.kt
Show resolved
Hide resolved
.../commonMain/kotlin/ai/koog/prompt/executor/clients/anthropic/models/AnthropicChatMessages.kt
Show resolved
Hide resolved
devcrocod
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
I have one question about closing httpClient
| } | ||
| } | ||
|
|
||
| override fun close() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn’t the httpClient being closed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't found a way how to do it, that's why =))) The only way I found is (httpClient.executor().getOrNull() as? ExecutorService)?.shutdown(), is it correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Java 21, the HttpClient is AutoCloseable, but in Java 17, it is not. If the client is using a custom Executor, it should be closed manually. But it's not the case.
Return clientName to KoogHttpClient
kpavlov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| } | ||
| } | ||
|
|
||
| override fun close() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Java 21, the HttpClient is AutoCloseable, but in Java 17, it is not. If the client is using a custom Executor, it should be closed manually. But it's not the case.
Motivation and Context
Address comments from #1179
KoogHttpClientauto closableAnthropicLLMClientmodelAddress comments from #1181
clientNametoKoogHttpClientto represent ktor/okhttp/javaBreaking Changes
Type of the changes
Checklist
developas the base branchAdditional steps for pull requests adding a new feature