[workspace]
members = [
    "bindings/node",
]

[package]
name = "ambi"
version = "0.3.2"
edition = "2021"
description = "A flexible, multi-backend, customizable AI agent framework, entirely based on Rust."
license = "Apache-2.0"
repository = "https://github.com/Maskviva/Ambi"
readme = "README.md"
keywords = ["ai", "agent", "llm", "llama", "openai"]
categories = [
    "artificial-intelligence",
    "api-bindings",
    "asynchronous"
]

[lib]
name = "ambi"
path = "src/lib.rs"
crate-type = ["cdylib", "rlib"]

[features]
default = ["openai-api"]

llama-cpp = ["dep:llama-cpp-2", "dep:llama-cpp-sys-2"]
openai-api = ["dep:async-openai"]

mtmd = ["llama-cpp", "llama-cpp-2/mtmd", "llama-cpp-sys-2/mtmd", "dep:base64"]

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

macro = ["dep:ambi-macros"]

[package.metadata.wasm-pack.profile.dev]
wasm-opt = false

[dependencies]
log = "0.4"
thiserror = "2.0.18"
serde = { version = "1.0.228", features = ["derive", "rc"] }
serde_json = "1.0.149"
async-trait = "0.1.89"
anyhow = "1.0.102"
futures = "0.3.32"
tiktoken-rs = "0.11.0"
tokio-stream = "0.1.18"

base64 = { version = "0.22.1", optional = true }
ambi-macros = { version = "0.1.1", path = "ambi-macros", optional = true }
async-openai = { version = "0.36.0", features = ["full"], optional = true }
llama-cpp-2 = { version = "0.1.145", optional = true }
llama-cpp-sys-2 = { version = "0.1.145", optional = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1.52.1", features = ["rt-multi-thread", "sync", "time", "macros"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
tokio = { version = "1.52.1", features = ["sync", "macros"] }
wasm-bindgen-futures = "0.4"
gloo-timers = { version = "0.4.0", features = ["futures"] }
getrandom = { version = "=0.2", features = ["js"] }
wasm-bindgen = "0.2"

[package.metadata.docs.rs]
features = ["openai-api", "llama-cpp", "mtmd", "macro"]
rustdoc-args = ["--cfg", "docsrs"]

[[example]]
name = "chat_cloud"
required-features = ["openai-api"]

[[example]]
name = "chat_local"
required-features = ["llama-cpp"]

[[example]]
name = "chat_stream"
required-features = ["openai-api"]

[[example]]
name = "custom_chat_template"
required-features = ["openai-api"]

[[example]]
name = "custom_model_back"

[[example]]
name = "custom_tool"
required-features = ["openai-api"]

[[example]]
name = "custom_tool_in_macro"
required-features = ["openai-api", "macro"]

[[example]]
name = "custom_tool_parser"
required-features = ["openai-api"]

[[example]]
name = "memory_eviction_handler"
required-features = ["openai-api"]
