Skip to content

Commit b3441b6

Browse files
committed
fixes to openai being required
1 parent bdfed80 commit b3441b6

File tree

5 files changed

+60
-36
lines changed

5 files changed

+60
-36
lines changed

pyproject.toml

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ description = "Python SDK for LangTrace"
1212
readme = "README.md"
1313
authors = [{ name = "Scale3 Labs", email = "[email protected]" }]
1414
license = "Apache-2.0"
15-
classifiers=[
16-
"Programming Language :: Python :: 3",
17-
"License :: OSI Approved :: Apache Software License",
18-
"Operating System :: OS Independent",
15+
classifiers = [
16+
"Programming Language :: Python :: 3",
17+
"License :: OSI Approved :: Apache Software License",
18+
"Operating System :: OS Independent",
1919
]
2020
dependencies = [
2121
'trace-attributes==7.0.1',
@@ -28,39 +28,35 @@ dependencies = [
2828
'tiktoken>=0.1.1',
2929
'colorama>=0.4.6',
3030
'sqlalchemy',
31-
'fsspec>=2024.6.0'
31+
'fsspec>=2024.6.0',
32+
"transformers>=4.11.3",
3233
]
3334

3435
requires-python = ">=3.9"
3536

3637
[project.optional-dependencies]
3738
dev = [
38-
"openai",
39-
"anthropic",
40-
"chromadb",
41-
"qdrant-client",
42-
"python-dotenv",
43-
"pinecone-client",
44-
"langchain",
45-
"langchain-community",
46-
"langchain-openai",
47-
"langchain-openai",
48-
"chromadb",
49-
"cohere",
50-
"qdrant_client",
51-
"weaviate-client",
52-
"ollama",
53-
"groq",
54-
"google-generativeai",
55-
"google-cloud-aiplatform"
56-
]
57-
58-
test = [
59-
"pytest",
60-
"pytest-vcr",
61-
"pytest-asyncio",
39+
"openai",
40+
"anthropic",
41+
"chromadb",
42+
"qdrant-client",
43+
"python-dotenv",
44+
"pinecone-client",
45+
"langchain",
46+
"langchain-community",
47+
"langchain-openai",
48+
"langchain-openai",
49+
"chromadb",
50+
"cohere",
51+
"qdrant_client",
52+
"weaviate-client",
53+
"ollama",
54+
"groq",
55+
"google-generativeai",
56+
"google-cloud-aiplatform",
6257
]
6358

59+
test = ["pytest", "pytest-vcr", "pytest-asyncio"]
6460

6561

6662
[project.urls]
@@ -71,9 +67,7 @@ Homepage = "https://github.com/Scale3-Labs/langtrace-python-sdk"
7167
path = "src/langtrace_python_sdk/version.py"
7268

7369
[tool.hatch.build.targets.sdist]
74-
include = [
75-
"/src",
76-
]
70+
include = ["/src"]
7771

7872
[tool.hatch.build.targets.wheel]
7973
packages = ["src/langtrace_python_sdk", "src/examples", "src/tests"]

src/langtrace_python_sdk/instrumentation/openai/patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
StreamWrapper,
4545
set_span_attributes,
4646
)
47-
from openai._types import NOT_GIVEN
47+
from langtrace_python_sdk.types import NOT_GIVEN
4848

4949

5050
def images_generate(original_method, version, tracer):

src/langtrace_python_sdk/types/__init__.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List, Literal, TypedDict
1+
from typing import List, Literal, TypeVar, TypedDict, Union, override
22
from enum import Enum
33

44

@@ -104,3 +104,33 @@ class InstrumentationMethods(TypedDict):
104104
anthropic: List[VendorMethods.AnthropicMethods]
105105
cohere: List[VendorMethods.CohereMethods]
106106
weaviate: List[str]
107+
108+
_T = TypeVar("_T")
109+
class NotGiven:
110+
"""
111+
A sentinel singleton class used to distinguish omitted keyword arguments
112+
from those passed in with the value None (which may have different behavior).
113+
114+
For example:
115+
116+
```py
117+
def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response:
118+
...
119+
120+
121+
get(timeout=1) # 1s timeout
122+
get(timeout=None) # No timeout
123+
get() # Default timeout behavior, which may not be statically known at the method definition.
124+
```
125+
"""
126+
127+
def __bool__(self) -> Literal[False]:
128+
return False
129+
130+
@override
131+
def __repr__(self) -> str:
132+
return "NOT_GIVEN"
133+
134+
135+
NotGivenOr = Union[_T, NotGiven]
136+
NOT_GIVEN = NotGiven()

src/langtrace_python_sdk/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from openai import NOT_GIVEN
1+
from langtrace_python_sdk.types import NOT_GIVEN
22
from .sdk_version_checker import SDKVersionChecker
33
from opentelemetry.trace import Span
44
from langtrace.trace_attributes import SpanAttributes

src/langtrace_python_sdk/utils/llm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from langtrace_python_sdk.constants import LANGTRACE_SDK_NAME
1818
from langtrace_python_sdk.utils import set_span_attribute
19-
from openai import NOT_GIVEN
19+
from langtrace_python_sdk.types import NOT_GIVEN
2020
from tiktoken import get_encoding
2121

2222
from langtrace_python_sdk.constants.instrumentation.common import (

0 commit comments

Comments
 (0)