Skip to main content

rskit_inference_tgi/
lib.rs

1//! Hugging Face Text Generation Inference (TGI) adapter via OAI-compatible endpoint.
2//!
3//! TGI exposes an OpenAI-compatible `/v1/chat/completions` endpoint from v2+.
4//! Older deployments may only expose `/generate`; this adapter targets the modern OAI-compatible path,
5//! which is the recommended production interface.
6//!
7//! Optional bearer credentials are configured through [`Config::api_key`] as a redacting [`SecretString`](rskit_util::SecretString)
8//! and installed through `rskit-httpclient` auth rather than raw headers.
9
10#![warn(missing_docs)]
11
12mod adapter;
13mod config;
14mod kind;
15mod protocol;
16mod registration;
17#[cfg(test)]
18mod tests;
19
20pub use config::Config;
21pub use registration::register;
22
23pub(crate) use adapter::TgiAdapter;
24pub(crate) use kind::TGI_KIND;
25#[cfg(test)]
26pub(crate) use protocol::{OaiChatChoice, OaiChatMessage, OaiUsage};
27pub(crate) use protocol::{OaiChatResponse, tgi_chat_body, tgi_predict_response};