Files
dify/api/providers/trace/trace-langsmith/src/dify_trace_langsmith/config.py
T

21 lines
665 B
Python

from pydantic import ValidationInfo, field_validator
from core.ops.entities.config_entity import BaseTracingConfig
from core.ops.utils import validate_url_with_path
class LangSmithConfig(BaseTracingConfig):
"""
Model class for Langsmith tracing config.
"""
api_key: str
project: str
endpoint: str = "https://api.smith.langchain.com"
@field_validator("endpoint")
@classmethod
def endpoint_validator(cls, v, info: ValidationInfo):
# LangSmith only allows HTTPS; self-hosted deployments may sit under a path prefix
return validate_url_with_path(v, "https://api.smith.langchain.com", allowed_schemes=("https",))