| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 | 
							- from enum import StrEnum
 - 
 - from pydantic import BaseModel, ValidationInfo, field_validator
 - 
 - 
 - class TracingProviderEnum(StrEnum):
 -     LANGFUSE = "langfuse"
 -     LANGSMITH = "langsmith"
 -     OPIK = "opik"
 -     WEAVE = "weave"
 - 
 - 
 - class BaseTracingConfig(BaseModel):
 -     """
 -     Base model class for tracing
 -     """
 - 
 -     ...
 - 
 - 
 - class LangfuseConfig(BaseTracingConfig):
 -     """
 -     Model class for Langfuse tracing config.
 -     """
 - 
 -     public_key: str
 -     secret_key: str
 -     host: str = "https://api.langfuse.com"
 - 
 -     @field_validator("host")
 -     @classmethod
 -     def set_value(cls, v, info: ValidationInfo):
 -         if v is None or v == "":
 -             v = "https://api.langfuse.com"
 -         if not v.startswith("https://") and not v.startswith("http://"):
 -             raise ValueError("host must start with https:// or http://")
 - 
 -         return v
 - 
 - 
 - 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 set_value(cls, v, info: ValidationInfo):
 -         if v is None or v == "":
 -             v = "https://api.smith.langchain.com"
 -         if not v.startswith("https://"):
 -             raise ValueError("endpoint must start with https://")
 - 
 -         return v
 - 
 - 
 - class OpikConfig(BaseTracingConfig):
 -     """
 -     Model class for Opik tracing config.
 -     """
 - 
 -     api_key: str | None = None
 -     project: str | None = None
 -     workspace: str | None = None
 -     url: str = "https://www.comet.com/opik/api/"
 - 
 -     @field_validator("project")
 -     @classmethod
 -     def project_validator(cls, v, info: ValidationInfo):
 -         if v is None or v == "":
 -             v = "Default Project"
 - 
 -         return v
 - 
 -     @field_validator("url")
 -     @classmethod
 -     def url_validator(cls, v, info: ValidationInfo):
 -         if v is None or v == "":
 -             v = "https://www.comet.com/opik/api/"
 -         if not v.startswith(("https://", "http://")):
 -             raise ValueError("url must start with https:// or http://")
 -         if not v.endswith("/api/"):
 -             raise ValueError("url should ends with /api/")
 - 
 -         return v
 - 
 - 
 - class WeaveConfig(BaseTracingConfig):
 -     """
 -     Model class for Weave tracing config.
 -     """
 - 
 -     api_key: str
 -     entity: str | None = None
 -     project: str
 -     endpoint: str = "https://trace.wandb.ai"
 -     host: str | None = None
 - 
 -     @field_validator("endpoint")
 -     @classmethod
 -     def set_value(cls, v, info: ValidationInfo):
 -         if v is None or v == "":
 -             v = "https://trace.wandb.ai"
 -         if not v.startswith("https://"):
 -             raise ValueError("endpoint must start with https://")
 - 
 -         return v
 - 
 -     @field_validator("host")
 -     @classmethod
 -     def validate_host(cls, v, info: ValidationInfo):
 -         if v is not None and v != "":
 -             if not v.startswith(("https://", "http://")):
 -                 raise ValueError("host must start with https:// or http://")
 -         return v
 - 
 - 
 - OPS_FILE_PATH = "ops_trace/"
 - OPS_TRACE_FAILED_KEY = "FAILED_OPS_TRACE"
 
 
  |