Skip to content

Commit 69d58fb

Browse files
authored
Add new integration with Opik Tracking tool (#11501)
1 parent cb34991 commit 69d58fb

File tree

23 files changed

+1380
-26
lines changed

23 files changed

+1380
-26
lines changed

api/core/ops/entities/config_entity.py

+32
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
class TracingProviderEnum(Enum):
77
LANGFUSE = "langfuse"
88
LANGSMITH = "langsmith"
9+
OPIK = "opik"
910

1011

1112
class BaseTracingConfig(BaseModel):
@@ -56,5 +57,36 @@ def set_value(cls, v, info: ValidationInfo):
5657
return v
5758

5859

60+
class OpikConfig(BaseTracingConfig):
61+
"""
62+
Model class for Opik tracing config.
63+
"""
64+
65+
api_key: str | None = None
66+
project: str | None = None
67+
workspace: str | None = None
68+
url: str = "https://www.comet.com/opik/api/"
69+
70+
@field_validator("project")
71+
@classmethod
72+
def project_validator(cls, v, info: ValidationInfo):
73+
if v is None or v == "":
74+
v = "Default Project"
75+
76+
return v
77+
78+
@field_validator("url")
79+
@classmethod
80+
def url_validator(cls, v, info: ValidationInfo):
81+
if v is None or v == "":
82+
v = "https://www.comet.com/opik/api/"
83+
if not v.startswith(("https://", "http://")):
84+
raise ValueError("url must start with https:// or http://")
85+
if not v.endswith("/api/"):
86+
raise ValueError("url should ends with /api/")
87+
88+
return v
89+
90+
5991
OPS_FILE_PATH = "ops_trace/"
6092
OPS_TRACE_FAILED_KEY = "FAILED_OPS_TRACE"

api/core/ops/opik_trace/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)