Skip to content

Commit fb2c350

Browse files
committed
Add optional public URL for langfuse
1 parent a6ea9c9 commit fb2c350

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

gen-ai/orchestrator-core/src/main/kotlin/ai/tock/genai/orchestratorcore/mappers/ObservabilitySettingMapper.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ object ObservabilitySettingMapper {
3434
when(this){
3535
is LangfuseObservabilitySetting -> {
3636
val secretKey = SecurityUtils.fetchSecretKeyValue(secretKey)
37-
return LangfuseObservabilitySetting(secretKey, publicKey, url)
37+
return LangfuseObservabilitySetting(secretKey, publicKey, url, publicUrl)
3838
}
3939
else ->
4040
throw IllegalArgumentException("Unsupported Observability Setting")
@@ -54,7 +54,7 @@ object ObservabilitySettingMapper {
5454
when (this) {
5555
is LangfuseObservabilitySetting -> {
5656
val secretKey = SecurityUtils.createSecretKey(namespace, botId, feature, secretKey)
57-
return LangfuseObservabilitySetting(secretKey, publicKey, url)
57+
return LangfuseObservabilitySetting(secretKey, publicKey, url, publicUrl)
5858
}
5959
else ->
6060
throw IllegalArgumentException("Unsupported Observability Setting")

gen-ai/orchestrator-core/src/main/kotlin/ai/tock/genai/orchestratorcore/models/observability/LangfuseObservabilitySetting.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ import ai.tock.shared.security.key.HasSecretKey
2121
data class LangfuseObservabilitySetting<T>(
2222
override val secretKey: T,
2323
val publicKey: String,
24-
val url: String
24+
val url: String,
25+
val publicUrl : String? = null,
2526
) : ObservabilitySettingBase<T>(ObservabilityProvider.Langfuse), HasSecretKey<T>

gen-ai/orchestrator-server/src/main/python/server/src/gen_ai_orchestrator/models/observability/langfuse/langfuse_setting.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#
1515
"""Model for creating LangfuseObservabilitySetting."""
1616

17-
from typing import Literal
17+
from typing import Literal, Optional
1818

1919
from pydantic import AnyUrl, Field
2020

@@ -42,6 +42,11 @@ class LangfuseObservabilitySetting(BaseObservabilitySetting):
4242
url: AnyUrl = Field(
4343
description='The Langfuse server url', examples=['https://cloud.langfuse.com'], default='http://localhost:3000'
4444
)
45+
public_url: Optional[AnyUrl] = Field(
46+
default=None,
47+
description="Optional public URL for Langfuse server",
48+
examples=["https://public.langfuse.com"]
49+
)
4550
secret_key: SecretKey = Field(
4651
description='Stores the secret key used to authenticate requests to the Observability Provider API.',
4752
examples=[RawSecretKey(secret='sk-********************be8f')],

gen-ai/orchestrator-server/src/main/python/server/src/gen_ai_orchestrator/routers/observability_providers_router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ async def get_observability_provider_setting_by_id(
119119
provider=ObservabilityProvider.LANGFUSE,
120120
secret_key=RawSecretKey(secret='sk-********************be8f'),
121121
public_key='pk-lf-5e374dc6-e194-4b37-9c07-b77e68ef7d2c',
122-
url='https://cloud.langfuse.com'
122+
url='https://cloud.langfuse.com',
123123
)
124124

125125

gen-ai/orchestrator-server/src/main/python/server/src/gen_ai_orchestrator/services/langchain/factories/callback_handlers/langfuse_callback_handler_factory.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ def check_observability_setting(self) -> bool:
6363
return True
6464

6565
def _fetch_settings(self):
66+
host = str(self.setting.public_url or self.setting.url)
67+
logger.info(f"Using Langfuse host: {host}")
6668
return {
67-
'host': str(self.setting.url),
68-
'public_key': self.setting.public_key,
69+
'host': host,
6970
'secret_key': fetch_secret_key_value(self.setting.secret_key),
7071
'timeout': application_settings.observability_provider_timeout,
7172
'max_retries': application_settings.observability_provider_max_retries

0 commit comments

Comments
 (0)