Skip to main content

langfuse_client_base/models/
upsert_llm_connection_request.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
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/// UpsertLlmConnectionRequest : Request to create or update an LLM connection (upsert)
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
16pub struct UpsertLlmConnectionRequest {
17    /// Provider name (e.g., 'openai', 'my-gateway'). Must be unique in project, used for upserting.
18    #[serde(rename = "provider")]
19    pub provider: String,
20    #[serde(rename = "adapter")]
21    pub adapter: models::LlmAdapter,
22    /// Secret key for the LLM API.
23    #[serde(rename = "secretKey")]
24    pub secret_key: String,
25    /// Custom base URL for the LLM API
26    #[serde(
27        rename = "baseURL",
28        default,
29        with = "::serde_with::rust::double_option",
30        skip_serializing_if = "Option::is_none"
31    )]
32    pub base_url: Option<Option<String>>,
33    /// List of custom model names
34    #[serde(
35        rename = "customModels",
36        default,
37        with = "::serde_with::rust::double_option",
38        skip_serializing_if = "Option::is_none"
39    )]
40    pub custom_models: Option<Option<Vec<String>>>,
41    /// Whether to include default models. Default is true.
42    #[serde(
43        rename = "withDefaultModels",
44        default,
45        with = "::serde_with::rust::double_option",
46        skip_serializing_if = "Option::is_none"
47    )]
48    pub with_default_models: Option<Option<bool>>,
49    /// Extra headers to send with requests
50    #[serde(
51        rename = "extraHeaders",
52        default,
53        with = "::serde_with::rust::double_option",
54        skip_serializing_if = "Option::is_none"
55    )]
56    pub extra_headers: Option<Option<std::collections::HashMap<String, String>>>,
57    /// Adapter-specific configuration. Validation rules: - **Bedrock**: Required. Must be `{\"region\": \"<aws-region>\"}` (e.g., `{\"region\":\"us-east-1\"}`) - **VertexAI**: Optional. If provided, must be `{\"location\": \"<gcp-location>\"}` (e.g., `{\"location\":\"us-central1\"}`) - **Other adapters**: Not supported. Omit this field or set to null.
58    #[serde(
59        rename = "config",
60        default,
61        with = "::serde_with::rust::double_option",
62        skip_serializing_if = "Option::is_none"
63    )]
64    pub config: Option<Option<std::collections::HashMap<String, serde_json::Value>>>,
65}
66
67impl UpsertLlmConnectionRequest {
68    /// Request to create or update an LLM connection (upsert)
69    pub fn new(
70        provider: String,
71        adapter: models::LlmAdapter,
72        secret_key: String,
73    ) -> UpsertLlmConnectionRequest {
74        UpsertLlmConnectionRequest {
75            provider,
76            adapter,
77            secret_key,
78            base_url: None,
79            custom_models: None,
80            with_default_models: None,
81            extra_headers: None,
82            config: None,
83        }
84    }
85}