Skip to content
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

package changed to com.xemantic.anthropic, group changed to com.xeman… #26

Merged
merged 1 commit into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Unofficial Kotlin multiplatform variant of the
[Antropic SDK](https://docs.anthropic.com/en/api/client-sdks).

[<img alt="Maven Central Version" src="https://img.shields.io/maven-central/v/com.xemantic.anthropic/anthropic-sdk-kotlin">](https://central.sonatype.com/namespace/com.xemantic.anthropic/anthropic-sdk-kotlin)
[<img alt="Maven Central Version" src="https://img.shields.io/maven-central/v/com.xemantic.ai/anthropic-sdk-kotlin">](https://central.sonatype.com/namespace/com.xemantic.ai/anthropic-sdk-kotlin)
[<img alt="GitHub Release Date" src="https://img.shields.io/github/release-date/xemantic/anthropic-sdk-kotlin">](https://github.com/xemantic/anthropic-sdk-kotlin/releases)
[<img alt="license" src="https://img.shields.io/github/license/xemantic/anthropic-sdk-kotlin?color=blue">](https://github.com/xemantic/anthropic-sdk-kotlin/blob/main/LICENSE)

Expand Down Expand Up @@ -63,7 +63,7 @@ Otherwise, you need to add to your `build.gradle.kts`:

```kotlin
dependencies {
implementation("com.xemantic.anthropic:anthropic-sdk-kotlin:0.11")
implementation("com.xemantic.ai:anthropic-sdk-kotlin:0.11")
}
```

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
val groupId = "com.xemantic.anthropic"
val groupId = "com.xemantic.ai"
val name = "anthropic-sdk-kotlin"

rootProject.name = name
Expand Down
30 changes: 15 additions & 15 deletions src/commonMain/kotlin/Anthropic.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
* limitations under the License.
*/

package com.xemantic.anthropic

import com.xemantic.anthropic.error.AnthropicException
import com.xemantic.anthropic.error.ErrorResponse
import com.xemantic.anthropic.event.Event
import com.xemantic.anthropic.cache.CacheControl
import com.xemantic.anthropic.content.ToolUse
import com.xemantic.anthropic.message.MessageRequest
import com.xemantic.anthropic.message.MessageResponse
import com.xemantic.anthropic.tool.BuiltInTool
import com.xemantic.anthropic.tool.Tool
import com.xemantic.anthropic.tool.ToolInput
import com.xemantic.anthropic.usage.Cost
import com.xemantic.anthropic.usage.Usage
import com.xemantic.anthropic.usage.UsageCollector
package com.xemantic.ai.anthropic

import com.xemantic.ai.anthropic.error.AnthropicException
import com.xemantic.ai.anthropic.error.ErrorResponse
import com.xemantic.ai.anthropic.event.Event
import com.xemantic.ai.anthropic.cache.CacheControl
import com.xemantic.ai.anthropic.content.ToolUse
import com.xemantic.ai.anthropic.message.MessageRequest
import com.xemantic.ai.anthropic.message.MessageResponse
import com.xemantic.ai.anthropic.tool.BuiltInTool
import com.xemantic.ai.anthropic.tool.Tool
import com.xemantic.ai.anthropic.tool.ToolInput
import com.xemantic.ai.anthropic.usage.Cost
import com.xemantic.ai.anthropic.usage.Usage
import com.xemantic.ai.anthropic.usage.UsageCollector
import io.ktor.client.HttpClient
import io.ktor.client.call.body
import io.ktor.client.plugins.*
Expand Down
36 changes: 18 additions & 18 deletions src/commonMain/kotlin/AnthropicJson.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@
* limitations under the License.
*/

package com.xemantic.anthropic

import com.xemantic.anthropic.batch.MessageBatchResponse
import com.xemantic.anthropic.content.Content
import com.xemantic.anthropic.content.Document
import com.xemantic.anthropic.error.ErrorResponse
import com.xemantic.anthropic.content.Image
import com.xemantic.anthropic.content.Text
import com.xemantic.anthropic.message.MessageResponse
import com.xemantic.anthropic.content.ToolResult
import com.xemantic.anthropic.content.ToolUse
import com.xemantic.anthropic.tool.BuiltInTool
import com.xemantic.anthropic.tool.DefaultTool
import com.xemantic.anthropic.tool.Tool
import com.xemantic.anthropic.tool.bash.Bash
import com.xemantic.anthropic.tool.computer.Computer
import com.xemantic.anthropic.tool.editor.TextEditor
package com.xemantic.ai.anthropic

import com.xemantic.ai.anthropic.batch.MessageBatchResponse
import com.xemantic.ai.anthropic.content.Content
import com.xemantic.ai.anthropic.content.Document
import com.xemantic.ai.anthropic.error.ErrorResponse
import com.xemantic.ai.anthropic.content.Image
import com.xemantic.ai.anthropic.content.Text
import com.xemantic.ai.anthropic.message.MessageResponse
import com.xemantic.ai.anthropic.content.ToolResult
import com.xemantic.ai.anthropic.content.ToolUse
import com.xemantic.ai.anthropic.tool.BuiltInTool
import com.xemantic.ai.anthropic.tool.DefaultTool
import com.xemantic.ai.anthropic.tool.Tool
import com.xemantic.ai.anthropic.tool.bash.Bash
import com.xemantic.ai.anthropic.tool.computer.Computer
import com.xemantic.ai.anthropic.tool.editor.TextEditor
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.InternalSerializationApi
import kotlinx.serialization.KSerializer
Expand Down Expand Up @@ -134,7 +134,7 @@ private object ToolSerializer : KSerializer<Tool> {

@OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class)
override val descriptor: SerialDescriptor = buildSerialDescriptor(
serialName = "com.xemantic.anthropic.Tool",
serialName = "com.xemantic.ai.anthropic.Tool",
kind = SerialKind.CONTEXTUAL
)

Expand Down
4 changes: 2 additions & 2 deletions src/commonMain/kotlin/Models.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

package com.xemantic.anthropic
package com.xemantic.ai.anthropic

import com.xemantic.ai.money.Money
import com.xemantic.ai.money.Ratio
import com.xemantic.anthropic.usage.Cost
import com.xemantic.ai.anthropic.usage.Cost

/**
* The model used by the API.
Expand Down
2 changes: 1 addition & 1 deletion src/commonMain/kotlin/Responses.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.xemantic.anthropic
package com.xemantic.ai.anthropic

import kotlinx.serialization.Serializable

Expand Down
6 changes: 3 additions & 3 deletions src/commonMain/kotlin/batch/Batches.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

package com.xemantic.anthropic.batch
package com.xemantic.ai.anthropic.batch

import com.xemantic.anthropic.Response
import com.xemantic.anthropic.message.Message
import com.xemantic.ai.anthropic.Response
import com.xemantic.ai.anthropic.message.Message
import kotlinx.datetime.Instant
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
2 changes: 1 addition & 1 deletion src/commonMain/kotlin/cache/Cache.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.xemantic.anthropic.cache
package com.xemantic.ai.anthropic.cache

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
4 changes: 2 additions & 2 deletions src/commonMain/kotlin/content/Content.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package com.xemantic.anthropic.content
package com.xemantic.ai.anthropic.content

import com.xemantic.anthropic.cache.CacheControl
import com.xemantic.ai.anthropic.cache.CacheControl
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
4 changes: 2 additions & 2 deletions src/commonMain/kotlin/content/Document.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package com.xemantic.anthropic.content
package com.xemantic.ai.anthropic.content

import com.xemantic.anthropic.cache.CacheControl
import com.xemantic.ai.anthropic.cache.CacheControl
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlin.io.encoding.ExperimentalEncodingApi
Expand Down
4 changes: 2 additions & 2 deletions src/commonMain/kotlin/content/Image.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package com.xemantic.anthropic.content
package com.xemantic.ai.anthropic.content

import com.xemantic.anthropic.cache.CacheControl
import com.xemantic.ai.anthropic.cache.CacheControl
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand Down
2 changes: 1 addition & 1 deletion src/commonMain/kotlin/content/MagicNumbers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.xemantic.anthropic.content
package com.xemantic.ai.anthropic.content

@OptIn(ExperimentalUnsignedTypes::class)
enum class MagicNumber(
Expand Down
4 changes: 2 additions & 2 deletions src/commonMain/kotlin/content/Text.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package com.xemantic.anthropic.content
package com.xemantic.ai.anthropic.content

import com.xemantic.anthropic.cache.CacheControl
import com.xemantic.ai.anthropic.cache.CacheControl
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand Down
10 changes: 5 additions & 5 deletions src/commonMain/kotlin/content/Tool.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* limitations under the License.
*/

package com.xemantic.anthropic.content
package com.xemantic.ai.anthropic.content

import com.xemantic.anthropic.anthropicJson
import com.xemantic.anthropic.cache.CacheControl
import com.xemantic.anthropic.tool.Tool
import com.xemantic.anthropic.tool.ToolInput
import com.xemantic.ai.anthropic.anthropicJson
import com.xemantic.ai.anthropic.cache.CacheControl
import com.xemantic.ai.anthropic.tool.Tool
import com.xemantic.ai.anthropic.tool.ToolInput
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.Transient
Expand Down
4 changes: 2 additions & 2 deletions src/commonMain/kotlin/error/Errors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package com.xemantic.anthropic.error
package com.xemantic.ai.anthropic.error

import com.xemantic.anthropic.Response
import com.xemantic.ai.anthropic.Response
import io.ktor.http.HttpStatusCode
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
6 changes: 3 additions & 3 deletions src/commonMain/kotlin/event/Events.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

package com.xemantic.anthropic.event
package com.xemantic.ai.anthropic.event

import com.xemantic.anthropic.message.MessageResponse
import com.xemantic.anthropic.message.StopReason
import com.xemantic.ai.anthropic.message.MessageResponse
import com.xemantic.ai.anthropic.message.StopReason
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
2 changes: 1 addition & 1 deletion src/commonMain/kotlin/message/MessageSupport.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
* limitations under the License.
*/

package com.xemantic.anthropic.message
package com.xemantic.ai.anthropic.message

fun <T> List<T>.toNullIfEmpty(): List<T>? = if (isEmpty()) null else this
34 changes: 17 additions & 17 deletions src/commonMain/kotlin/message/Messages.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
* limitations under the License.
*/

package com.xemantic.anthropic.message

import com.xemantic.anthropic.Model
import com.xemantic.anthropic.Response
import com.xemantic.anthropic.cache.CacheControl
import com.xemantic.anthropic.content.Content
import com.xemantic.anthropic.content.ContentBuilder
import com.xemantic.anthropic.content.ToolUse
import com.xemantic.anthropic.toPrettyJson
import com.xemantic.anthropic.tool.Tool
import com.xemantic.anthropic.tool.ToolChoice
import com.xemantic.anthropic.tool.ToolInput
import com.xemantic.anthropic.tool.toolName
import com.xemantic.anthropic.usage.Usage
package com.xemantic.ai.anthropic.message

import com.xemantic.ai.anthropic.Model
import com.xemantic.ai.anthropic.Response
import com.xemantic.ai.anthropic.cache.CacheControl
import com.xemantic.ai.anthropic.content.Content
import com.xemantic.ai.anthropic.content.ContentBuilder
import com.xemantic.ai.anthropic.content.ToolUse
import com.xemantic.ai.anthropic.toPrettyJson
import com.xemantic.ai.anthropic.tool.Tool
import com.xemantic.ai.anthropic.tool.ToolChoice
import com.xemantic.ai.anthropic.tool.ToolInput
import com.xemantic.ai.anthropic.tool.toolName
import com.xemantic.ai.anthropic.usage.Usage
import kotlinx.serialization.*
import kotlin.collections.mutableListOf

Expand Down Expand Up @@ -93,7 +93,7 @@ data class MessageRequest(

/**
* Will fill [tools] with all the tools defined
* when creating this [com.xemantic.anthropic.Anthropic] client.
* when creating this [com.xemantic.ai.anthropic.Anthropic] client.
*/
fun allTools() {
tools = toolMap.values.toList()
Expand All @@ -106,7 +106,7 @@ data class MessageRequest(

/**
* Sets both, the [tools] list and the [toolChoice] with
* just one tool to use, forcing the API to respond with the [com.xemantic.anthropic.content.ToolUse].
* just one tool to use, forcing the API to respond with the [com.xemantic.ai.anthropic.content.ToolUse].
*/
inline fun <reified T : ToolInput> singleTool() {
val name = toolName<T>()
Expand All @@ -121,7 +121,7 @@ data class MessageRequest(
/**
* Sets both, the [tools] list and the [toolChoice] with
* just one tool to use, forcing the API to respond with the
* [com.xemantic.anthropic.content.ToolUse] instance.
* [com.xemantic.ai.anthropic.content.ToolUse] instance.
*/
fun chooseTool(name: String) {
val tool = requireNotNull(toolMap[name]) {
Expand Down
10 changes: 5 additions & 5 deletions src/commonMain/kotlin/tool/Tools.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

package com.xemantic.anthropic.tool
package com.xemantic.ai.anthropic.tool

import com.xemantic.ai.tool.schema.JsonSchema
import com.xemantic.ai.tool.schema.generator.jsonSchemaOf
import com.xemantic.ai.tool.schema.meta.Description
import com.xemantic.anthropic.anthropicJson
import com.xemantic.anthropic.cache.CacheControl
import com.xemantic.anthropic.content.Content
import com.xemantic.anthropic.content.ToolResult
import com.xemantic.ai.anthropic.anthropicJson
import com.xemantic.ai.anthropic.cache.CacheControl
import com.xemantic.ai.anthropic.content.Content
import com.xemantic.ai.anthropic.content.ToolResult
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.InternalSerializationApi
import kotlinx.serialization.KSerializer
Expand Down
8 changes: 4 additions & 4 deletions src/commonMain/kotlin/tool/bash/Bash.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

package com.xemantic.anthropic.tool.bash
package com.xemantic.ai.anthropic.tool.bash

import com.xemantic.anthropic.cache.CacheControl
import com.xemantic.anthropic.tool.BuiltInTool
import com.xemantic.anthropic.tool.ToolInput
import com.xemantic.ai.anthropic.cache.CacheControl
import com.xemantic.ai.anthropic.tool.BuiltInTool
import com.xemantic.ai.anthropic.tool.ToolInput
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
10 changes: 5 additions & 5 deletions src/commonMain/kotlin/tool/computer/Computer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* limitations under the License.
*/

package com.xemantic.anthropic.tool.computer
package com.xemantic.ai.anthropic.tool.computer

import com.xemantic.anthropic.cache.CacheControl
import com.xemantic.anthropic.content.Image
import com.xemantic.anthropic.tool.BuiltInTool
import com.xemantic.anthropic.tool.ToolInput
import com.xemantic.ai.anthropic.cache.CacheControl
import com.xemantic.ai.anthropic.content.Image
import com.xemantic.ai.anthropic.tool.BuiltInTool
import com.xemantic.ai.anthropic.tool.ToolInput
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
8 changes: 4 additions & 4 deletions src/commonMain/kotlin/tool/editor/TextEditor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

package com.xemantic.anthropic.tool.editor
package com.xemantic.ai.anthropic.tool.editor

import com.xemantic.anthropic.cache.CacheControl
import com.xemantic.anthropic.tool.BuiltInTool
import com.xemantic.anthropic.tool.ToolInput
import com.xemantic.ai.anthropic.cache.CacheControl
import com.xemantic.ai.anthropic.tool.BuiltInTool
import com.xemantic.ai.anthropic.tool.ToolInput
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
Loading
Loading