Bases: Factory
Factory class for creating and managing Langfuse prompt service instances.
This class implements the Singleton pattern through inheriting from Factory,
ensuring only one Langfuse prompt service instance exists throughout the application.
Attributes: |
-
_configuration_class
(Type )
–
The configuration class used for creating
Langfuse prompt service instances. In this case, it is LangfuseConfiguration.
|
Source code in src/augmentation/langfuse/prompt_service.py
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109 | class LangfusePromptServiceFactory(Factory):
"""
Factory class for creating and managing Langfuse prompt service instances.
This class implements the Singleton pattern through inheriting from Factory,
ensuring only one Langfuse prompt service instance exists throughout the application.
Attributes:
_configuration_class (Type): The configuration class used for creating
Langfuse prompt service instances. In this case, it is LangfuseConfiguration.
"""
_configuration_class: Type = LangfuseConfiguration
@classmethod
def _create_instance(cls, configuration: LangfuseConfiguration) -> Langfuse:
"""
Creates a new Langfuse prompt service instance.
Args:
configuration (LangfuseConfiguration): Configuration object containing
Langfuse API credentials and URL settings.
Returns:
LangfusePromptService: A configured Langfuse prompt service instance ready for use with the
provided credentials and host.
"""
client = LangfuseClientFactory.create(configuration)
return LangfusePromptService(client=client)
|