Skip to main content

rskit_inference_tgi/
config.rs

1use rskit_util::SecretString;
2use serde::{Deserialize, Serialize};
3
4use crate::TGI_KIND;
5
6/// Configuration for the TGI OAI-compatible adapter.
7#[derive(Clone, Debug, Serialize, Deserialize)]
8pub struct Config {
9    /// Base URL of the TGI server, for example `http://localhost:8080`.
10    pub base_url: String,
11    /// Default model identifier.
12    #[serde(default = "default_model")]
13    pub model: String,
14    /// Optional bearer token for authenticated TGI deployments.
15    ///
16    /// The value is redacted in debug output and serialization.
17    #[serde(default)]
18    pub api_key: Option<SecretString>,
19    /// Max new tokens for generation.
20    #[serde(default = "default_max_tokens")]
21    pub max_tokens: u32,
22}
23
24fn default_model() -> String {
25    TGI_KIND.into()
26}
27
28fn default_max_tokens() -> u32 {
29    256
30}