# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[workspace.package]
version = "0.2.1"
edition = "2021"
authors = ["NVIDIA"]
license = "Apache-2.0"
homepage = "https://github.com/dynemo-ai/dynemo"
repository = "https://github.com/dynemo-ai/dynemo.git"

[package]
name = "dynemo-llm"
version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
homepage.workspace = true

[features]
mistralrs = ["dep:mistralrs"]
llamacpp = ["dep:llama-cpp-2"]
sglang = ["dep:async_zmq"]
sentencepiece = ["dep:sentencepiece"]
vllm = ["dep:async_zmq"]
trtllm = []

cuda = ["mistralrs/cuda", "llama-cpp-2/cuda"]
metal = ["mistralrs/metal", "llama-cpp-2/metal"]
vulkan = ["llama-cpp-2/vulkan"]

[workspace.dependencies]
# local or crates.io
dynemo-runtime = { version = "0.2.0", path = "../runtime" }

# crates.io
anyhow = { version = "1" }
async-stream = { version = "0.3" }
async-trait = { version = "0.1" }
bytes = "1"
derive_builder = "0.20"
futures = "0.3"
serde = { version = "1", features = ["derive"] }
thiserror = { version = "2.0.11" }
tokio = { version = "1", features = ["full"] }
tokio-stream = { version = "0.1" }
tokio-util = { version = "0.7", features = ["codec", "net"] }
tracing = { version = "0.1" }
validator = { version = "0.20.0", features = ["derive"] }
uuid = { version = "1", features = ["v4", "serde"] }
xxhash-rust = { version = "0.8", features = ["xxh3", "const_xxh3"] }
strum = { version = "0.27", features = ["derive"] }

[dependencies]

# repo
dynemo-runtime = { workspace = true }

# workspace
anyhow = { workspace = true }
async-stream = { workspace = true }
async-trait = { workspace = true }
bytes = { workspace = true }
derive_builder = {workspace = true }
futures =  { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
tokio-stream = { workspace = true }
tokio-util = { workspace = true }
tracing = { workspace = true }
validator = { workspace = true }
uuid = { workspace = true }
xxhash-rust = { workspace = true }
strum = { workspace = true }

async-openai = "0.27.2"
blake3 = "1"
regex = "1"

# protocols
chrono = { version = "0.4", default-features = false, features = [
  "alloc",
  "std",
  "clock",
  "now",
  "serde",
] }
serde_json = { version = "1" }
unicode-segmentation = "1.12"

# http-service
axum = "0.8"
prometheus = { version = "0.13" }

# mistralrs
either = { version = "1.13" }
indexmap = { version = "2.6" }
mistralrs = { git = "https://github.com/EricLBuehler/mistral.rs.git", rev = "5e689c9", optional = true }

# sglang
async_zmq = { version = "0.4.0", optional = true }
libc = "0.2"
pyo3 = { version = "0.23.3", default-features = false, features = [
  "macros",
  "experimental-async",
  "experimental-inspect",
  "py-clone",
] }
serde-pickle = "1.2.0"

# llamacpp
llama-cpp-2 = { version = "0.1.86", optional = true }

# tokenizers
tokenizers = { version = "0.21.0", default-features = false, features = [
  "onig",
  "esaxx_fast",
  # Waiting for release: https://github.com/huggingface/tokenizers/issues/1736
  # "rustls-tls",
] }
sentencepiece = { version = "0.11.2", optional = true }

# backend
galil-seiferas = { version = "0.1" }
toktrie = {version = "0.6.28" }
toktrie_hf_tokenizers =  { version = "0.6.28" }

# preprocessor
bs62 = { version = "0.1" }
erased-serde = { version = "0.4" }
itertools = { version = "0.14.0" }
minijinja = { version = "2.3.1", features = ["loader"] }
minijinja-contrib = { version = "2.3.1", features = ["pycompat"] }
semver = { version = "1", features = ["serde"] }

# trtllm
serde_repr = "0.1"

[dev-dependencies]
proptest = "1.5.0"
reqwest = { version = "0.12", default-features = false, features = ["json", "stream", "rustls-tls"] }
rstest = "0.18.2"
tempfile = "3.17.1"
hf-hub = "0.4.1"
insta = { version = "1.41", features = [
  "glob",
  "json",
  "redactions",
  "filters",
] }

[build-dependencies]
bindgen = "0.70"
cmake = "0.1"

[profile.dev.package]
insta.opt-level = 3
