Skip to content

Commit

Permalink
weave_client
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtruong committed Aug 21, 2024
1 parent bac6631 commit 64e637c
Show file tree
Hide file tree
Showing 21 changed files with 22 additions and 25 deletions.
2 changes: 1 addition & 1 deletion docs/scripts/generate_python_sdk_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion weave/client_context/weave_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 1 addition & 3 deletions weave/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion weave/flow/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion weave/flow/obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion weave/integrations/dspy/dspy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion weave/integrations/langchain/langchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion weave/integrations/langchain/langchain_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion weave/integrations/llamaindex/llamaindex.py
Original file line number Diff line number Diff line change
@@ -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",)
Expand Down
2 changes: 1 addition & 1 deletion weave/legacy/op_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion weave/query_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion weave/ref_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion weave/tests/trace/test_anonymous_ops.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from weave import weave_client
from weave.trace import weave_client
from weave.trace_server.trace_server_interface import CallsQueryReq


Expand Down
2 changes: 1 addition & 1 deletion weave/tests/trace/trace_server_clickhouse_conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion weave/trace/call_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=[]
Expand Down
2 changes: 1 addition & 1 deletion weave/trace/op.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion weave/trace/tests/test_op_return_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion weave/weave_client.py → weave/trace/weave_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions weave/trace_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion weave/type_serializers/Image/image_test.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 2 additions & 2 deletions weave/weave_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 64e637c

Please sign in to comment.