liter_llm 1.0.0.pre.rc.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +239 -0
  3. data/ext/liter_llm_rb/extconf.rb +65 -0
  4. data/ext/liter_llm_rb/native/.cargo/config.toml +23 -0
  5. data/ext/liter_llm_rb/native/Cargo.lock +3713 -0
  6. data/ext/liter_llm_rb/native/Cargo.toml +32 -0
  7. data/ext/liter_llm_rb/native/build.rs +15 -0
  8. data/ext/liter_llm_rb/native/src/lib.rs +1079 -0
  9. data/lib/liter_llm.rb +8 -0
  10. data/sig/liter_llm.rbs +416 -0
  11. data/vendor/Cargo.toml +54 -0
  12. data/vendor/liter-llm/Cargo.toml +92 -0
  13. data/vendor/liter-llm/README.md +252 -0
  14. data/vendor/liter-llm/schemas/pricing.json +40 -0
  15. data/vendor/liter-llm/schemas/providers.json +1662 -0
  16. data/vendor/liter-llm/src/auth/azure_ad.rs +264 -0
  17. data/vendor/liter-llm/src/auth/bedrock_sts.rs +353 -0
  18. data/vendor/liter-llm/src/auth/mod.rs +68 -0
  19. data/vendor/liter-llm/src/auth/vertex_oauth.rs +353 -0
  20. data/vendor/liter-llm/src/client/config.rs +351 -0
  21. data/vendor/liter-llm/src/client/managed.rs +622 -0
  22. data/vendor/liter-llm/src/client/mod.rs +864 -0
  23. data/vendor/liter-llm/src/cost.rs +212 -0
  24. data/vendor/liter-llm/src/error.rs +190 -0
  25. data/vendor/liter-llm/src/http/eventstream.rs +860 -0
  26. data/vendor/liter-llm/src/http/mod.rs +12 -0
  27. data/vendor/liter-llm/src/http/request.rs +438 -0
  28. data/vendor/liter-llm/src/http/retry.rs +72 -0
  29. data/vendor/liter-llm/src/http/streaming.rs +289 -0
  30. data/vendor/liter-llm/src/lib.rs +37 -0
  31. data/vendor/liter-llm/src/provider/anthropic.rs +2250 -0
  32. data/vendor/liter-llm/src/provider/azure.rs +579 -0
  33. data/vendor/liter-llm/src/provider/bedrock.rs +1543 -0
  34. data/vendor/liter-llm/src/provider/cohere.rs +654 -0
  35. data/vendor/liter-llm/src/provider/custom.rs +404 -0
  36. data/vendor/liter-llm/src/provider/google_ai.rs +281 -0
  37. data/vendor/liter-llm/src/provider/mistral.rs +188 -0
  38. data/vendor/liter-llm/src/provider/mod.rs +616 -0
  39. data/vendor/liter-llm/src/provider/vertex.rs +1504 -0
  40. data/vendor/liter-llm/src/tests.rs +1425 -0
  41. data/vendor/liter-llm/src/tokenizer.rs +281 -0
  42. data/vendor/liter-llm/src/tower/budget.rs +599 -0
  43. data/vendor/liter-llm/src/tower/cache.rs +502 -0
  44. data/vendor/liter-llm/src/tower/cache_opendal.rs +270 -0
  45. data/vendor/liter-llm/src/tower/cooldown.rs +231 -0
  46. data/vendor/liter-llm/src/tower/cost.rs +404 -0
  47. data/vendor/liter-llm/src/tower/fallback.rs +121 -0
  48. data/vendor/liter-llm/src/tower/health.rs +219 -0
  49. data/vendor/liter-llm/src/tower/hooks.rs +369 -0
  50. data/vendor/liter-llm/src/tower/mod.rs +77 -0
  51. data/vendor/liter-llm/src/tower/rate_limit.rs +300 -0
  52. data/vendor/liter-llm/src/tower/router.rs +436 -0
  53. data/vendor/liter-llm/src/tower/service.rs +181 -0
  54. data/vendor/liter-llm/src/tower/tests.rs +539 -0
  55. data/vendor/liter-llm/src/tower/tests_common.rs +252 -0
  56. data/vendor/liter-llm/src/tower/tracing.rs +209 -0
  57. data/vendor/liter-llm/src/tower/types.rs +170 -0
  58. data/vendor/liter-llm/src/types/audio.rs +52 -0
  59. data/vendor/liter-llm/src/types/batch.rs +77 -0
  60. data/vendor/liter-llm/src/types/chat.rs +214 -0
  61. data/vendor/liter-llm/src/types/common.rs +244 -0
  62. data/vendor/liter-llm/src/types/embedding.rs +84 -0
  63. data/vendor/liter-llm/src/types/files.rs +58 -0
  64. data/vendor/liter-llm/src/types/image.rs +40 -0
  65. data/vendor/liter-llm/src/types/mod.rs +27 -0
  66. data/vendor/liter-llm/src/types/models.rs +21 -0
  67. data/vendor/liter-llm/src/types/moderation.rs +80 -0
  68. data/vendor/liter-llm/src/types/ocr.rs +87 -0
  69. data/vendor/liter-llm/src/types/rerank.rs +46 -0
  70. data/vendor/liter-llm/src/types/responses.rs +55 -0
  71. data/vendor/liter-llm/src/types/search.rs +45 -0
  72. data/vendor/liter-llm/tests/contract.rs +332 -0
  73. data/vendor/liter-llm-ffi/Cargo.toml +30 -0
  74. data/vendor/liter-llm-ffi/build.rs +66 -0
  75. data/vendor/liter-llm-ffi/cbindgen.toml +60 -0
  76. data/vendor/liter-llm-ffi/liter_llm.h +850 -0
  77. data/vendor/liter-llm-ffi/src/lib.rs +2488 -0
  78. metadata +286 -0
data/lib/liter_llm.rb ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'liter_llm_rb'
4
+
5
+ # LiterLlm is a Ruby binding for the Rust core library providing a unified
6
+ # LLM client interface with streaming, tool calling, and provider routing.
7
+ module LiterLlm
8
+ end
data/sig/liter_llm.rbs ADDED
@@ -0,0 +1,416 @@
1
+ # Type signatures for the LiterLlm Ruby binding.
2
+ # Generated from crates/liter-llm-rb Rust source — keep in sync with the
3
+ # Magnus extension and lib/liter_llm.rb public API.
4
+
5
+ module LiterLlm
6
+ VERSION: String
7
+
8
+ # ─── Shared types ────────────────────────────────────────────────────────────
9
+
10
+ # Token usage counts returned in both chat and embedding responses.
11
+ type usage_response = { prompt_tokens: Integer, completion_tokens: Integer, total_tokens: Integer }
12
+
13
+ # ─── Content types ───────────────────────────────────────────────────────────
14
+
15
+ type image_url_param = { url: String, detail: ("low" | "high" | "auto")? }
16
+
17
+ # A single part of a multipart user message.
18
+ type content_part_param =
19
+ { type: "text", text: String } |
20
+ { type: "image_url", image_url: image_url_param }
21
+
22
+ # ─── Message types ───────────────────────────────────────────────────────────
23
+
24
+ # A single message in the conversation history.
25
+ # The `content` field is a plain string for system/tool/developer/function
26
+ # roles and either a string or a list of content parts for user messages.
27
+ type message_param = {
28
+ role: ("system" | "user" | "assistant" | "tool" | "developer" | "function"),
29
+ content: String | Array[content_part_param],
30
+ name: String?,
31
+ tool_call_id: String?
32
+ }
33
+
34
+ # ─── Tool / function call types ──────────────────────────────────────────────
35
+
36
+ type function_definition = {
37
+ name: String,
38
+ description: String?,
39
+ parameters: Hash[String, untyped]?,
40
+ strict: bool?
41
+ }
42
+
43
+ type tool_param = { type: "function", function: function_definition }
44
+
45
+ type specific_tool_choice = { type: "function", function: { name: String } }
46
+
47
+ type tool_choice_param = ("auto" | "required" | "none") | specific_tool_choice
48
+
49
+ type function_call = { name: String, arguments: String }
50
+
51
+ type tool_call = { id: String, type: "function", function: function_call }
52
+
53
+ # ─── Response format ─────────────────────────────────────────────────────────
54
+
55
+ type json_schema_format = {
56
+ name: String,
57
+ description: String?,
58
+ schema: Hash[String, untyped],
59
+ strict: bool?
60
+ }
61
+
62
+ type response_format_param =
63
+ { type: "text" } |
64
+ { type: "json_object" } |
65
+ { type: "json_schema", json_schema: json_schema_format }
66
+
67
+ # ─── Chat request / response ─────────────────────────────────────────────────
68
+
69
+ type stream_options = { include_usage: bool? }
70
+
71
+ # Full OpenAI-compatible chat completion request.
72
+ type chat_request = {
73
+ model: String,
74
+ messages: Array[message_param],
75
+ temperature: Float?,
76
+ top_p: Float?,
77
+ n: Integer?,
78
+ stream: bool?,
79
+ stop: (String | Array[String])?,
80
+ max_tokens: Integer?,
81
+ presence_penalty: Float?,
82
+ frequency_penalty: Float?,
83
+ logit_bias: Hash[String, Float]?,
84
+ user: String?,
85
+ tools: Array[tool_param]?,
86
+ tool_choice: tool_choice_param?,
87
+ parallel_tool_calls: bool?,
88
+ response_format: response_format_param?,
89
+ stream_options: stream_options?,
90
+ seed: Integer?
91
+ }
92
+
93
+ type assistant_message = {
94
+ content: String?,
95
+ name: String?,
96
+ tool_calls: Array[tool_call]?,
97
+ refusal: String?,
98
+ function_call: function_call?
99
+ }
100
+
101
+ type choice_response = {
102
+ index: Integer,
103
+ message: assistant_message,
104
+ finish_reason: ("stop" | "length" | "tool_calls" | "content_filter" | "function_call" | String)?
105
+ }
106
+
107
+ # Full OpenAI-compatible chat completion response.
108
+ type chat_response = {
109
+ id: String,
110
+ object: String,
111
+ created: Integer,
112
+ model: String,
113
+ choices: Array[choice_response],
114
+ usage: usage_response?,
115
+ system_fingerprint: String?,
116
+ service_tier: String?
117
+ }
118
+
119
+ # ─── Streaming chunk types ───────────────────────────────────────────────────
120
+
121
+ type stream_function_call = { name: String?, arguments: String? }
122
+
123
+ type stream_tool_call = {
124
+ index: Integer,
125
+ id: String?,
126
+ type: "function"?,
127
+ function: stream_function_call?
128
+ }
129
+
130
+ type stream_delta = {
131
+ role: String?,
132
+ content: String?,
133
+ tool_calls: Array[stream_tool_call]?,
134
+ function_call: stream_function_call?,
135
+ refusal: String?
136
+ }
137
+
138
+ type stream_choice = { index: Integer, delta: stream_delta, finish_reason: String? }
139
+
140
+ type chat_completion_chunk = {
141
+ id: String,
142
+ object: String,
143
+ created: Integer,
144
+ model: String,
145
+ choices: Array[stream_choice],
146
+ usage: usage_response?,
147
+ service_tier: String?
148
+ }
149
+
150
+ # ─── Embedding types ─────────────────────────────────────────────────────────
151
+
152
+ type embedding_request = {
153
+ model: String,
154
+ input: String | Array[String],
155
+ encoding_format: String?,
156
+ dimensions: Integer?,
157
+ user: String?
158
+ }
159
+
160
+ type embedding_object = { object: String, embedding: Array[Float], index: Integer }
161
+
162
+ type embedding_response = {
163
+ object: String,
164
+ data: Array[embedding_object],
165
+ model: String,
166
+ usage: usage_response
167
+ }
168
+
169
+ # ─── Models types ────────────────────────────────────────────────────────────
170
+
171
+ type model_object = { id: String, object: String, created: Integer, owned_by: String }
172
+
173
+ type models_response = { object: String, data: Array[model_object] }
174
+
175
+ # ─── Image Generation types ──────────────────────────────────────────────────
176
+
177
+ type create_image_request = {
178
+ prompt: String,
179
+ model: String?,
180
+ n: Integer?,
181
+ quality: String?,
182
+ response_format: String?,
183
+ size: String?,
184
+ style: String?,
185
+ user: String?
186
+ }
187
+
188
+ type image_data = { url: String?, b64_json: String?, revised_prompt: String? }
189
+
190
+ type images_response = { created: Integer, data: Array[image_data] }
191
+
192
+ # ─── Speech types ──────────────────────────────────────────────────────────
193
+
194
+ type create_speech_request = {
195
+ model: String,
196
+ input: String,
197
+ voice: String,
198
+ response_format: String?,
199
+ speed: Float?
200
+ }
201
+
202
+ # ─── Transcription types ───────────────────────────────────────────────────
203
+
204
+ type create_transcription_request = {
205
+ file: String,
206
+ model: String,
207
+ language: String?,
208
+ prompt: String?,
209
+ response_format: String?,
210
+ temperature: Float?
211
+ }
212
+
213
+ type transcription_response = { text: String }
214
+
215
+ # ─── Moderation types ──────────────────────────────────────────────────────
216
+
217
+ type moderation_request = {
218
+ input: untyped,
219
+ model: String?
220
+ }
221
+
222
+ type moderation_categories = {
223
+ sexual: bool,
224
+ hate: bool,
225
+ harassment: bool,
226
+ violence: bool
227
+ }
228
+
229
+ type moderation_category_scores = {
230
+ sexual: Float,
231
+ hate: Float,
232
+ harassment: Float,
233
+ violence: Float
234
+ }
235
+
236
+ type moderation_result = {
237
+ flagged: bool,
238
+ categories: moderation_categories,
239
+ category_scores: moderation_category_scores
240
+ }
241
+
242
+ type moderation_response = { id: String, model: String, results: Array[moderation_result] }
243
+
244
+ # ─── Rerank types ──────────────────────────────────────────────────────────
245
+
246
+ type rerank_request = {
247
+ model: String,
248
+ query: String,
249
+ documents: untyped,
250
+ top_n: Integer?
251
+ }
252
+
253
+ type rerank_result = { index: Integer, relevance_score: Float }
254
+
255
+ type rerank_response = { results: Array[rerank_result], model: String, usage: usage_response? }
256
+
257
+ # ─── File types ────────────────────────────────────────────────────────────
258
+
259
+ type create_file_request = { file: String, purpose: String, filename: String? }
260
+
261
+ type file_object = {
262
+ id: String,
263
+ object: String,
264
+ bytes: Integer,
265
+ created_at: Integer,
266
+ filename: String,
267
+ purpose: String,
268
+ status: String?,
269
+ status_details: String?
270
+ }
271
+
272
+ type delete_response = { id: String, object: String, deleted: bool }
273
+
274
+ type file_list_query = { purpose: String?, limit: Integer?, after: String? }
275
+
276
+ type file_list_response = { object: String, data: Array[file_object] }
277
+
278
+ # ─── Batch types ───────────────────────────────────────────────────────────
279
+
280
+ type create_batch_request = {
281
+ input_file_id: String,
282
+ endpoint: String,
283
+ completion_window: String,
284
+ metadata: Hash[String, String]?
285
+ }
286
+
287
+ type batch_request_counts = { total: Integer, completed: Integer, failed: Integer }
288
+
289
+ type batch_object = {
290
+ id: String,
291
+ object: String,
292
+ endpoint: String,
293
+ input_file_id: String,
294
+ completion_window: String,
295
+ status: String,
296
+ output_file_id: String?,
297
+ error_file_id: String?,
298
+ created_at: Integer,
299
+ request_counts: batch_request_counts?,
300
+ metadata: Hash[String, String]?
301
+ }
302
+
303
+ type batch_list_query = { limit: Integer?, after: String? }
304
+
305
+ type batch_list_response = { object: String, data: Array[batch_object] }
306
+
307
+ # ─── Response types ────────────────────────────────────────────────────────
308
+
309
+ type create_response_request = {
310
+ model: String,
311
+ input: untyped,
312
+ instructions: String?,
313
+ max_output_tokens: Integer?,
314
+ temperature: Float?,
315
+ top_p: Float?,
316
+ stream: bool?,
317
+ metadata: Hash[String, String]?
318
+ }
319
+
320
+ type response_object = {
321
+ id: String,
322
+ object: String,
323
+ created_at: Integer,
324
+ status: String,
325
+ model: String,
326
+ output: untyped?,
327
+ usage: usage_response?,
328
+ metadata: Hash[String, String]?,
329
+ error: untyped?
330
+ }
331
+
332
+ # ─── LlmClient ───────────────────────────────────────────────────────────────
333
+
334
+ # Unified LLM client backed by the Rust core.
335
+ #
336
+ # All I/O methods accept a JSON-encoded request string and return a
337
+ # JSON-encoded response string. The thin Ruby layer is responsible for
338
+ # serialising/deserialising as needed.
339
+ class LlmClient
340
+ # Create a new client.
341
+ #
342
+ # @param api_key API key for authentication.
343
+ # @param base_url Optional provider base URL override.
344
+ # @param max_retries Retries on 429 / 5xx (default: 3).
345
+ # @param timeout_secs Request timeout in seconds (default: 60).
346
+ def initialize: (
347
+ String api_key,
348
+ ?base_url: String?,
349
+ ?model_hint: String?,
350
+ ?max_retries: Integer,
351
+ ?timeout_secs: Integer
352
+ ) -> void
353
+
354
+ # Send a chat completion request.
355
+ def chat: (String request_json) -> String
356
+
357
+ # Send an embedding request.
358
+ def embed: (String request_json) -> String
359
+
360
+ # List models available from the configured provider.
361
+ def list_models: () -> String
362
+
363
+ # Generate an image from a text prompt.
364
+ def image_generate: (String request_json) -> String
365
+
366
+ # Generate audio speech from text, returning base64-encoded audio bytes.
367
+ def speech: (String request_json) -> String
368
+
369
+ # Transcribe audio to text.
370
+ def transcribe: (String request_json) -> String
371
+
372
+ # Check content against moderation policies.
373
+ def moderate: (String request_json) -> String
374
+
375
+ # Rerank documents by relevance to a query.
376
+ def rerank: (String request_json) -> String
377
+
378
+ # Upload a file.
379
+ def create_file: (String request_json) -> String
380
+
381
+ # Retrieve metadata for a file by ID.
382
+ def retrieve_file: (String file_id) -> String
383
+
384
+ # Delete a file by ID.
385
+ def delete_file: (String file_id) -> String
386
+
387
+ # List files, optionally filtered by query parameters.
388
+ def list_files: (String? query_json) -> String
389
+
390
+ # Retrieve the raw content of a file (base64-encoded).
391
+ def file_content: (String file_id) -> String
392
+
393
+ # Create a new batch job.
394
+ def create_batch: (String request_json) -> String
395
+
396
+ # Retrieve a batch by ID.
397
+ def retrieve_batch: (String batch_id) -> String
398
+
399
+ # List batches, optionally filtered by query parameters.
400
+ def list_batches: (String? query_json) -> String
401
+
402
+ # Cancel an in-progress batch.
403
+ def cancel_batch: (String batch_id) -> String
404
+
405
+ # Create a new response via the Responses API.
406
+ def create_response: (String request_json) -> String
407
+
408
+ # Retrieve a response by ID.
409
+ def retrieve_response: (String response_id) -> String
410
+
411
+ # Cancel an in-progress response.
412
+ def cancel_response: (String response_id) -> String
413
+
414
+ def inspect: () -> String
415
+ end
416
+ end
data/vendor/Cargo.toml ADDED
@@ -0,0 +1,54 @@
1
+ [workspace]
2
+ members = ["liter-llm", "liter-llm-ffi"]
3
+
4
+ [workspace.package]
5
+ version = "1.0.0-rc.6"
6
+ edition = "2024"
7
+ authors = ["Na'aman Hirschfeld <naaman@kreuzberg.dev>"]
8
+ license = "MIT"
9
+ repository = "https://github.com/kreuzberg-dev/liter-llm"
10
+ homepage = "https://kreuzberg.dev"
11
+
12
+ [workspace.dependencies]
13
+ anyhow = "1"
14
+ base64 = "0.22"
15
+ bytes = "1"
16
+ clap = { version = "4", features = ["derive"] }
17
+ dashmap = "6"
18
+ futures-core = "0.3"
19
+ futures-util = "0.3"
20
+ jsonschema = "0.45"
21
+ jsonwebtoken = { version = "10", features = ["use_pem"], default-features = false }
22
+ magnus = "0.8"
23
+ memchr = "2"
24
+ napi = { version = "3", features = ["napi4", "serde-json", "async"] }
25
+ napi-build = "2"
26
+ napi-derive = "3"
27
+ opendal = { version = "0.53", features = ["services-memory"], default-features = false }
28
+ opentelemetry = "0.31"
29
+ pin-project-lite = "0.2"
30
+ pyo3 = { version = "0.28", features = ["abi3-py310"] }
31
+ pyo3-async-runtimes = { version = "0.28", features = ["tokio-runtime"] }
32
+ rayon = "1"
33
+ rb-sys = "0.9"
34
+ reqwest = { version = "0.13", features = ["json", "stream", "rustls", "multipart", "form"], default-features = false }
35
+ rustler = "0.37"
36
+ secrecy = { version = "0.10", features = ["serde"] }
37
+ serde = { version = "1", features = ["derive"] }
38
+ serde_json = "1"
39
+ serial_test = "3"
40
+ tempfile = "3"
41
+ thiserror = "2"
42
+ tokenizers = { version = "0.22", features = ["http", "fancy-regex"], default-features = false }
43
+ tokio = { version = "1", features = ["full"] }
44
+ toml = "1.1"
45
+ tower = { version = "0.5", features = ["retry", "limit", "timeout", "buffer", "load-shed", "steer", "util"] }
46
+ tower-http = { version = "0.6", features = ["follow-redirect", "set-header", "sensitive-headers", "trace", "request-id"] }
47
+ tower-layer = "0.3"
48
+ tower-service = "0.3"
49
+ tracing = "0.1"
50
+ tracing-opentelemetry = "0.32"
51
+ walkdir = "2.5"
52
+ wasm-bindgen = "0.2"
53
+ wasm-bindgen-test = "0.3"
54
+ which = "8"
@@ -0,0 +1,92 @@
1
+ [package]
2
+ name = "liter-llm"
3
+ version = "1.0.0-rc.6"
4
+ edition = "2024"
5
+ license = "MIT"
6
+ repository.workspace = true
7
+ homepage.workspace = true
8
+ authors = ["Na'aman Hirschfeld <naaman@kreuzberg.dev>"]
9
+ description = "Universal LLM API client — 142+ providers, streaming, tool calling. Rust-powered, type-safe, compiled."
10
+ readme = "README.md"
11
+ keywords = ["llm", "openai", "api-client", "ai", "kreuzberg"]
12
+ categories = ["api-bindings", "web-programming::http-client"]
13
+
14
+ [package.metadata.cargo-machete]
15
+ ignored = ["dashmap", "tower-http"]
16
+
17
+ [features]
18
+ # Enable the native HTTP stack (reqwest + tokio). Disable this feature when
19
+ # compiling for WebAssembly, where the browser / Node.js fetch API is used
20
+ # instead and the tokio multi-thread runtime is unavailable.
21
+ native-http = ["dep:reqwest", "dep:tokio", "dep:memchr", "dep:base64"]
22
+ # Structured tracing via the `tracing` crate. Adds `#[instrument]` spans on
23
+ # HTTP functions and SSE parser warnings. Can be enabled independently of the
24
+ # Tower middleware integration.
25
+ tracing = ["dep:tracing"]
26
+ # Tower middleware integration (LlmService, TracingLayer, FallbackLayer).
27
+ tower = ["dep:tower", "dep:tower-http", "dep:dashmap", "dep:futures-util", "tracing"]
28
+ # OpenTelemetry export bridge via `tracing-opentelemetry`. Depends on `tracing`
29
+ # and re-exports `tracing_opentelemetry` so callers can compose their own
30
+ # subscriber stack without a hard dependency on the crate themselves.
31
+ otel = ["tracing", "dep:tracing-opentelemetry", "dep:opentelemetry"]
32
+ # AWS Bedrock SigV4 signing support. Enables the `aws-sigv4` dependency and
33
+ # activates real SigV4 signing in `BedrockProvider`. When this feature is
34
+ # disabled, `BedrockProvider` still routes `bedrock/` prefixed model names
35
+ # and strips the prefix, but sends requests unsigned (suitable for tests
36
+ # using a `base_url` override pointing to a mock server).
37
+ bedrock = ["native-http", "dep:aws-credential-types", "dep:aws-sigv4"]
38
+ # Azure AD OAuth2 credential provider (client-credentials flow).
39
+ azure-auth = ["native-http"]
40
+ # Google Vertex AI OAuth2 credential provider (service-account JWT flow).
41
+ vertex-auth = ["native-http", "dep:jsonwebtoken"]
42
+ # AWS STS Web Identity credential provider (EKS / IRSA token exchange).
43
+ bedrock-auth = ["native-http"]
44
+ # Full feature set: native HTTP + tower + tracing + otel + bedrock.
45
+ # Token counting via HuggingFace tokenizers. Provides lazy-cached tokenizer
46
+ # loading and token counting for text and chat completion requests.
47
+ tokenizer = ["dep:tokenizers"]
48
+ # Full feature set: native HTTP + tower + tracing + otel + bedrock + tokenizer + auth providers.
49
+ opendal-cache = ["dep:opendal", "tower"]
50
+ full = [
51
+ "native-http",
52
+ "tower",
53
+ "tracing",
54
+ "otel",
55
+ "bedrock",
56
+ "tokenizer",
57
+ "azure-auth",
58
+ "vertex-auth",
59
+ "bedrock-auth",
60
+ "opendal-cache",
61
+ ]
62
+ default = ["native-http"]
63
+
64
+ [dependencies]
65
+ aws-credential-types = { version = "1", optional = true }
66
+ aws-sigv4 = { version = "1", features = ["sign-http", "http1"], optional = true }
67
+ base64 = { version = "0.22", optional = true }
68
+ bytes = "1"
69
+ dashmap = { version = "6", optional = true }
70
+ futures-core = "0.3"
71
+ futures-util = { version = "0.3", optional = true }
72
+ jsonwebtoken = { version = "10", features = ["use_pem"], default-features = false, optional = true }
73
+ memchr = { version = "2", optional = true }
74
+ opendal = { version = "0.53", features = ["services-memory"], default-features = false, optional = true }
75
+ opentelemetry = { version = "0.31", optional = true }
76
+ pin-project-lite = "0.2"
77
+ reqwest = { version = "0.13", features = ["json", "stream", "rustls", "multipart", "form"], default-features = false, optional = true }
78
+ secrecy = { version = "0.10", features = ["serde"] }
79
+ serde = { version = "1", features = ["derive"] }
80
+ serde_json = "1"
81
+ thiserror = "2"
82
+ tokenizers = { version = "0.22", features = ["http", "fancy-regex"], default-features = false, optional = true }
83
+ tokio = { version = "1", features = ["time", "rt", "macros"], optional = true }
84
+ tower = { version = "0.5", features = ["retry", "limit", "timeout", "buffer", "load-shed", "steer", "util"], optional = true }
85
+ tower-http = { version = "0.6", features = ["follow-redirect", "set-header", "sensitive-headers", "trace", "request-id"], optional = true }
86
+ tracing = { version = "0.1", optional = true }
87
+ tracing-opentelemetry = { version = "0.32", optional = true }
88
+
89
+ [dev-dependencies]
90
+ jsonschema = "0.45"
91
+ serial_test = "3"
92
+ tokio = { version = "1", features = ["test-util", "macros"] }