Please upgrade the dependency version of kotlinx-datetime from 0.6.2 to 0.7.1
Improve the compatibility with kotlin.time.Instant and kotlin.time.Clock
/**
* This is a deprecated type alias for `kotlinx.datetime.Clock`.
*
* Before 0.7.0, this type was used to represent a clock in the `kotlinx.datetime` library.
* However, in Kotlin 2.1.20,
* the `kotlin.time.Clock` type was introduced and is now the preferred way to represent a clock.
*
* This type alias is kept for making sure the existing code that uses `kotlinx.datetime.Clock` compiles.
* For ensuring binary compatibility instead of source compatibility,
* see <https://github.com/Kotlin/kotlinx-datetime?tab=readme-ov-file#deprecation-of-instant>.
*/
@Deprecated(
"This type is deprecated in favor of `kotlin.time.Clock`.",
level = DeprecationLevel.WARNING,
replaceWith = ReplaceWith("kotlin.time.Clock", "kotlin.time.Clock"))
public typealias Clock = kotlin.time.Clock
When datetime v0.7.0 or higher exists in the project, Koog will have compatibility issues due to this typealias.
#726 #727
When the application has the kotlinx-datetime library version that is less than 0.7.1, it crashes at runtime with this error:
java.lang.NoSuchMethodError: No direct
method <init>(Ljava/lang/String;Lai/koog/prompt/executor/clients/anthr
opic/AnthropicClientSettings;Lio/ktor/client/HttpClient;Lkotlin/time/C
lock;ILkotlin/jvm/internal/DefaultConstructorMarker;)V in class
Lai/koog/prompt/executor/clients/anthropic/AnthropicLLMClient; or its
super classes (declaration of
'ai.koog.prompt.executor.clients.anthropic.AnthropicLLMClient' appears
in /data/app/~~lkg4QDVldpi-pI2a0vafMQ==/dev.olek.lmclient.androidApp-
NNRKrh5iHDxg8pT_BM3UCw==/base.apk)
I get the same problem in v0.4.2.
crash log> java.lang.NoSuchMethodError: 'void ai.koog.prompt.executor.clients.openai.OpenAILLMClient.
open class OpenAiRemoteLLMClient(
apiKey: String, settings: OpenAIClientSettings = OpenAIClientSettings(
baseUrl = "https://.gree.com",
chatCompletionsPath = "/baitong/chat/completions",
embeddingsPath = "https://aiw.gree.com/openapi/v2/embeddings"
), baseClient: HttpClient = HttpClient { }.config {
install(Logging) {
level = LogLevel.ALL
logger = object : Logger {
override fun log(message: String) {
println(message)
}
}
}
}
) : OpenAILLMClient(apiKey, settings, baseClient)
fun createAiClient(apiKey: String): SingleLLMPromptExecutor {
return SingleLLMPromptExecutor(
OpenAILLMClient(
apiKey = apiKey, settings = OpenAIClientSettings(
baseUrl = "https://.gree.com",
chatCompletionsPath = "/baitong/chat/completions",
embeddingsPath = "https://aiw.gree.com/openapi/v2/embeddings"
), baseClient = HttpClient().config {
install(Logging) {
level = LogLevel.ALL
logger = object : Logger {
override fun log(message: String) {
printLog(message)
}
}
}
})
)
}
It can success in v0.4.1 ,failed in v0.4.2. I want to custom a executor,I use kotlinxDatetime-0.6.2 ,but OpenAILLMClient in sdk show inner function arg is kotlinx.datetime.Clock, in v0.6.2 only use kotlin.time.Clock.
I have the same issue. The build fails with "Caused by: java.lang.ClassNotFoundException: kotlinx.datetime.Clock$System" when adding kotlinx-datetime 0.7.1 into my project
Until this gets fixed, you can bump the version to this version
implementation("org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.7.1-0.6.x-compat")
This maintains compatibility with the apis koog uses aswell as newer 0.7.1 version.
Hi everybody, thanks for your input!
Please feel free to track the issue's progress here: KG-544 Upgrade the dependency version of kotlinx-datetime from 0.6.2 to 0.7.1