Langfuse_configuration

This module contains functionality related to the the langfuse_configuration module for augmentation.bootstrap.configuration.

Langfuse_configuration

LangfuseConfiguration

Bases: BaseConfigurationWithSecrets

Main configuration for the Langfuse integration.

Contains all settings required to connect to and use the Langfuse platform, including server connection details, authentication, and dataset configurations.

Source code in src/augmentation/bootstrap/configuration/langfuse_configuration.py
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
class LangfuseConfiguration(BaseConfigurationWithSecrets):
    """Main configuration for the Langfuse integration.

    Contains all settings required to connect to and use the Langfuse platform,
    including server connection details, authentication, and dataset configurations.
    """

    class Secrets(BaseSecrets):
        """API authentication credentials for Langfuse.

        All fields are loaded from environment variables with the prefix RAG__LANGFUSE__.
        """

        model_config = ConfigDict(
            env_file_encoding="utf-8",
            env_prefix="RAG__LANGFUSE__",
            env_nested_delimiter="__",
            extra="ignore",
        )

        public_key: SecretStr = Field(
            ...,
            description="Public API key for authenticating with the Langfuse service",
        )
        secret_key: SecretStr = Field(
            ...,
            description="Secret API key for authenticating with the Langfuse service",
        )

    host: str = Field(
        "127.0.0.1", description="Hostname or IP address of the Langfuse server"
    )
    protocol: Union[Literal["http"], Literal["https"]] = Field(
        "http",
        description="Network protocol to use when connecting to the Langfuse server",
    )
    port: int = Field(
        3000,
        description="TCP port number on which the Langfuse server is listening",
    )
    database: LangfuseDatabaseConfiguration = Field(
        description="Database connection configuration for the Langfuse server",
        default_factory=LangfuseDatabaseConfiguration,
    )
    datasets: LangfuseDatasetsConfiguration = Field(
        description="Configuration for all datasets managed in the Langfuse platform",
        default_factory=LangfuseDatasetsConfiguration,
    )
    chainlit_tag_format: str = Field(
        "chainlit_message_id: {message_id}",
        description="Template string for generating tags that link Chainlit messages to Langfuse traces",
    )
    secrets: Secrets = Field(
        None,
        description="API authentication credentials for the Langfuse service",
    )

    @property
    def url(self) -> str:
        """Generate the complete URL for connecting to the Langfuse server.

        Returns:
            str: Fully formatted URL with protocol, host, and port
        """
        return f"{self.protocol}://{self.host}:{self.port}"

url property

Generate the complete URL for connecting to the Langfuse server.

Returns:
  • str( str ) –

    Fully formatted URL with protocol, host, and port

Secrets

Bases: BaseSecrets

API authentication credentials for Langfuse.

All fields are loaded from environment variables with the prefix RAG__LANGFUSE__.

Source code in src/augmentation/bootstrap/configuration/langfuse_configuration.py
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
class Secrets(BaseSecrets):
    """API authentication credentials for Langfuse.

    All fields are loaded from environment variables with the prefix RAG__LANGFUSE__.
    """

    model_config = ConfigDict(
        env_file_encoding="utf-8",
        env_prefix="RAG__LANGFUSE__",
        env_nested_delimiter="__",
        extra="ignore",
    )

    public_key: SecretStr = Field(
        ...,
        description="Public API key for authenticating with the Langfuse service",
    )
    secret_key: SecretStr = Field(
        ...,
        description="Secret API key for authenticating with the Langfuse service",
    )

LangfuseDatabaseConfiguration

Bases: BaseConfigurationWithSecrets

Configuration for connecting to the Langfuse PostgreSQL database.

Contains all database connection parameters and credentials required for the Langfuse observation and analytics platform.

Source code in src/augmentation/bootstrap/configuration/langfuse_configuration.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
class LangfuseDatabaseConfiguration(BaseConfigurationWithSecrets):
    """Configuration for connecting to the Langfuse PostgreSQL database.

    Contains all database connection parameters and credentials required for the Langfuse
    observation and analytics platform.
    """

    class Secrets(BaseSecrets):
        """Secret credentials for Langfuse database authentication.

        All fields are loaded from environment variables with the prefix RAG__LANGFUSE__DATABASE__.
        """

        model_config = ConfigDict(
            env_file_encoding="utf-8",
            env_prefix="RAG__LANGFUSE__DATABASE__",
            env_nested_delimiter="__",
            extra="ignore",
        )

        user: SecretStr = Field(
            ...,
            description="Username for authenticating with the Langfuse database server",
        )
        password: SecretStr = Field(
            ...,
            description="Password for authenticating with the Langfuse database server",
        )

    host: str = Field(
        "127.0.0.1",
        description="Hostname or IP address of the Langfuse database server",
    )
    port: int = Field(
        5432,
        description="TCP port number on which the Langfuse database server is listening",
    )
    db: str = Field(
        "langfuse",
        description="Name of the specific database to connect to on the Langfuse server",
    )
    secrets: Secrets = Field(
        None, description="Authentication credentials for the Langfuse database"
    )

Secrets

Bases: BaseSecrets

Secret credentials for Langfuse database authentication.

All fields are loaded from environment variables with the prefix RAG__LANGFUSE__DATABASE__.

Source code in src/augmentation/bootstrap/configuration/langfuse_configuration.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
class Secrets(BaseSecrets):
    """Secret credentials for Langfuse database authentication.

    All fields are loaded from environment variables with the prefix RAG__LANGFUSE__DATABASE__.
    """

    model_config = ConfigDict(
        env_file_encoding="utf-8",
        env_prefix="RAG__LANGFUSE__DATABASE__",
        env_nested_delimiter="__",
        extra="ignore",
    )

    user: SecretStr = Field(
        ...,
        description="Username for authenticating with the Langfuse database server",
    )
    password: SecretStr = Field(
        ...,
        description="Password for authenticating with the Langfuse database server",
    )

LangfuseDatasetConfiguration

Bases: BaseConfiguration

Configuration for a single dataset in Langfuse.

Defines properties of a dataset that will be created or used in the Langfuse platform.

Source code in src/augmentation/bootstrap/configuration/langfuse_configuration.py
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
class LangfuseDatasetConfiguration(BaseConfiguration):
    """Configuration for a single dataset in Langfuse.

    Defines properties of a dataset that will be created or used in the Langfuse platform.
    """

    name: str = Field(
        ...,
        description="Unique identifier for the dataset in the Langfuse server",
    )
    description: str = Field(
        ...,
        description="Human-readable explanation of the dataset's purpose and contents",
    )
    metadata: dict = Field(
        {},
        description="Additional structured information about the dataset as key-value pairs",
    )

LangfuseDatasetsConfiguration

Bases: BaseConfiguration

Configuration for all datasets used in the Langfuse platform.

Contains definitions for specialized datasets used for different purposes.

Source code in src/augmentation/bootstrap/configuration/langfuse_configuration.py
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
class LangfuseDatasetsConfiguration(BaseConfiguration):
    """Configuration for all datasets used in the Langfuse platform.

    Contains definitions for specialized datasets used for different purposes.
    """

    feedback_dataset: LangfuseDatasetConfiguration = Field(
        LangfuseDatasetConfiguration(
            name="feedback-dataset",
            description="Dataset created out of positive feedbacks from the chatbot",
        ),
        description="Dataset for storing and analyzing user feedback collected from the chatbot interactions",
    )
    manual_dataset: LangfuseDatasetConfiguration = Field(
        LangfuseDatasetConfiguration(
            name="manual-dataset",
            description="Dataset created directly by the user indicating the query and the correct answer",
        ),
        description="Dataset for storing manually curated query-answer pairs for evaluation and training",
    )