fix(api): fix incorrect path handling in Langfuse integration (#22766)
Co-authored-by: QuantumGhost <obelisk.reg+git@gmail.com>
This commit is contained in:
parent
5c5f61b2aa
commit
fce126b206
3 changed files with 15 additions and 2 deletions
|
|
@ -102,7 +102,7 @@ class LangfuseConfig(BaseTracingConfig):
|
||||||
@field_validator("host")
|
@field_validator("host")
|
||||||
@classmethod
|
@classmethod
|
||||||
def host_validator(cls, v, info: ValidationInfo):
|
def host_validator(cls, v, info: ValidationInfo):
|
||||||
return cls.validate_endpoint_url(v, "https://api.langfuse.com")
|
return validate_url_with_path(v, "https://api.langfuse.com")
|
||||||
|
|
||||||
|
|
||||||
class LangSmithConfig(BaseTracingConfig):
|
class LangSmithConfig(BaseTracingConfig):
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,13 @@ def generate_dotted_order(
|
||||||
|
|
||||||
def validate_url(url: str, default_url: str, allowed_schemes: tuple = ("https", "http")) -> str:
|
def validate_url(url: str, default_url: str, allowed_schemes: tuple = ("https", "http")) -> str:
|
||||||
"""
|
"""
|
||||||
Validate and normalize URL with proper error handling
|
Validate and normalize URL with proper error handling.
|
||||||
|
|
||||||
|
NOTE: This function does not retain the `path` component of the provided URL.
|
||||||
|
In most cases, it is recommended to use `validate_url_with_path` instead.
|
||||||
|
|
||||||
|
This function is deprecated and retained only for compatibility purposes.
|
||||||
|
New implementations should use `validate_url_with_path`.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
url: The URL to validate
|
url: The URL to validate
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,13 @@ class TestLangfuseConfig:
|
||||||
assert config.secret_key == "secret_key"
|
assert config.secret_key == "secret_key"
|
||||||
assert config.host == "https://custom.langfuse.com"
|
assert config.host == "https://custom.langfuse.com"
|
||||||
|
|
||||||
|
def test_valid_config_with_path(self):
|
||||||
|
host = host = "https://custom.langfuse.com/api/v1"
|
||||||
|
config = LangfuseConfig(public_key="public_key", secret_key="secret_key", host=host)
|
||||||
|
assert config.public_key == "public_key"
|
||||||
|
assert config.secret_key == "secret_key"
|
||||||
|
assert config.host == host
|
||||||
|
|
||||||
def test_default_values(self):
|
def test_default_values(self):
|
||||||
"""Test default values are set correctly"""
|
"""Test default values are set correctly"""
|
||||||
config = LangfuseConfig(public_key="public", secret_key="secret")
|
config = LangfuseConfig(public_key="public", secret_key="secret")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue