Skip to content

Commit b0e1da1

Browse files
committed
fix missing exports for server
1 parent dc8613e commit b0e1da1

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

guardrails/utils/openai_utils/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
is_static_openai_chat_acreate_func,
77
is_static_openai_chat_create_func,
88
is_static_openai_create_func,
9+
get_static_openai_create_func,
10+
get_static_openai_chat_create_func,
11+
get_static_openai_acreate_func,
12+
get_static_openai_chat_acreate_func,
913
)
1014

1115
__all__ = [
@@ -16,4 +20,8 @@
1620
"is_static_openai_acreate_func",
1721
"is_static_openai_chat_acreate_func",
1822
"OpenAIServiceUnavailableError",
23+
"get_static_openai_create_func",
24+
"get_static_openai_chat_create_func",
25+
"get_static_openai_acreate_func",
26+
"get_static_openai_chat_acreate_func",
1927
]

guardrails/utils/openai_utils/v1.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import openai
44

5+
import warnings
56
from guardrails.classes.llm.llm_response import LLMResponse
67
from guardrails.utils.openai_utils.base import BaseOpenAIClient
78
from guardrails.utils.openai_utils.streaming_utils import (
@@ -12,6 +13,38 @@
1213
from guardrails.telemetry import trace_llm_call, trace_operation
1314

1415

16+
def get_static_openai_create_func():
17+
warnings.warn(
18+
"This function is deprecated. " " and will be removed in 0.6.0",
19+
DeprecationWarning,
20+
)
21+
return openai.completions.create
22+
23+
24+
def get_static_openai_chat_create_func():
25+
warnings.warn(
26+
"This function is deprecated and will be removed in 0.6.0",
27+
DeprecationWarning,
28+
)
29+
return openai.chat.completions.create
30+
31+
32+
def get_static_openai_acreate_func():
33+
warnings.warn(
34+
"This function is deprecated and will be removed in 0.6.0",
35+
DeprecationWarning,
36+
)
37+
return None
38+
39+
40+
def get_static_openai_chat_acreate_func():
41+
warnings.warn(
42+
"This function is deprecated and will be removed in 0.6.0",
43+
DeprecationWarning,
44+
)
45+
return None
46+
47+
1548
def is_static_openai_create_func(llm_api: Optional[Callable]) -> bool:
1649
try:
1750
return llm_api == openai.completions.create

0 commit comments

Comments
 (0)