Skip to content

Commit 833ad3e

Browse files
authored
Upgrade sdk to 0.1.4 (#21)
* Upgrade SDK stainless commit: d1e0a4cca87ede7f481c21dc9952c87d5ed80cf4 - Apply spotless on local module - Fix compiler error on deprecated methods - Upgrade dependency versions during build/publishing * Upgrade to 0.1.14 - stainless commit 54e2da8f4266be1059f5e989fec3c05fc7c32293 - Manual patch on validate() on TelemetryGetSpanTreeParams and TelemetryQueryTracesParams - Update local module to reflect the latest changes * Fix dependency compilation issue - Add back local dependency that was accidentally removed - Use 1.9.22 kotlin jvm for wider compatibility support * Update README.md * Fix validate() error * Fix version number
1 parent def17d0 commit 833ad3e

File tree

351 files changed

+8540
-3402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

351 files changed

+8540
-3402
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Features:
88
- Remote Inferencing: Perform inferencing tasks remotely with Llama models hosted on a remote connection (or serverless localhost).
99
- Simple Integration: With easy-to-use APIs, a developer can quickly integrate Llama Stack in their Android app. The difference with local vs remote inferencing is also minimal.
1010

11-
Latest Release Notes: [v0.1.2](https://github.com/meta-llama/llama-stack-client-kotlin/releases/tag/v0.1.2)
11+
Latest Release Notes: [v0.1.4](https://github.com/meta-llama/llama-stack-client-kotlin/releases/tag/v0.1.4)
1212

1313
*Tagged releases are stable versions of the project. While we strive to maintain a stable main branch, it's not guaranteed to be free of bugs or issues.*
1414

@@ -24,7 +24,7 @@ The key files in the app are `ExampleLlamaStackLocalInference.kt`, `ExampleLlama
2424
Add the following dependency in your `build.gradle.kts` file:
2525
```
2626
dependencies {
27-
implementation("com.llama.llamastack:llama-stack-client-kotlin:0.1.2")
27+
implementation("com.llama.llamastack:llama-stack-client-kotlin:0.1.4")
2828
}
2929
```
3030
This will download jar files in your gradle cache in a directory like `~/.gradle/caches/modules-2/files-2.1/com.llama.llamastack/`
@@ -60,7 +60,7 @@ Start a Llama Stack server on localhost. Here is an example of how you can do th
6060
```
6161
conda create -n stack-fireworks python=3.10
6262
conda activate stack-fireworks
63-
pip install llama-stack=0.1.2
63+
pip install llama-stack=0.1.4
6464
llama stack build --template fireworks --image-type conda
6565
export FIREWORKS_API_KEY=<SOME_KEY>
6666
llama stack run /Users/<your_username>/.llama/distributions/llamastack-fireworks/fireworks-run.yaml --port=5050
@@ -99,7 +99,7 @@ client = LlamaStackClientLocalClient
9999
client = LlamaStackClientOkHttpClient
100100
.builder()
101101
.baseUrl(remoteURL)
102-
.headers(mapOf("x-llamastack-client-version" to listOf("0.1.2")))
102+
.headers(mapOf("x-llamastack-client-version" to listOf("0.1.4")))
103103
.build()
104104
```
105105
</td>
@@ -286,7 +286,7 @@ The purpose of this section is to share more details with users that would like
286286
### Prerequisite
287287

288288
You must complete the following steps:
289-
1. Clone the repo (`git clone https://github.com/meta-llama/llama-stack-client-kotlin.git -b release/0.1.2`)
289+
1. Clone the repo (`git clone https://github.com/meta-llama/llama-stack-client-kotlin.git -b release/0.1.4`)
290290
2. Port the appropriate ExecuTorch libraries over into your Llama Stack Kotlin library environment.
291291
```
292292
cd llama-stack-client-kotlin-client-local

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ plugins {
44

55
allprojects {
66
group = "com.llama.llamastack"
7-
version = "0.1.2"
7+
version = "0.1.4"
88
}

buildSrc/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repositories {
1010
}
1111

1212
dependencies {
13-
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0")
13+
implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2")
1414
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
1515
implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0")
1616
}

buildSrc/src/main/kotlin/llama-stack-client.kotlin.gradle.kts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import com.diffplug.gradle.spotless.SpotlessExtension
2+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
23
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3-
import com.vanniktech.maven.publish.*
44

55
plugins {
66
id("llama-stack-client.java")
@@ -21,9 +21,19 @@ configure<SpotlessExtension> {
2121
}
2222

2323
tasks.withType<KotlinCompile>().configureEach {
24-
kotlinOptions {
25-
allWarningsAsErrors = true
26-
freeCompilerArgs = listOf("-Xjvm-default=all", "-Xjdk-release=1.8")
27-
jvmTarget = "1.8"
24+
compilerOptions {
25+
freeCompilerArgs = listOf(
26+
"-Xjvm-default=all",
27+
"-Xjdk-release=1.8",
28+
// Suppress deprecation warnings because we may still reference and test deprecated members.
29+
"-Xsuppress-warning=DEPRECATION"
30+
)
31+
jvmTarget.set(JvmTarget.JVM_1_8)
2832
}
29-
}
33+
}
34+
35+
// Run tests in parallel to some degree.
36+
tasks.withType<Test>().configureEach {
37+
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
38+
forkEvery = 100
39+
}

llama-stack-client-kotlin-client-local/src/main/kotlin/com/llama/llamastack/client/local/InferenceServiceLocalImpl.kt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ import com.llama.llamastack.models.InferenceEmbeddingsParams
1818
import com.llama.llamastack.services.blocking.InferenceService
1919
import org.pytorch.executorch.LlamaCallback
2020

21-
class InferenceServiceLocalImpl
22-
constructor(
23-
private val clientOptions: LocalClientOptions,
24-
) : InferenceService, LlamaCallback {
21+
class InferenceServiceLocalImpl constructor(private val clientOptions: LocalClientOptions) :
22+
InferenceService, LlamaCallback {
2523

2624
private var resultMessage: String = ""
2725
private var onResultComplete: Boolean = false
@@ -69,7 +67,7 @@ constructor(
6967

7068
override fun chatCompletion(
7169
params: InferenceChatCompletionParams,
72-
requestOptions: RequestOptions
70+
requestOptions: RequestOptions,
7371
): ChatCompletionResponse {
7472
isStreaming = false
7573
clearElements()
@@ -132,7 +130,7 @@ constructor(
132130

133131
override fun chatCompletionStreaming(
134132
params: InferenceChatCompletionParams,
135-
requestOptions: RequestOptions
133+
requestOptions: RequestOptions,
136134
): StreamResponse<ChatCompletionResponseStreamChunk> {
137135
isStreaming = true
138136
streamingResponseList.clear()
@@ -156,21 +154,21 @@ constructor(
156154

157155
override fun completion(
158156
params: InferenceCompletionParams,
159-
requestOptions: RequestOptions
157+
requestOptions: RequestOptions,
160158
): CompletionResponse {
161159
TODO("Not yet implemented")
162160
}
163161

164162
override fun completionStreaming(
165163
params: InferenceCompletionParams,
166-
requestOptions: RequestOptions
164+
requestOptions: RequestOptions,
167165
): StreamResponse<CompletionResponse> {
168166
TODO("Not yet implemented")
169167
}
170168

171169
override fun embeddings(
172170
params: InferenceEmbeddingsParams,
173-
requestOptions: RequestOptions
171+
requestOptions: RequestOptions,
174172
): EmbeddingsResponse {
175173
TODO("Not yet implemented")
176174
}

llama-stack-client-kotlin-client-local/src/main/kotlin/com/llama/llamastack/client/local/LlamaStackClientClientLocalImpl.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ import com.llama.llamastack.client.LlamaStackClientClientAsync
77
import com.llama.llamastack.models.*
88
import com.llama.llamastack.services.blocking.*
99

10-
class LlamaStackClientClientLocalImpl
11-
constructor(
12-
private val clientOptions: LocalClientOptions,
13-
) : LlamaStackClientClient {
10+
class LlamaStackClientClientLocalImpl constructor(private val clientOptions: LocalClientOptions) :
11+
LlamaStackClientClient {
1412

1513
private val inference: InferenceService by lazy { InferenceServiceLocalImpl(clientOptions) }
1614

@@ -56,7 +54,7 @@ constructor(
5654
TODO("Not yet implemented")
5755
}
5856

59-
override fun evalTasks(): EvalTaskService {
57+
override fun benchmarks(): BenchmarkService {
6058
TODO("Not yet implemented")
6159
}
6260

llama-stack-client-kotlin-client-local/src/main/kotlin/com/llama/llamastack/client/local/LocalClientOptions.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ private constructor(
1010
val modelPath: String,
1111
val tokenizerPath: String,
1212
val temperature: Float,
13-
val llamaModule: LlamaModule
13+
val llamaModule: LlamaModule,
1414
) {
1515

1616
companion object {
@@ -49,7 +49,7 @@ private constructor(
4949
"ExecuTorch AAR file needs to be included in the libs/ for your app. " +
5050
"Please see the README for more details: " +
5151
"https://github.com/meta-llama/llama-stack-client-kotlin/tree/main",
52-
e
52+
e,
5353
)
5454
}
5555
}

llama-stack-client-kotlin-client-local/src/main/kotlin/com/llama/llamastack/client/local/util/ResponseUtil.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import java.util.UUID
1212
fun buildInferenceChatCompletionResponse(
1313
response: String,
1414
stats: Float,
15-
stopToken: String
15+
stopToken: String,
1616
): ChatCompletionResponse {
1717
// check for prefix [ and suffix ] if so then tool call.
1818
// parse for "toolName", "additionalProperties"
@@ -41,7 +41,7 @@ fun buildInferenceChatCompletionResponse(
4141
}
4242

4343
fun buildInferenceChatCompletionResponseFromStream(
44-
response: String,
44+
response: String
4545
): ChatCompletionResponseStreamChunk {
4646
return ChatCompletionResponseStreamChunk.builder()
4747
.event(
@@ -66,7 +66,7 @@ fun buildLastInferenceChatCompletionResponsesFromStream(
6666
buildInferenceChatCompletionResponseForCustomToolCallStream(
6767
toolCall,
6868
stopToken,
69-
stats
69+
stats,
7070
)
7171
)
7272
}
@@ -79,7 +79,7 @@ fun buildLastInferenceChatCompletionResponsesFromStream(
7979
fun buildInferenceChatCompletionResponseForCustomToolCallStream(
8080
toolCall: ToolCall,
8181
stopToken: String,
82-
stats: Float
82+
stats: Float,
8383
): ChatCompletionResponseStreamChunk {
8484
val delta =
8585
ContentDelta.ToolCallDelta.builder()
@@ -101,7 +101,7 @@ fun buildInferenceChatCompletionResponseForCustomToolCallStream(
101101
fun buildInferenceChatCompletionResponseForStringStream(
102102
str: String,
103103
stopToken: String,
104-
stats: Float
104+
stats: Float,
105105
): ChatCompletionResponseStreamChunk {
106106

107107
return ChatCompletionResponseStreamChunk.builder()

llama-stack-client-kotlin-client-okhttp/src/main/kotlin/com/llama/llamastack/client/okhttp/OkHttpClient.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ class OkHttpClient
3131
private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val baseUrl: HttpUrl) :
3232
HttpClient {
3333

34-
override fun execute(
35-
request: HttpRequest,
36-
requestOptions: RequestOptions,
37-
): HttpResponse {
34+
override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse {
3835
val call = newCall(request, requestOptions)
3936

4037
return try {
@@ -71,7 +68,7 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
7168
val clientBuilder = okHttpClient.newBuilder()
7269

7370
val logLevel =
74-
when (System.getenv("LLAMA_STACK_CLIENT_LOG")?.lowercase()) {
71+
when (System.getenv("LLAMA_STACK_LOG")?.lowercase()) {
7572
"info" -> HttpLoggingInterceptor.Level.BASIC
7673
"debug" -> HttpLoggingInterceptor.Level.BODY
7774
else -> null
@@ -128,13 +125,13 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
128125
) {
129126
builder.header(
130127
"X-Stainless-Read-Timeout",
131-
Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString()
128+
Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString(),
132129
)
133130
}
134131
if (!headers.names().contains("X-Stainless-Timeout") && client.callTimeoutMillis != 0) {
135132
builder.header(
136133
"X-Stainless-Timeout",
137-
Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString()
134+
Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString(),
138135
)
139136
}
140137

llama-stack-client-kotlin-core/src/main/kotlin/com/llama/llamastack/client/LlamaStackClientClient.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ package com.llama.llamastack.client
44

55
import com.llama.llamastack.services.blocking.AgentService
66
import com.llama.llamastack.services.blocking.BatchInferenceService
7+
import com.llama.llamastack.services.blocking.BenchmarkService
78
import com.llama.llamastack.services.blocking.DatasetService
89
import com.llama.llamastack.services.blocking.DatasetioService
910
import com.llama.llamastack.services.blocking.EvalService
10-
import com.llama.llamastack.services.blocking.EvalTaskService
1111
import com.llama.llamastack.services.blocking.InferenceService
1212
import com.llama.llamastack.services.blocking.InspectService
1313
import com.llama.llamastack.services.blocking.ModelService
@@ -94,7 +94,7 @@ interface LlamaStackClientClient {
9494

9595
fun scoringFunctions(): ScoringFunctionService
9696

97-
fun evalTasks(): EvalTaskService
97+
fun benchmarks(): BenchmarkService
9898

9999
/**
100100
* Closes this client, relinquishing any underlying resources.

0 commit comments

Comments
 (0)