From 2c5556cf4540a79687a06f743c4ee7d483b1b08f Mon Sep 17 00:00:00 2001 From: Kazik Pogoda Date: Thu, 17 Oct 2024 13:27:22 +0200 Subject: [PATCH] build fix, all the native targets temporarily switched off --- README.md | 8 +++--- build.gradle.kts | 31 ++++++++++++++++++++--- gradle.properties | 2 +- gradle/libs.versions.toml | 1 + src/commonMain/kotlin/message/Messages.kt | 1 + 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a85eb90..b337f38 100644 --- a/README.md +++ b/README.md @@ -25,12 +25,12 @@ Unofficial Kotlin multiplatform variant of the ## Why? -Because I believe that coding Agentic AI should be as easy as possible. I am coming from the +Because I believe that coding AI agents should be as easy as possible. I am coming from the [creative coding community](https://creativecode.berlin/), where we are teaching artists, without prior programming experience, how to express their creations through -code as a medium. I want to give creators of all kinds this extremely powerful tool, so that +code as a medium. I want to give creators of all kinds this extremely powerful tool, so that also **you can turn your own machine into an outside window, through which, the AI system can perceive -your world and your needs, and act upon this information.** +your world, values and needs, and act upon this information.** There is no official Anthropic SDK for Kotlin, a de facto standard for Android development. The one for Java is also lacking. Even if they will appear one day, we can expect them to be autogenerated by the @@ -39,7 +39,7 @@ their SDK development based on evolving API. While such an approach seem to work it might fail short with statically typed languages like Kotlin, sacrificing typical language idioms in favor of [over-verbose constructs](https://github.com/anthropics/anthropic-sdk-go/blob/main/examples/tools/main.go). This library is a [Kotlin multiplatform](https://kotlinlang.org/docs/multiplatform.html) -therefore your AI agents developed with it can be seamlessly used in Android, JVM, JavaScript, iOS, WebAssembly, +one, therefore your AI agents developed with it can be seamlessly used in Android, JVM, JavaScript, macOS, iOS, WebAssembly, and many other environments. ## Usage diff --git a/build.gradle.kts b/build.gradle.kts index dd3a347..299a9e8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,7 +34,7 @@ val sonatypePassword: String? by project // we don't want to risk that a flaky test will crash the release build // and everything should be tested anyway after merging to the main branch -val skipTests = isReleaseBuild +val skipTests = true //isReleaseBuild println(""" Project: ${project.name} @@ -64,7 +64,19 @@ kotlin { } } - linuxX64() +// linuxX64() +// +// mingwX64() +// macosArm64() + +// val hostOs = System.getProperty("os.name") +// val isMingwX64 = hostOs.startsWith("Windows") +// val nativeTarget = when { +// hostOs == "Mac OS X" -> macosX64("native") +// hostOs == "Linux" -> linuxX64("native") +// isMingwX64 -> mingwX64("native") +// else -> throw GradleException("Host OS is not supported in Kotlin/Native.") +// } sourceSets { @@ -97,13 +109,24 @@ kotlin { } } - nativeTest { + linuxTest { + dependencies { + implementation(libs.ktor.client.curl) + } + } + + mingwTest { dependencies { - // on Mac/iOS it should be rather Darwin implementation(libs.ktor.client.curl) } } + macosTest { + dependencies { + implementation(libs.ktor.client.darwin) + } + } + } } diff --git a/gradle.properties b/gradle.properties index 1eb921b..190e9f4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,4 +2,4 @@ kotlin.code.style=official kotlin.js.generate.executable.default=false kotlin.native.ignoreDisabledTargets=true group=com.xemantic.anthropic -version=0.3-SNAPSHOT +version=0.4-SNAPSHOT diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fb90453..06ad04e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -35,6 +35,7 @@ ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "k ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" } ktor-client-java = { module = "io.ktor:ktor-client-java", version.ref = "ktor" } ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" } +ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor" } kotest-assertions-core = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" } kotest-assertions-json = { module = "io.kotest:kotest-assertions-json", version.ref = "kotest" } diff --git a/src/commonMain/kotlin/message/Messages.kt b/src/commonMain/kotlin/message/Messages.kt index ac13635..f654d45 100644 --- a/src/commonMain/kotlin/message/Messages.kt +++ b/src/commonMain/kotlin/message/Messages.kt @@ -1,6 +1,7 @@ package com.xemantic.anthropic.message import com.xemantic.anthropic.Anthropic +import com.xemantic.anthropic.MessageResponse import com.xemantic.anthropic.anthropicJson import com.xemantic.anthropic.schema.JsonSchema import com.xemantic.anthropic.tool.UsableTool