diff --git a/docs/scripts/generate_python_sdk_docs.py b/docs/scripts/generate_python_sdk_docs.py index cbe040b9760..889091a6c2f 100644 --- a/docs/scripts/generate_python_sdk_docs.py +++ b/docs/scripts/generate_python_sdk_docs.py @@ -263,8 +263,8 @@ def doc_module(module, root_path="./docs/reference/python-sdk", module_root_path def main(): import weave from weave import feedback - from weave import weave_client as client from weave.trace import util + from weave.trace import weave_client as client from weave.trace_server import ( remote_http_trace_server, trace_server_interface, diff --git a/weave/client_context/weave_client.py b/weave/client_context/weave_client.py index ad0eb78b3dd..c0b3da823df 100644 --- a/weave/client_context/weave_client.py +++ b/weave/client_context/weave_client.py @@ -5,7 +5,7 @@ from weave.legacy import context_state if TYPE_CHECKING: - from weave.weave_client import WeaveClient + from weave.trace.weave_client import WeaveClient _global_weave_client: Optional["WeaveClient"] = None lock = threading.Lock() diff --git a/weave/conftest.py b/weave/conftest.py index 0b401ce0ff4..9ff85968cc8 100644 --- a/weave/conftest.py +++ b/weave/conftest.py @@ -22,9 +22,7 @@ remote_http_trace_server, sqlite_trace_server, ) -from weave.trace_server import ( - trace_server_interface as tsi, -) +from weave.trace_server import trace_server_interface as tsi from . import environment, logs from .tests import fixture_fakewandb diff --git a/weave/flow/eval.py b/weave/flow/eval.py index 49122b3d1d1..c69cd675925 100644 --- a/weave/flow/eval.py +++ b/weave/flow/eval.py @@ -24,7 +24,7 @@ from weave.trace.errors import OpCallError from weave.trace.op import Op from weave.trace.vals import WeaveObject -from weave.weave_client import get_ref +from weave.trace.weave_client import get_ref console = Console() diff --git a/weave/flow/obj.py b/weave/flow/obj.py index cdfda1899e1..07dc694d060 100644 --- a/weave/flow/obj.py +++ b/weave/flow/obj.py @@ -11,7 +11,7 @@ from weave.trace.op import ObjectRef, Op, call from weave.trace.vals import WeaveObject, pydantic_getattribute -from weave.weave_client import get_ref +from weave.trace.weave_client import get_ref class Object(BaseModel): diff --git a/weave/integrations/dspy/dspy_test.py b/weave/integrations/dspy/dspy_test.py index 8bbb9514502..db2d1099dfa 100644 --- a/weave/integrations/dspy/dspy_test.py +++ b/weave/integrations/dspy/dspy_test.py @@ -4,8 +4,8 @@ import pytest import weave +from weave.trace.weave_client import WeaveClient from weave.trace_server import trace_server_interface as tsi -from weave.weave_client import WeaveClient def _get_call_output(call: tsi.CallSchema) -> Any: diff --git a/weave/integrations/langchain/langchain.py b/weave/integrations/langchain/langchain.py index 52e7be8ac39..9d2ee657d9e 100644 --- a/weave/integrations/langchain/langchain.py +++ b/weave/integrations/langchain/langchain.py @@ -42,7 +42,7 @@ ) from weave.trace import call_context from weave.trace.patcher import Patcher -from weave.weave_client import Call +from weave.trace.weave_client import Call import_failed = False diff --git a/weave/integrations/langchain/langchain_test.py b/weave/integrations/langchain/langchain_test.py index 91e698ef98c..61decdb1819 100644 --- a/weave/integrations/langchain/langchain_test.py +++ b/weave/integrations/langchain/langchain_test.py @@ -4,8 +4,8 @@ import pytest import weave +from weave.trace.weave_client import WeaveClient from weave.trace_server import trace_server_interface as tsi -from weave.weave_client import WeaveClient def filter_body(r: Any) -> Any: diff --git a/weave/integrations/llamaindex/llamaindex.py b/weave/integrations/llamaindex/llamaindex.py index b1abc37b8f4..acb22efb3c3 100644 --- a/weave/integrations/llamaindex/llamaindex.py +++ b/weave/integrations/llamaindex/llamaindex.py @@ -1,6 +1,6 @@ from weave.client_context import weave_client as weave_client_context from weave.trace.patcher import Patcher -from weave.weave_client import Call +from weave.trace.weave_client import Call TRANSFORM_EMBEDDINGS = False ALLOWED_ROOT_EVENT_TYPES = ("query",) diff --git a/weave/legacy/op_def.py b/weave/legacy/op_def.py index 614ec03ad44..0dff7ace695 100644 --- a/weave/legacy/op_def.py +++ b/weave/legacy/op_def.py @@ -34,7 +34,7 @@ from weave.weavejs_fixes import fixup_node if typing.TYPE_CHECKING: - from weave import weave_client + from weave.trace import weave_client from weave.legacy.run_streamtable_span import RunStreamTableSpan diff --git a/weave/query_api.py b/weave/query_api.py index f457072c8e6..03ff7562fdf 100644 --- a/weave/query_api.py +++ b/weave/query_api.py @@ -18,7 +18,7 @@ from weave.legacy import context as _context from . import weave_init as _weave_init -from . import weave_client as _weave_client +from .trace import weave_client as _weave_client # exposed as part of api from . import weave_types as types diff --git a/weave/ref_base.py b/weave/ref_base.py index e2bfa52add4..120ff9fed6d 100644 --- a/weave/ref_base.py +++ b/weave/ref_base.py @@ -17,8 +17,8 @@ REFS: weakref.WeakValueDictionary[int, "Ref"] = weakref.WeakValueDictionary() if typing.TYPE_CHECKING: - from . import weave_client from . import weave_types as types + from .trace import weave_client def _map_to_ref_strs(obj: typing.Any) -> typing.Any: diff --git a/weave/tests/trace/test_anonymous_ops.py b/weave/tests/trace/test_anonymous_ops.py index cd7a44ad02e..0b4502729b5 100644 --- a/weave/tests/trace/test_anonymous_ops.py +++ b/weave/tests/trace/test_anonymous_ops.py @@ -1,4 +1,4 @@ -from weave import weave_client +from weave.trace import weave_client from weave.trace_server.trace_server_interface import CallsQueryReq diff --git a/weave/tests/trace/trace_server_clickhouse_conftest.py b/weave/tests/trace/trace_server_clickhouse_conftest.py index 23b4b6e0371..7d28d4506a9 100644 --- a/weave/tests/trace/trace_server_clickhouse_conftest.py +++ b/weave/tests/trace/trace_server_clickhouse_conftest.py @@ -9,7 +9,7 @@ import pytest import requests -from weave import weave_client +from weave.trace import weave_client from weave.trace_server import ( clickhouse_trace_server_batched, external_to_internal_trace_server_adapter, diff --git a/weave/trace/call_context.py b/weave/trace/call_context.py index 74d9d9ed1e3..2c3860e80c3 100644 --- a/weave/trace/call_context.py +++ b/weave/trace/call_context.py @@ -6,7 +6,7 @@ if typing.TYPE_CHECKING: # from .run import Run - from ..weave_client import Call + from .weave_client import Call _call_stack: contextvars.ContextVar[list["Call"]] = contextvars.ContextVar( "call", default=[] diff --git a/weave/trace/op.py b/weave/trace/op.py index 559cd0a4d45..29babb6b2d9 100644 --- a/weave/trace/op.py +++ b/weave/trace/op.py @@ -27,7 +27,7 @@ from .constants import TRACE_CALL_EMOJI if TYPE_CHECKING: - from weave.weave_client import Call, CallsIter + from weave.trace.weave_client import Call, CallsIter try: from openai._types import NOT_GIVEN as OPENAI_NOT_GIVEN diff --git a/weave/trace/tests/test_op_return_forms.py b/weave/trace/tests/test_op_return_forms.py index 2b5e6cff332..e441718eb7f 100644 --- a/weave/trace/tests/test_op_return_forms.py +++ b/weave/trace/tests/test_op_return_forms.py @@ -2,7 +2,7 @@ import weave from weave.trace.op_extensions.accumulator import add_accumulator -from weave.weave_client import get_ref +from weave.trace.weave_client import get_ref from ...trace_server import trace_server_interface as tsi diff --git a/weave/weave_client.py b/weave/trace/weave_client.py similarity index 99% rename from weave/weave_client.py rename to weave/trace/weave_client.py index 1d136f7a994..ce2ea38eea1 100644 --- a/weave/weave_client.py +++ b/weave/trace/weave_client.py @@ -51,7 +51,7 @@ ) if typing.TYPE_CHECKING: - from . import ref_base + from .. import ref_base # Controls if objects can have refs to projects not the WeaveClient project. diff --git a/weave/trace_api.py b/weave/trace_api.py index a586cfe4639..48a3b0a93af 100644 --- a/weave/trace_api.py +++ b/weave/trace_api.py @@ -15,11 +15,10 @@ type_serializers, # noqa: F401 urls, util, - weave_client, weave_init, ) from .table import Table -from .trace import context +from .trace import context, weave_client from .trace.constants import TRACE_OBJECT_EMOJI from .trace.op import Op, op from .trace.refs import ObjectRef, parse_uri diff --git a/weave/type_serializers/Image/image_test.py b/weave/type_serializers/Image/image_test.py index cf42c07c4d6..0e93201079f 100644 --- a/weave/type_serializers/Image/image_test.py +++ b/weave/type_serializers/Image/image_test.py @@ -1,7 +1,7 @@ from PIL import Image import weave -from weave.weave_client import WeaveClient, get_ref +from weave.trace.weave_client import WeaveClient, get_ref """When testing types, it is important to test: Objects: diff --git a/weave/weave_init.py b/weave/weave_init.py index 6febcbc3c88..b2ef6d98acd 100644 --- a/weave/weave_init.py +++ b/weave/weave_init.py @@ -2,8 +2,8 @@ from weave.client_context import weave_client as weave_client_context -from . import errors, init_message, trace_sentry, weave_client -from .trace import autopatch +from . import errors, init_message, trace_sentry +from .trace import autopatch, weave_client from .trace_server import remote_http_trace_server, sqlite_trace_server _current_inited_client = None