langfuse_client_base/models/
llm_connection.rs

1/*
2 * langfuse
3 *
4 * ## Authentication  Authenticate with the API using [Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication), get API keys in the project settings:  - username: Langfuse Public Key - password: Langfuse Secret Key  ## Exports  - OpenAPI spec: https://cloud.langfuse.com/generated/api/openapi.yml - Postman collection: https://cloud.langfuse.com/generated/postman/collection.json
5 *
6 * The version of the OpenAPI document:
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// LlmConnection : LLM API connection configuration (secrets excluded)
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct LlmConnection {
17    #[serde(rename = "id")]
18    pub id: String,
19    /// Provider name (e.g., 'openai', 'my-gateway'). Must be unique in project, used for upserting.
20    #[serde(rename = "provider")]
21    pub provider: String,
22    /// The adapter used to interface with the LLM
23    #[serde(rename = "adapter")]
24    pub adapter: String,
25    /// Masked version of the secret key for display purposes
26    #[serde(rename = "displaySecretKey")]
27    pub display_secret_key: String,
28    /// Custom base URL for the LLM API
29    #[serde(
30        rename = "baseURL",
31        default,
32        with = "::serde_with::rust::double_option",
33        skip_serializing_if = "Option::is_none"
34    )]
35    pub base_url: Option<Option<String>>,
36    /// List of custom model names available for this connection
37    #[serde(rename = "customModels")]
38    pub custom_models: Vec<String>,
39    /// Whether to include default models for this adapter
40    #[serde(rename = "withDefaultModels")]
41    pub with_default_models: bool,
42    /// Keys of extra headers sent with requests (values excluded for security)
43    #[serde(rename = "extraHeaderKeys")]
44    pub extra_header_keys: Vec<String>,
45    #[serde(rename = "createdAt")]
46    pub created_at: String,
47    #[serde(rename = "updatedAt")]
48    pub updated_at: String,
49}
50
51impl LlmConnection {
52    /// LLM API connection configuration (secrets excluded)
53    pub fn new(
54        id: String,
55        provider: String,
56        adapter: String,
57        display_secret_key: String,
58        custom_models: Vec<String>,
59        with_default_models: bool,
60        extra_header_keys: Vec<String>,
61        created_at: String,
62        updated_at: String,
63    ) -> LlmConnection {
64        LlmConnection {
65            id,
66            provider,
67            adapter,
68            display_secret_key,
69            base_url: None,
70            custom_models,
71            with_default_models,
72            extra_header_keys,
73            created_at,
74            updated_at,
75        }
76    }
77}