diff --git a/docs/scripts/generate_python_sdk_docs.py b/docs/scripts/generate_python_sdk_docs.py index 4ce5b0ab2fc..6957671b5b6 100644 --- a/docs/scripts/generate_python_sdk_docs.py +++ b/docs/scripts/generate_python_sdk_docs.py @@ -267,10 +267,10 @@ def main(): from weave.trace import feedback, util from weave.trace import op as OpSpec from weave.trace import weave_client as client - from weave.trace_server import ( + from weave.trace_server.interface import query + from weave.trace_server_common import ( trace_server_interface, ) - from weave.trace_server.interface import query module_root_path = weave.__file__.split("/weave/__init__.py")[0] for module in [ diff --git a/tests/conftest.py b/tests/conftest.py index bbba381f04b..7ba153d286f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -22,8 +22,8 @@ sqlite_trace_server, ) from weave.trace_server import environment as ts_env -from weave.trace_server import trace_server_interface as tsi from weave.trace_server_bindings import remote_http_trace_server +from weave.trace_server_common import trace_server_interface as tsi # Force testing to never report wandb sentry events os.environ["WANDB_ERROR_REPORTING"] = "false" diff --git a/tests/integrations/dspy/dspy_test.py b/tests/integrations/dspy/dspy_test.py index d736bb02625..29b7290b008 100644 --- a/tests/integrations/dspy/dspy_test.py +++ b/tests/integrations/dspy/dspy_test.py @@ -7,7 +7,7 @@ flattened_calls_to_names, ) from weave.trace.weave_client import WeaveClient -from weave.trace_server.trace_server_interface import CallsFilter +from weave.trace_server_common.trace_server_interface import CallsFilter @pytest.mark.skip_clickhouse_client diff --git a/tests/integrations/groq/groq_test.py b/tests/integrations/groq/groq_test.py index dd943a3ca4c..4d90ccfb271 100644 --- a/tests/integrations/groq/groq_test.py +++ b/tests/integrations/groq/groq_test.py @@ -9,7 +9,7 @@ flatten_calls, flattened_calls_to_names, ) -from weave.trace_server.trace_server_interface import CallsFilter +from weave.trace_server_common.trace_server_interface import CallsFilter @pytest.mark.skip_clickhouse_client # TODO:VCR recording does not seem to allow us to make requests to the clickhouse db in non-recording mode diff --git a/tests/integrations/langchain/langchain_test.py b/tests/integrations/langchain/langchain_test.py index 0121a640b48..12d1154baec 100644 --- a/tests/integrations/langchain/langchain_test.py +++ b/tests/integrations/langchain/langchain_test.py @@ -11,7 +11,7 @@ op_name_from_ref, ) from weave.trace.weave_client import Call, WeaveClient -from weave.trace_server import trace_server_interface as tsi +from weave.trace_server_common import trace_server_interface as tsi @pytest.fixture(scope="session", autouse=True) diff --git a/tests/integrations/llamaindex/llamaindex_test.py b/tests/integrations/llamaindex/llamaindex_test.py index 2b9a4e51799..fc94e6c74f2 100644 --- a/tests/integrations/llamaindex/llamaindex_test.py +++ b/tests/integrations/llamaindex/llamaindex_test.py @@ -9,7 +9,7 @@ flattened_calls_to_names, ) from weave.trace.weave_client import Call -from weave.trace_server.trace_server_interface import CallsFilter +from weave.trace_server_common.trace_server_interface import CallsFilter def assert_calls_correct_for_quickstart(flattened_calls: list[Call]) -> None: diff --git a/tests/trace/test_anonymous_ops.py b/tests/trace/test_anonymous_ops.py index 0b4502729b5..9623fbb6f25 100644 --- a/tests/trace/test_anonymous_ops.py +++ b/tests/trace/test_anonymous_ops.py @@ -1,5 +1,5 @@ from weave.trace import weave_client -from weave.trace_server.trace_server_interface import CallsQueryReq +from weave.trace_server_common.trace_server_interface import CallsQueryReq def test_named_op(client: weave_client.WeaveClient) -> str: diff --git a/tests/trace/test_client_cost.py b/tests/trace/test_client_cost.py index 18b9f61295a..8a2732c29c8 100644 --- a/tests/trace/test_client_cost.py +++ b/tests/trace/test_client_cost.py @@ -2,10 +2,10 @@ import pytest -from weave.trace_server import trace_server_interface as tsi from weave.trace_server.errors import InvalidRequest from weave.trace_server.interface.query import Query from weave.trace_server.sqlite_trace_server import SqliteTraceServer +from weave.trace_server_common import trace_server_interface as tsi def test_cost_apis(client): diff --git a/tests/trace/test_client_feedback.py b/tests/trace/test_client_feedback.py index 82d87198e13..0cbde9fab63 100644 --- a/tests/trace/test_client_feedback.py +++ b/tests/trace/test_client_feedback.py @@ -1,8 +1,8 @@ import pytest -from weave.trace_server import trace_server_interface as tsi from weave.trace_server.errors import InvalidRequest from weave.trace_server.interface.query import Query +from weave.trace_server_common import trace_server_interface as tsi def test_feedback_apis(client): diff --git a/tests/trace/test_client_trace.py b/tests/trace/test_client_trace.py index f387d20b62b..a96b86c44e2 100644 --- a/tests/trace/test_client_trace.py +++ b/tests/trace/test_client_trace.py @@ -25,7 +25,6 @@ from weave.trace import weave_client from weave.trace.vals import MissingSelfInstanceError from weave.trace.weave_client import sanitize_object_name -from weave.trace_server import trace_server_interface as tsi from weave.trace_server.clickhouse_trace_server_batched import ENTITY_TOO_LARGE_PAYLOAD from weave.trace_server.ids import generate_id from weave.trace_server.refs_internal import extra_value_quoter @@ -36,6 +35,7 @@ extract_refs_from_values, ) from weave.trace_server.validation import SHOULD_ENFORCE_OBJ_ID_CHARSET +from weave.trace_server_common import trace_server_interface as tsi ## Hacky interface compatibility helpers diff --git a/tests/trace/test_evaluation_performance.py b/tests/trace/test_evaluation_performance.py index 909e192c408..f05d052e5ce 100644 --- a/tests/trace/test_evaluation_performance.py +++ b/tests/trace/test_evaluation_performance.py @@ -10,7 +10,7 @@ from tests.trace.util import DummyTestException from weave.trace.context import raise_on_captured_errors from weave.trace.weave_client import WeaveClient -from weave.trace_server import trace_server_interface as tsi +from weave.trace_server_common import trace_server_interface as tsi class BlockingTraceServer(tsi.TraceServerInterface): diff --git a/tests/trace/test_evaluations.py b/tests/trace/test_evaluations.py index dbba17f5d88..e4475691e8b 100644 --- a/tests/trace/test_evaluations.py +++ b/tests/trace/test_evaluations.py @@ -9,7 +9,7 @@ import weave from tests.trace.util import AnyIntMatcher from weave import Evaluation, Model -from weave.trace_server import trace_server_interface as tsi +from weave.trace_server_common import trace_server_interface as tsi def flatten_calls( diff --git a/tests/trace/test_objs_query.py b/tests/trace/test_objs_query.py index 032e440883f..db67ad7fc68 100644 --- a/tests/trace/test_objs_query.py +++ b/tests/trace/test_objs_query.py @@ -1,6 +1,6 @@ import weave from weave.trace.weave_client import WeaveClient -from weave.trace_server import trace_server_interface as tsi +from weave.trace_server_common import trace_server_interface as tsi def generate_objects(weave_client: WeaveClient, obj_count: int, version_count: int): diff --git a/tests/trace/test_op_argument_forms.py b/tests/trace/test_op_argument_forms.py index f771442f77a..a34c7155050 100644 --- a/tests/trace/test_op_argument_forms.py +++ b/tests/trace/test_op_argument_forms.py @@ -1,7 +1,7 @@ import pytest import weave -from weave.trace_server import trace_server_interface as tsi +from weave.trace_server_common import trace_server_interface as tsi # This file tests the different argument variations that can be passed to an op. # diff --git a/tests/trace/test_op_return_forms.py b/tests/trace/test_op_return_forms.py index a69cb6e9421..3306d32ab59 100644 --- a/tests/trace/test_op_return_forms.py +++ b/tests/trace/test_op_return_forms.py @@ -3,7 +3,7 @@ import weave from weave.trace.op_extensions.accumulator import add_accumulator from weave.trace.weave_client import get_ref -from weave.trace_server import trace_server_interface as tsi +from weave.trace_server_common import trace_server_interface as tsi def test_op_return_sync_empty(client): diff --git a/tests/trace/test_op_versioning.py b/tests/trace/test_op_versioning.py index a8ed18ce780..cfe91e74bd1 100644 --- a/tests/trace/test_op_versioning.py +++ b/tests/trace/test_op_versioning.py @@ -4,7 +4,10 @@ import pytest import weave -from weave.trace_server.trace_server_interface import FileContentReadReq, ObjReadReq +from weave.trace_server_common.trace_server_interface import ( + FileContentReadReq, + ObjReadReq, +) def get_saved_code(client, ref): diff --git a/tests/trace/test_table_query.py b/tests/trace/test_table_query.py index 1a45b3963e3..3843b7c4512 100644 --- a/tests/trace/test_table_query.py +++ b/tests/trace/test_table_query.py @@ -1,7 +1,7 @@ import random from weave.trace.weave_client import WeaveClient -from weave.trace_server import trace_server_interface as tsi +from weave.trace_server_common import trace_server_interface as tsi def generate_table_data(client: WeaveClient, n_rows: int, n_cols: int): diff --git a/tests/trace/test_trace_server.py b/tests/trace/test_trace_server.py index e02899370a5..c21d438dbd4 100644 --- a/tests/trace/test_trace_server.py +++ b/tests/trace/test_trace_server.py @@ -2,7 +2,7 @@ import pytest -from weave.trace_server import trace_server_interface as tsi +from weave.trace_server_common import trace_server_interface as tsi def test_save_object(client): diff --git a/tests/trace/test_weave_client.py b/tests/trace/test_weave_client.py index f1e07070ac9..515c3726b4b 100644 --- a/tests/trace/test_weave_client.py +++ b/tests/trace/test_weave_client.py @@ -9,7 +9,7 @@ import requests import weave -import weave.trace_server.trace_server_interface as tsi +import weave.trace_server_common.trace_server_interface as tsi from tests.trace.testutil import ObjectRefStrMatcher from tests.trace.util import ( AnyIntMatcher, @@ -34,7 +34,7 @@ from weave.trace_server.sqlite_trace_server import ( SqliteTraceServer, ) -from weave.trace_server.trace_server_interface import ( +from weave.trace_server_common.trace_server_interface import ( FileContentReadReq, FileCreateReq, RefsReadBatchReq, diff --git a/tests/trace_server/test_call_lifecycle.py b/tests/trace_server/test_call_lifecycle.py index 8bbd6d92606..b8e53f254f0 100644 --- a/tests/trace_server/test_call_lifecycle.py +++ b/tests/trace_server/test_call_lifecycle.py @@ -2,7 +2,7 @@ import uuid from weave.trace import weave_client -from weave.trace_server import trace_server_interface as tsi +from weave.trace_server_common import trace_server_interface as tsi def test_call_update_out_of_order(client: weave_client.WeaveClient): diff --git a/tests/trace_server/test_calls_query_builder.py b/tests/trace_server/test_calls_query_builder.py index 23716a13a68..427c788f3d2 100644 --- a/tests/trace_server/test_calls_query_builder.py +++ b/tests/trace_server/test_calls_query_builder.py @@ -1,9 +1,9 @@ import sqlparse -from weave.trace_server import trace_server_interface as tsi from weave.trace_server.calls_query_builder import CallsQuery, HardCodedFilter from weave.trace_server.interface import query as tsi_query from weave.trace_server.orm import ParamBuilder +from weave.trace_server_common import trace_server_interface as tsi def test_query_baseline() -> None: diff --git a/tests/trace_server/test_orm.py b/tests/trace_server/test_orm.py index 5ad1b04c88e..49db32393e0 100644 --- a/tests/trace_server/test_orm.py +++ b/tests/trace_server/test_orm.py @@ -1,6 +1,5 @@ import pytest -from weave.trace_server import trace_server_interface as tsi from weave.trace_server.orm import ( Column, ParamBuilder, @@ -8,6 +7,7 @@ _transform_external_field_to_internal_field, combine_conditions, ) +from weave.trace_server_common import trace_server_interface as tsi def test_parambuilder_clickhouse(): diff --git a/tests/trace_server/test_remote_http_trace_server.py b/tests/trace_server/test_remote_http_trace_server.py index 5358c19d129..6bb5c19be46 100644 --- a/tests/trace_server/test_remote_http_trace_server.py +++ b/tests/trace_server/test_remote_http_trace_server.py @@ -5,9 +5,9 @@ import requests from pydantic import ValidationError -from weave.trace_server import trace_server_interface as tsi from weave.trace_server.ids import generate_id from weave.trace_server_bindings.remote_http_trace_server import RemoteHTTPTraceServer +from weave.trace_server_common import trace_server_interface as tsi def generate_start(id) -> tsi.StartedCallSchemaForInsert: diff --git a/weave/trace/feedback.py b/weave/trace/feedback.py index c3fd9adca91..6d7bb6f8cf4 100644 --- a/weave/trace/feedback.py +++ b/weave/trace/feedback.py @@ -11,8 +11,8 @@ from weave.trace.rich import pydantic_util from weave.trace.rich.container import AbstractRichContainer from weave.trace.rich.refs import Refs -from weave.trace_server import trace_server_interface as tsi from weave.trace_server.interface.query import Query +from weave.trace_server_common import trace_server_interface as tsi class Feedbacks(AbstractRichContainer[tsi.Feedback]): diff --git a/weave/trace/serialize.py b/weave/trace/serialize.py index 95159a398ec..6e54fada1e0 100644 --- a/weave/trace/serialize.py +++ b/weave/trace/serialize.py @@ -4,12 +4,12 @@ from weave.trace import custom_objs from weave.trace.object_record import ObjectRecord from weave.trace.refs import ObjectRef, TableRef, parse_uri -from weave.trace_server.trace_server_interface import ( +from weave.trace_server.trace_server_interface_util import bytes_digest +from weave.trace_server_common.trace_server_interface import ( FileContentReadReq, FileCreateReq, TraceServerInterface, ) -from weave.trace_server.trace_server_interface_util import bytes_digest if typing.TYPE_CHECKING: from weave.trace.weave_client import WeaveClient diff --git a/weave/trace/vals.py b/weave/trace/vals.py index 017f3b51e37..ff4436079ee 100644 --- a/weave/trace/vals.py +++ b/weave/trace/vals.py @@ -25,7 +25,7 @@ ) from weave.trace.serialize import from_json from weave.trace.table import Table -from weave.trace_server.trace_server_interface import ( +from weave.trace_server_common.trace_server_interface import ( ObjReadReq, TableQueryReq, TableRowFilter, diff --git a/weave/trace/weave_client.py b/weave/trace/weave_client.py index 4506d2be7fa..8c303c4adcc 100644 --- a/weave/trace/weave_client.py +++ b/weave/trace/weave_client.py @@ -32,7 +32,8 @@ from weave.trace.util import deprecated from weave.trace.vals import WeaveObject, WeaveTable, make_trace_obj from weave.trace_server.ids import generate_id -from weave.trace_server.trace_server_interface import ( +from weave.trace_server_bindings.remote_http_trace_server import RemoteHTTPTraceServer +from weave.trace_server_common.trace_server_interface import ( CallEndReq, CallSchema, CallsDeleteReq, @@ -64,7 +65,6 @@ TableSchemaForInsert, TraceServerInterface, ) -from weave.trace_server_bindings.remote_http_trace_server import RemoteHTTPTraceServer # Controls if objects can have refs to projects not the WeaveClient project. # If False, object refs with with mismatching projects will be recreated. diff --git a/weave/trace_server/calls_query_builder.py b/weave/trace_server/calls_query_builder.py index 76e94d27d61..045cd23b081 100644 --- a/weave/trace_server/calls_query_builder.py +++ b/weave/trace_server/calls_query_builder.py @@ -33,7 +33,6 @@ import sqlparse from pydantic import BaseModel, Field -from weave.trace_server import trace_server_interface as tsi from weave.trace_server.errors import InvalidFieldError from weave.trace_server.interface import query as tsi_query from weave.trace_server.orm import ( @@ -47,6 +46,7 @@ from weave.trace_server.trace_server_interface_util import ( WILDCARD_ARTIFACT_VERSION_AND_PATH, ) +from weave.trace_server_common import trace_server_interface as tsi logger = logging.getLogger(__name__) diff --git a/weave/trace_server/clickhouse_trace_server_batched.py b/weave/trace_server/clickhouse_trace_server_batched.py index fbcda3f0715..e5eb56c969a 100644 --- a/weave/trace_server/clickhouse_trace_server_batched.py +++ b/weave/trace_server/clickhouse_trace_server_batched.py @@ -52,7 +52,6 @@ from weave.trace_server import clickhouse_trace_server_migrator as wf_migrator from weave.trace_server import environment as wf_env from weave.trace_server import refs_internal as ri -from weave.trace_server import trace_server_interface as tsi from weave.trace_server.calls_query_builder import ( CallsQuery, HardCodedFilter, @@ -106,6 +105,7 @@ extract_refs_from_values, str_digest, ) +from weave.trace_server_common import trace_server_interface as tsi logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) diff --git a/weave/trace_server/external_to_internal_trace_server_adapter.py b/weave/trace_server/external_to_internal_trace_server_adapter.py index 2f62d095464..62bc7903665 100644 --- a/weave/trace_server/external_to_internal_trace_server_adapter.py +++ b/weave/trace_server/external_to_internal_trace_server_adapter.py @@ -2,11 +2,11 @@ import typing from typing import Callable, Iterator, TypeVar -from weave.trace_server import trace_server_interface as tsi from weave.trace_server.trace_server_converter import ( universal_ext_to_int_ref_converter, universal_int_to_ext_ref_converter, ) +from weave.trace_server_common import trace_server_interface as tsi class IdConverter: diff --git a/weave/trace_server/feedback.py b/weave/trace_server/feedback.py index 3283987f48e..bcd87fc8b51 100644 --- a/weave/trace_server/feedback.py +++ b/weave/trace_server/feedback.py @@ -1,12 +1,12 @@ from pydantic import BaseModel, ValidationError -from weave.trace_server import trace_server_interface as tsi from weave.trace_server.errors import InvalidRequest from weave.trace_server.orm import Column, Table from weave.trace_server.validation import ( validate_purge_req_multiple, validate_purge_req_one, ) +from weave.trace_server_common import trace_server_interface as tsi TABLE_FEEDBACK = Table( "feedback", diff --git a/weave/trace_server/orm.py b/weave/trace_server/orm.py index 6f02f0c2644..a5ffaf6d8e1 100644 --- a/weave/trace_server/orm.py +++ b/weave/trace_server/orm.py @@ -10,8 +10,8 @@ from pydantic import BaseModel from typing_extensions import TypeAlias -from weave.trace_server import trace_server_interface as tsi from weave.trace_server.interface import query as tsi_query +from weave.trace_server_common import trace_server_interface as tsi DatabaseType = typing.Literal["clickhouse", "sqlite"] diff --git a/weave/trace_server/sqlite_trace_server.py b/weave/trace_server/sqlite_trace_server.py index 202bfbe0c62..030259f8411 100644 --- a/weave/trace_server/sqlite_trace_server.py +++ b/weave/trace_server/sqlite_trace_server.py @@ -12,7 +12,6 @@ import emoji from weave.trace_server import refs_internal as ri -from weave.trace_server import trace_server_interface as tsi from weave.trace_server.emoji_util import detone_emojis from weave.trace_server.errors import InvalidRequest from weave.trace_server.feedback import ( @@ -40,6 +39,7 @@ str_digest, ) from weave.trace_server.validation import object_id_validator +from weave.trace_server_common import trace_server_interface as tsi MAX_FLUSH_COUNT = 10000 MAX_FLUSH_AGE = 15 diff --git a/weave/trace_server/token_costs.py b/weave/trace_server/token_costs.py index 66b81f9a430..9eac6d156a9 100644 --- a/weave/trace_server/token_costs.py +++ b/weave/trace_server/token_costs.py @@ -2,7 +2,6 @@ import re from datetime import datetime -from weave.trace_server import trace_server_interface as tsi from weave.trace_server.clickhouse_schema import SelectableCHCallSchema from weave.trace_server.errors import InvalidRequest from weave.trace_server.orm import ( @@ -16,6 +15,7 @@ validate_purge_req_multiple, validate_purge_req_one, ) +from weave.trace_server_common import trace_server_interface as tsi DUMMY_LLM_ID = "weave_dummy_llm_id" DUMMY_LLM_USAGE = ( diff --git a/weave/trace_server/trace_server_common.py b/weave/trace_server/trace_server_common.py index 991e31ff3cb..6a6b168c088 100644 --- a/weave/trace_server/trace_server_common.py +++ b/weave/trace_server/trace_server_common.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Tuple, cast from weave.trace_server import refs_internal as ri -from weave.trace_server import trace_server_interface as tsi +from weave.trace_server_common import trace_server_interface as tsi def make_feedback_query_req( diff --git a/weave/trace_server_bindings/remote_http_trace_server.py b/weave/trace_server_bindings/remote_http_trace_server.py index fd8fd5d3fb6..7bc5b5a5f4b 100644 --- a/weave/trace_server_bindings/remote_http_trace_server.py +++ b/weave/trace_server_bindings/remote_http_trace_server.py @@ -8,8 +8,8 @@ from weave.trace.env import weave_trace_server_url from weave.trace_server import requests -from weave.trace_server import trace_server_interface as tsi from weave.trace_server.async_batch_processor import AsyncBatchProcessor +from weave.trace_server_common import trace_server_interface as tsi from weave.wandb_interface import project_creator logger = logging.getLogger(__name__) diff --git a/weave/trace_server/trace_server_interface.py b/weave/trace_server_common/trace_server_interface.py similarity index 100% rename from weave/trace_server/trace_server_interface.py rename to weave/trace_server_common/trace_server_interface.py