Skip to content

Commit ef024cb

Browse files
gustavocidornelaswhoseoyster
authored andcommitted
Completes OPEN-5778 Raise deprecation warnings for publish, start_monitoring and stop_monitoring
1 parent 3f78a39 commit ef024cb

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

openlayer/llm_monitors.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
import logging
44
import time
5-
from typing import Dict, List
5+
import warnings
6+
from typing import Dict, List, Optional
67

78
import openai
89

@@ -62,8 +63,36 @@ class OpenAIMonitor:
6263
def __init__(
6364
self,
6465
client=None,
66+
publish: Optional[bool] = None,
6567
) -> None:
6668
self._initialize_openai(client)
69+
if publish is not None:
70+
warnings.warn(
71+
"The `publish` parameter is deprecated and will be removed in a future"
72+
" version. All traces are now automatically published to Openlayer.",
73+
DeprecationWarning,
74+
stacklevel=2,
75+
)
76+
77+
def start_monitoring(self) -> None:
78+
"""Start monitoring the OpenAI assistant."""
79+
warnings.warn(
80+
"The `start_monitoring` method is deprecated and will be removed in a future"
81+
" version. Monitoring is now automatically enabled once the OpenAIMonitor"
82+
" is instantiated.",
83+
DeprecationWarning,
84+
stacklevel=2,
85+
)
86+
87+
def stop_monitoring(self) -> None:
88+
"""Stop monitoring the OpenAI assistant."""
89+
warnings.warn(
90+
"The `stop_monitoring` method is deprecated and will be removed in a future"
91+
" version. Monitoring is now automatically enabled once the OpenAIMonitor"
92+
" is instantiated.",
93+
DeprecationWarning,
94+
stacklevel=2,
95+
)
6796

6897
def _initialize_openai(self, client) -> None:
6998
"""Initializes the OpenAI attributes."""

0 commit comments

Comments
 (0)