Skip to content

Commit 90a3674

Browse files
committed
stainless copy
1 parent 2c80513 commit 90a3674

File tree

466 files changed

+157582
-4180
lines changed

Some content is hidden

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

466 files changed

+157582
-4180
lines changed

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,7 @@ class LlamaStackClientOkHttpClient private constructor() {
163163
fun build(): LlamaStackClientClient =
164164
LlamaStackClientClientImpl(
165165
clientOptions
166-
.httpClient(
167-
OkHttpClient.builder()
168-
.baseUrl(clientOptions.baseUrl())
169-
.timeout(timeout)
170-
.proxy(proxy)
171-
.build()
172-
)
166+
.httpClient(OkHttpClient.builder().timeout(timeout).proxy(proxy).build())
173167
.build()
174168
)
175169
}

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,7 @@ class LlamaStackClientOkHttpClientAsync private constructor() {
164164
fun build(): LlamaStackClientClientAsync =
165165
LlamaStackClientClientAsyncImpl(
166166
clientOptions
167-
.httpClient(
168-
OkHttpClient.builder()
169-
.baseUrl(clientOptions.baseUrl())
170-
.timeout(timeout)
171-
.proxy(proxy)
172-
.build()
173-
)
167+
.httpClient(OkHttpClient.builder().timeout(timeout).proxy(proxy).build())
174168
.build()
175169
)
176170
}

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

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package com.llama.llamastack.client.okhttp
22

33
import com.llama.llamastack.core.RequestOptions
44
import com.llama.llamastack.core.Timeout
5-
import com.llama.llamastack.core.checkRequired
65
import com.llama.llamastack.core.http.Headers
76
import com.llama.llamastack.core.http.HttpClient
87
import com.llama.llamastack.core.http.HttpMethod
@@ -17,7 +16,6 @@ import java.time.Duration
1716
import kotlinx.coroutines.suspendCancellableCoroutine
1817
import okhttp3.Call
1918
import okhttp3.Callback
20-
import okhttp3.HttpUrl
2119
import okhttp3.HttpUrl.Companion.toHttpUrl
2220
import okhttp3.MediaType
2321
import okhttp3.MediaType.Companion.toMediaType
@@ -28,8 +26,7 @@ import okhttp3.Response
2826
import okhttp3.logging.HttpLoggingInterceptor
2927
import okio.BufferedSink
3028

31-
class OkHttpClient
32-
private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val baseUrl: HttpUrl) :
29+
class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpClient) :
3330
HttpClient {
3431

3532
override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse {
@@ -148,11 +145,7 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
148145
}
149146

150147
private fun HttpRequest.toUrl(): String {
151-
url?.let {
152-
return it
153-
}
154-
155-
val builder = baseUrl.newBuilder()
148+
val builder = baseUrl.toHttpUrl().newBuilder()
156149
pathSegments.forEach(builder::addPathSegment)
157150
queryParams.keys().forEach { key ->
158151
queryParams.values(key).forEach { builder.addQueryParameter(key, it) }
@@ -202,12 +195,9 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
202195

203196
class Builder internal constructor() {
204197

205-
private var baseUrl: HttpUrl? = null
206198
private var timeout: Timeout = Timeout.default()
207199
private var proxy: Proxy? = null
208200

209-
fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl.toHttpUrl() }
210-
211201
fun timeout(timeout: Timeout) = apply { this.timeout = timeout }
212202

213203
fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build())
@@ -222,8 +212,12 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
222212
.writeTimeout(timeout.write())
223213
.callTimeout(timeout.request())
224214
.proxy(proxy)
225-
.build(),
226-
checkRequired("baseUrl", baseUrl),
215+
.build()
216+
.apply {
217+
// We usually make all our requests to the same host so it makes sense to
218+
// raise the per-host limit to the overall limit.
219+
dispatcher.maxRequestsPerHost = dispatcher.maxRequests
220+
}
227221
)
228222
}
229223
}

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

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,21 @@
22

33
package com.llama.llamastack.client
44

5+
import com.llama.llamastack.core.ClientOptions
56
import com.llama.llamastack.services.blocking.AgentService
6-
import com.llama.llamastack.services.blocking.BatchInferenceService
77
import com.llama.llamastack.services.blocking.BenchmarkService
8+
import com.llama.llamastack.services.blocking.ChatService
9+
import com.llama.llamastack.services.blocking.CompletionService
810
import com.llama.llamastack.services.blocking.DatasetService
11+
import com.llama.llamastack.services.blocking.EmbeddingService
912
import com.llama.llamastack.services.blocking.EvalService
13+
import com.llama.llamastack.services.blocking.FileService
1014
import com.llama.llamastack.services.blocking.InferenceService
1115
import com.llama.llamastack.services.blocking.InspectService
1216
import com.llama.llamastack.services.blocking.ModelService
1317
import com.llama.llamastack.services.blocking.PostTrainingService
1418
import com.llama.llamastack.services.blocking.ProviderService
19+
import com.llama.llamastack.services.blocking.ResponseService
1520
import com.llama.llamastack.services.blocking.RouteService
1621
import com.llama.llamastack.services.blocking.SafetyService
1722
import com.llama.llamastack.services.blocking.ScoringFunctionService
@@ -24,6 +29,7 @@ import com.llama.llamastack.services.blocking.ToolService
2429
import com.llama.llamastack.services.blocking.ToolgroupService
2530
import com.llama.llamastack.services.blocking.VectorDbService
2631
import com.llama.llamastack.services.blocking.VectorIoService
32+
import com.llama.llamastack.services.blocking.VectorStoreService
2733

2834
/**
2935
* A client for interacting with the Llama Stack Client REST API synchronously. You can also switch
@@ -54,15 +60,22 @@ interface LlamaStackClientClient {
5460
*/
5561
fun withRawResponse(): WithRawResponse
5662

63+
/**
64+
* Returns a view of this service with the given option modifications applied.
65+
*
66+
* The original service is not modified.
67+
*/
68+
fun withOptions(modifier: (ClientOptions.Builder) -> Unit): LlamaStackClientClient
69+
5770
fun toolgroups(): ToolgroupService
5871

5972
fun tools(): ToolService
6073

6174
fun toolRuntime(): ToolRuntimeService
6275

63-
fun agents(): AgentService
76+
fun responses(): ResponseService
6477

65-
fun batchInference(): BatchInferenceService
78+
fun agents(): AgentService
6679

6780
fun datasets(): DatasetService
6881

@@ -72,10 +85,18 @@ interface LlamaStackClientClient {
7285

7386
fun inference(): InferenceService
7487

88+
fun embeddings(): EmbeddingService
89+
90+
fun chat(): ChatService
91+
92+
fun completions(): CompletionService
93+
7594
fun vectorIo(): VectorIoService
7695

7796
fun vectorDbs(): VectorDbService
7897

98+
fun vectorStores(): VectorStoreService
99+
79100
fun models(): ModelService
80101

81102
fun postTraining(): PostTrainingService
@@ -98,6 +119,8 @@ interface LlamaStackClientClient {
98119

99120
fun benchmarks(): BenchmarkService
100121

122+
fun files(): FileService
123+
101124
/**
102125
* Closes this client, relinquishing any underlying resources.
103126
*
@@ -117,15 +140,24 @@ interface LlamaStackClientClient {
117140
*/
118141
interface WithRawResponse {
119142

143+
/**
144+
* Returns a view of this service with the given option modifications applied.
145+
*
146+
* The original service is not modified.
147+
*/
148+
fun withOptions(
149+
modifier: (ClientOptions.Builder) -> Unit
150+
): LlamaStackClientClient.WithRawResponse
151+
120152
fun toolgroups(): ToolgroupService.WithRawResponse
121153

122154
fun tools(): ToolService.WithRawResponse
123155

124156
fun toolRuntime(): ToolRuntimeService.WithRawResponse
125157

126-
fun agents(): AgentService.WithRawResponse
158+
fun responses(): ResponseService.WithRawResponse
127159

128-
fun batchInference(): BatchInferenceService.WithRawResponse
160+
fun agents(): AgentService.WithRawResponse
129161

130162
fun datasets(): DatasetService.WithRawResponse
131163

@@ -135,10 +167,18 @@ interface LlamaStackClientClient {
135167

136168
fun inference(): InferenceService.WithRawResponse
137169

170+
fun embeddings(): EmbeddingService.WithRawResponse
171+
172+
fun chat(): ChatService.WithRawResponse
173+
174+
fun completions(): CompletionService.WithRawResponse
175+
138176
fun vectorIo(): VectorIoService.WithRawResponse
139177

140178
fun vectorDbs(): VectorDbService.WithRawResponse
141179

180+
fun vectorStores(): VectorStoreService.WithRawResponse
181+
142182
fun models(): ModelService.WithRawResponse
143183

144184
fun postTraining(): PostTrainingService.WithRawResponse
@@ -160,5 +200,7 @@ interface LlamaStackClientClient {
160200
fun scoringFunctions(): ScoringFunctionService.WithRawResponse
161201

162202
fun benchmarks(): BenchmarkService.WithRawResponse
203+
204+
fun files(): FileService.WithRawResponse
163205
}
164206
}

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

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,21 @@
22

33
package com.llama.llamastack.client
44

5+
import com.llama.llamastack.core.ClientOptions
56
import com.llama.llamastack.services.async.AgentServiceAsync
6-
import com.llama.llamastack.services.async.BatchInferenceServiceAsync
77
import com.llama.llamastack.services.async.BenchmarkServiceAsync
8+
import com.llama.llamastack.services.async.ChatServiceAsync
9+
import com.llama.llamastack.services.async.CompletionServiceAsync
810
import com.llama.llamastack.services.async.DatasetServiceAsync
11+
import com.llama.llamastack.services.async.EmbeddingServiceAsync
912
import com.llama.llamastack.services.async.EvalServiceAsync
13+
import com.llama.llamastack.services.async.FileServiceAsync
1014
import com.llama.llamastack.services.async.InferenceServiceAsync
1115
import com.llama.llamastack.services.async.InspectServiceAsync
1216
import com.llama.llamastack.services.async.ModelServiceAsync
1317
import com.llama.llamastack.services.async.PostTrainingServiceAsync
1418
import com.llama.llamastack.services.async.ProviderServiceAsync
19+
import com.llama.llamastack.services.async.ResponseServiceAsync
1520
import com.llama.llamastack.services.async.RouteServiceAsync
1621
import com.llama.llamastack.services.async.SafetyServiceAsync
1722
import com.llama.llamastack.services.async.ScoringFunctionServiceAsync
@@ -24,6 +29,7 @@ import com.llama.llamastack.services.async.ToolServiceAsync
2429
import com.llama.llamastack.services.async.ToolgroupServiceAsync
2530
import com.llama.llamastack.services.async.VectorDbServiceAsync
2631
import com.llama.llamastack.services.async.VectorIoServiceAsync
32+
import com.llama.llamastack.services.async.VectorStoreServiceAsync
2733

2834
/**
2935
* A client for interacting with the Llama Stack Client REST API asynchronously. You can also switch
@@ -54,15 +60,22 @@ interface LlamaStackClientClientAsync {
5460
*/
5561
fun withRawResponse(): WithRawResponse
5662

63+
/**
64+
* Returns a view of this service with the given option modifications applied.
65+
*
66+
* The original service is not modified.
67+
*/
68+
fun withOptions(modifier: (ClientOptions.Builder) -> Unit): LlamaStackClientClientAsync
69+
5770
fun toolgroups(): ToolgroupServiceAsync
5871

5972
fun tools(): ToolServiceAsync
6073

6174
fun toolRuntime(): ToolRuntimeServiceAsync
6275

63-
fun agents(): AgentServiceAsync
76+
fun responses(): ResponseServiceAsync
6477

65-
fun batchInference(): BatchInferenceServiceAsync
78+
fun agents(): AgentServiceAsync
6679

6780
fun datasets(): DatasetServiceAsync
6881

@@ -72,10 +85,18 @@ interface LlamaStackClientClientAsync {
7285

7386
fun inference(): InferenceServiceAsync
7487

88+
fun embeddings(): EmbeddingServiceAsync
89+
90+
fun chat(): ChatServiceAsync
91+
92+
fun completions(): CompletionServiceAsync
93+
7594
fun vectorIo(): VectorIoServiceAsync
7695

7796
fun vectorDbs(): VectorDbServiceAsync
7897

98+
fun vectorStores(): VectorStoreServiceAsync
99+
79100
fun models(): ModelServiceAsync
80101

81102
fun postTraining(): PostTrainingServiceAsync
@@ -98,6 +119,8 @@ interface LlamaStackClientClientAsync {
98119

99120
fun benchmarks(): BenchmarkServiceAsync
100121

122+
fun files(): FileServiceAsync
123+
101124
/**
102125
* Closes this client, relinquishing any underlying resources.
103126
*
@@ -117,15 +140,24 @@ interface LlamaStackClientClientAsync {
117140
*/
118141
interface WithRawResponse {
119142

143+
/**
144+
* Returns a view of this service with the given option modifications applied.
145+
*
146+
* The original service is not modified.
147+
*/
148+
fun withOptions(
149+
modifier: (ClientOptions.Builder) -> Unit
150+
): LlamaStackClientClientAsync.WithRawResponse
151+
120152
fun toolgroups(): ToolgroupServiceAsync.WithRawResponse
121153

122154
fun tools(): ToolServiceAsync.WithRawResponse
123155

124156
fun toolRuntime(): ToolRuntimeServiceAsync.WithRawResponse
125157

126-
fun agents(): AgentServiceAsync.WithRawResponse
158+
fun responses(): ResponseServiceAsync.WithRawResponse
127159

128-
fun batchInference(): BatchInferenceServiceAsync.WithRawResponse
160+
fun agents(): AgentServiceAsync.WithRawResponse
129161

130162
fun datasets(): DatasetServiceAsync.WithRawResponse
131163

@@ -135,10 +167,18 @@ interface LlamaStackClientClientAsync {
135167

136168
fun inference(): InferenceServiceAsync.WithRawResponse
137169

170+
fun embeddings(): EmbeddingServiceAsync.WithRawResponse
171+
172+
fun chat(): ChatServiceAsync.WithRawResponse
173+
174+
fun completions(): CompletionServiceAsync.WithRawResponse
175+
138176
fun vectorIo(): VectorIoServiceAsync.WithRawResponse
139177

140178
fun vectorDbs(): VectorDbServiceAsync.WithRawResponse
141179

180+
fun vectorStores(): VectorStoreServiceAsync.WithRawResponse
181+
142182
fun models(): ModelServiceAsync.WithRawResponse
143183

144184
fun postTraining(): PostTrainingServiceAsync.WithRawResponse
@@ -160,5 +200,7 @@ interface LlamaStackClientClientAsync {
160200
fun scoringFunctions(): ScoringFunctionServiceAsync.WithRawResponse
161201

162202
fun benchmarks(): BenchmarkServiceAsync.WithRawResponse
203+
204+
fun files(): FileServiceAsync.WithRawResponse
163205
}
164206
}

0 commit comments

Comments
 (0)