From 5904994f6cd12b84a1c38ad79a5eee801cad7adf Mon Sep 17 00:00:00 2001 From: Tim Sweeney Date: Fri, 9 Aug 2024 17:09:05 -0700 Subject: [PATCH] chore: Remove private underscores from interface classes (#2103) * init * init * all changes * lint * docgen --- ...ave.trace_server.trace_server_interface.md | 166 +- .../python-sdk/weave/weave.weave_client.md | 4 +- .../calls-query-calls-query-post.api.mdx | 1692 +++++++---------- ...query-stats-calls-query-stats-post.api.mdx | 1043 ++++------ ...ery-stream-calls-stream-query-post.api.mdx | 1310 +++++-------- .../objs-query-objs-query-post.api.mdx | 813 ++++---- .../table-query-table-query-post.api.mdx | 612 +++--- weave/tests/test_client_trace.py | 56 +- weave/tests/test_evaluations.py | 2 +- weave/tests/test_weave_client.py | 12 +- weave/trace/tests/test_op_argument_forms.py | 2 +- weave/trace/vals.py | 12 +- weave/trace_server/calls_query_builder.py | 4 +- .../clickhouse_trace_server_batched.py | 6 +- weave/trace_server/orm.py | 4 +- weave/trace_server/sqlite_trace_server.py | 2 +- .../tests/test_calls_query_builder.py | 10 +- weave/trace_server/trace_server_interface.py | 35 +- weave/weave_client.py | 26 +- 19 files changed, 2344 insertions(+), 3467 deletions(-) diff --git a/docs/docs/reference/python-sdk/weave/trace_server/weave.trace_server.trace_server_interface.md b/docs/docs/reference/python-sdk/weave/trace_server/weave.trace_server.trace_server_interface.md index 87efbca2693..ec8c55cd7ce 100644 --- a/docs/docs/reference/python-sdk/weave/trace_server/weave.trace_server.trace_server_interface.md +++ b/docs/docs/reference/python-sdk/weave/trace_server/weave.trace_server.trace_server_interface.md @@ -29,6 +29,7 @@ sidebar_label: trace_server_interface - [`trace_server_interface.CallsDeleteReq`](#class-callsdeletereq) - [`trace_server_interface.CallsDeleteReq`](#class-callsdeletereq) - [`trace_server_interface.CallsDeleteRes`](#class-callsdeleteres) +- [`trace_server_interface.CallsFilter`](#class-callsfilter) - [`trace_server_interface.CallsQueryReq`](#class-callsqueryreq) - [`trace_server_interface.CallsQueryRes`](#class-callsqueryres) - [`trace_server_interface.CallsQueryStatsReq`](#class-callsquerystatsreq) @@ -59,14 +60,17 @@ sidebar_label: trace_server_interface - [`trace_server_interface.ObjReadRes`](#class-objreadres) - [`trace_server_interface.ObjSchema`](#class-objschema) - [`trace_server_interface.ObjSchemaForInsert`](#class-objschemaforinsert) +- [`trace_server_interface.ObjectVersionFilter`](#class-objectversionfilter) - [`trace_server_interface.OpCreateReq`](#class-opcreatereq) - [`trace_server_interface.OpCreateRes`](#class-opcreateres) - [`trace_server_interface.OpQueryReq`](#class-opqueryreq) - [`trace_server_interface.OpQueryRes`](#class-opqueryres) - [`trace_server_interface.OpReadReq`](#class-opreadreq) - [`trace_server_interface.OpReadRes`](#class-opreadres) +- [`trace_server_interface.OpVersionFilter`](#class-opversionfilter) - [`trace_server_interface.RefsReadBatchReq`](#class-refsreadbatchreq) - [`trace_server_interface.RefsReadBatchRes`](#class-refsreadbatchres) +- [`trace_server_interface.SortBy`](#class-sortby) - [`trace_server_interface.StartedCallSchemaForInsert`](#class-startedcallschemaforinsert) - [`trace_server_interface.SummaryInsertMap`](#class-summaryinsertmap) - [`trace_server_interface.SummaryMap`](#class-summarymap) @@ -80,6 +84,7 @@ sidebar_label: trace_server_interface - [`trace_server_interface.TablePopSpecPayload`](#class-tablepopspecpayload) - [`trace_server_interface.TableQueryReq`](#class-tablequeryreq) - [`trace_server_interface.TableQueryRes`](#class-tablequeryres) +- [`trace_server_interface.TableRowFilter`](#class-tablerowfilter) - [`trace_server_interface.TableRowSchema`](#class-tablerowschema) - [`trace_server_interface.TableSchemaForInsert`](#class-tableschemaforinsert) - [`trace_server_interface.TableUpdateReq`](#class-tableupdatereq) @@ -306,6 +311,28 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] +--- + + + +## class `CallsFilter` + + + + + +**Pydantic Fields:** + +- `op_names`: `typing.Optional[typing.List[str]]` +- `input_refs`: `typing.Optional[typing.List[str]]` +- `output_refs`: `typing.Optional[typing.List[str]]` +- `parent_ids`: `typing.Optional[typing.List[str]]` +- `trace_ids`: `typing.Optional[typing.List[str]]` +- `call_ids`: `typing.Optional[typing.List[str]]` +- `trace_roots_only`: `typing.Optional[bool]` +- `wb_user_ids`: `typing.Optional[typing.List[str]]` +- `wb_run_ids`: `typing.Optional[typing.List[str]]` + --- @@ -319,10 +346,10 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] **Pydantic Fields:** - `project_id`: `` -- `filter`: `typing.Optional[_CallsFilter]` +- `filter`: `typing.Optional[CallsFilter]` - `limit`: `typing.Optional[int]` - `offset`: `typing.Optional[int]` -- `sort_by`: `typing.Optional[typing.List[_SortBy]]` +- `sort_by`: `typing.Optional[typing.List[SortBy]]` - `query`: `typing.Optional[weave.trace_server.interface.query.Query]` - `include_costs`: `typing.Optional[bool]` - `columns`: `typing.Optional[typing.List[str]]` @@ -354,7 +381,7 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] **Pydantic Fields:** - `project_id`: `` -- `filter`: `typing.Optional[_CallsFilter]` +- `filter`: `typing.Optional[CallsFilter]` - `query`: `typing.Optional[weave.trace_server.interface.query.Query]` --- @@ -523,7 +550,7 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] --- - + ## class `FeedbackPurgeReq` @@ -538,7 +565,7 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] --- - + ## class `FeedbackPurgeRes` @@ -562,13 +589,13 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] - `project_id`: `` - `fields`: `typing.Optional[list[str]]` - `query`: `typing.Optional[weave.trace_server.interface.query.Query]` -- `sort_by`: `typing.Optional[typing.List[_SortBy]]` +- `sort_by`: `typing.Optional[typing.List[SortBy]]` - `limit`: `typing.Optional[int]` - `offset`: `typing.Optional[int]` --- - + ## class `FeedbackQueryRes` @@ -582,7 +609,7 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] --- - + ## class `FileContentReadReq` @@ -597,7 +624,7 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] --- - + ## class `FileContentReadRes` @@ -611,7 +638,7 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] --- - + ## class `FileCreateReq` @@ -627,7 +654,7 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] --- - + ## class `FileCreateRes` @@ -706,7 +733,7 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] **Pydantic Fields:** - `project_id`: `` -- `filter`: `typing.Optional[_ObjectVersionFilter]` +- `filter`: `typing.Optional[ObjectVersionFilter]` --- @@ -793,6 +820,23 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] --- + + +## class `ObjectVersionFilter` + + + + + +**Pydantic Fields:** + +- `base_object_classes`: `typing.Optional[typing.List[str]]` +- `object_ids`: `typing.Optional[typing.List[str]]` +- `is_op`: `typing.Optional[bool]` +- `latest_only`: `typing.Optional[bool]` + +--- + ## class `OpCreateReq` @@ -832,7 +876,7 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] **Pydantic Fields:** - `project_id`: `` -- `filter`: `typing.Optional[_OpVersionFilter]` +- `filter`: `typing.Optional[OpVersionFilter]` --- @@ -880,6 +924,21 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] --- + + +## class `OpVersionFilter` + + + + + +**Pydantic Fields:** + +- `op_names`: `typing.Optional[typing.List[str]]` +- `latest_only`: `typing.Optional[bool]` + +--- + ## class `RefsReadBatchReq` @@ -908,6 +967,21 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] --- + + +## class `SortBy` + + + + + +**Pydantic Fields:** + +- `field`: `` +- `direction`: `typing.Literal['asc', 'desc']` + +--- + ## class `StartedCallSchemaForInsert` @@ -1083,7 +1157,7 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] - `project_id`: `` - `digest`: `` -- `filter`: `typing.Optional[_TableRowFilter]` +- `filter`: `typing.Optional[TableRowFilter]` - `limit`: `typing.Optional[int]` - `offset`: `typing.Optional[int]` @@ -1103,6 +1177,20 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] --- + + +## class `TableRowFilter` + + + + + +**Pydantic Fields:** + +- `row_digests`: `typing.Optional[typing.List[str]]` + +--- + ## class `TableRowSchema` @@ -1163,7 +1251,7 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] --- - + ## class `TraceServerInterface` @@ -1175,7 +1263,7 @@ serialize_typed_dicts(v: Dict[str, Any]) → Dict[str, Any] --- - + ### method `call_end` @@ -1189,7 +1277,7 @@ call_end(req: CallEndReq) → CallEndRes --- - + ### method `call_read` @@ -1203,7 +1291,7 @@ call_read(req: CallReadReq) → CallReadRes --- - + ### method `call_start` @@ -1217,7 +1305,7 @@ call_start(req: CallStartReq) → CallStartRes --- - + ### method `call_update` @@ -1231,7 +1319,7 @@ call_update(req: CallUpdateReq) → CallUpdateRes --- - + ### method `calls_delete` @@ -1245,7 +1333,7 @@ calls_delete(req: CallsDeleteReq) → CallsDeleteRes --- - + ### method `calls_query` @@ -1259,7 +1347,7 @@ calls_query(req: CallsQueryReq) → CallsQueryRes --- - + ### method `calls_query_stats` @@ -1273,7 +1361,7 @@ calls_query_stats(req: CallsQueryStatsReq) → CallsQueryStatsRes --- - + ### method `calls_query_stream` @@ -1287,7 +1375,7 @@ calls_query_stream(req: CallsQueryReq) → Iterator[CallSchema] --- - + ### method `ensure_project_exists` @@ -1301,7 +1389,7 @@ ensure_project_exists(entity: str, project: str) → None --- - + ### method `feedback_create` @@ -1315,7 +1403,7 @@ feedback_create(req: FeedbackCreateReq) → FeedbackCreateRes --- - + ### method `feedback_purge` @@ -1329,7 +1417,7 @@ feedback_purge(req: FeedbackPurgeReq) → FeedbackPurgeRes --- - + ### method `feedback_query` @@ -1343,7 +1431,7 @@ feedback_query(req: FeedbackQueryReq) → FeedbackQueryRes --- - + ### method `file_content_read` @@ -1357,7 +1445,7 @@ file_content_read(req: FileContentReadReq) → FileContentReadRes --- - + ### method `file_create` @@ -1371,7 +1459,7 @@ file_create(req: FileCreateReq) → FileCreateRes --- - + ### method `obj_create` @@ -1385,7 +1473,7 @@ obj_create(req: ObjCreateReq) → ObjCreateRes --- - + ### method `obj_read` @@ -1399,7 +1487,7 @@ obj_read(req: ObjReadReq) → ObjReadRes --- - + ### method `objs_query` @@ -1413,7 +1501,7 @@ objs_query(req: ObjQueryReq) → ObjQueryRes --- - + ### method `op_create` @@ -1427,7 +1515,7 @@ op_create(req: OpCreateReq) → OpCreateRes --- - + ### method `op_read` @@ -1441,7 +1529,7 @@ op_read(req: OpReadReq) → OpReadRes --- - + ### method `ops_query` @@ -1455,7 +1543,7 @@ ops_query(req: OpQueryReq) → OpQueryRes --- - + ### method `refs_read_batch` @@ -1469,7 +1557,7 @@ refs_read_batch(req: RefsReadBatchReq) → RefsReadBatchRes --- - + ### method `table_create` @@ -1483,7 +1571,7 @@ table_create(req: TableCreateReq) → TableCreateRes --- - + ### method `table_query` @@ -1497,7 +1585,7 @@ table_query(req: TableQueryReq) → TableQueryRes --- - + ### method `table_update` diff --git a/docs/docs/reference/python-sdk/weave/weave.weave_client.md b/docs/docs/reference/python-sdk/weave/weave.weave_client.md index 4db495e8412..010909bb2e8 100644 --- a/docs/docs/reference/python-sdk/weave/weave.weave_client.md +++ b/docs/docs/reference/python-sdk/weave/weave.weave_client.md @@ -75,7 +75,7 @@ call(call_id: str, include_costs: Optional[bool] = False) → WeaveObject ```python calls( - filter: Optional[_CallsFilter] = None, + filter: Optional[CallsFilter] = None, include_costs: Optional[bool] = False ) → CallsIter ``` @@ -362,7 +362,7 @@ set_display_name(name: Optional[str]) → None __init__( server: TraceServerInterface, project_id: str, - filter: _CallsFilter, + filter: CallsFilter, include_costs: bool = False ) → None ``` diff --git a/docs/docs/reference/service-api/calls-query-calls-query-post.api.mdx b/docs/docs/reference/service-api/calls-query-calls-query-post.api.mdx index d0fa8721cd0..432b6d26023 100644 --- a/docs/docs/reference/service-api/calls-query-calls-query-post.api.mdx +++ b/docs/docs/reference/service-api/calls-query-calls-query-post.api.mdx @@ -29,17 +29,9 @@ import TabItem from "@theme/TabItem"; as={"h1"} className={"openapi__heading"} children={"Calls Query"} -> - - - - - - +> + Calls Query @@ -48,132 +40,81 @@ Calls Query as={"h2"} className={"openapi-tabs__heading"} children={"Request"} -> - +> - - + +
- -

+ +

Body -

- required - -
- -
    +

+ required +
+
+
    - - -
    - - - filter - - object - -
    - -
    - - anyOf - - - -
    - - - op_names - - object - -
    - -
    - - anyOf - - + schema={{ type: "string", title: "Project Id" }} + > + +
    + + filter + object + +
    +
    + anyOf + + + +
    + + op_names + object + +
    +
    + anyOf + +
  • Array [
    -
  • +
    - - string - - -
  • +
  • +
  • ]
    @@ -182,55 +123,45 @@ Calls Query
  • -
    -
    - - - input_refs - - object - -
    - -
    - - anyOf - - + + +
    + + input_refs + object + +
    +
    + anyOf + +
  • Array [
    -
  • +
    - - string - - -
  • +
  • +
  • ]
    @@ -239,55 +170,45 @@ Calls Query
  • -
    -
    - - - output_refs - - object - -
    - -
    - - anyOf - - + + +
    + + output_refs + object + +
    +
    + anyOf + +
  • Array [
    -
  • +
    - - string - - -
  • +
  • +
  • ]
    @@ -296,55 +217,45 @@ Calls Query
  • -
    -
    - - - parent_ids - - object - -
    - -
    - - anyOf - - + + +
    + + parent_ids + object + +
    +
    + anyOf + +
  • Array [
    -
  • +
    - - string - - -
  • +
  • +
  • ]
    @@ -353,55 +264,45 @@ Calls Query
  • -
    -
    - - - trace_ids - - object - -
    - -
    - - anyOf - - + + +
    + + trace_ids + object + +
    +
    + anyOf + +
  • Array [
    -
  • +
    - - string - - -
  • +
  • +
  • ]
    @@ -410,55 +311,45 @@ Calls Query
  • -
    -
    - - - call_ids - - object - -
    - -
    - - anyOf - - + + +
    + + call_ids + object + +
    +
    + anyOf + +
  • Array [
    -
  • +
    - - string - - -
  • +
  • +
  • ]
    @@ -467,100 +358,69 @@ Calls Query
  • -
    -
    - - - trace_roots_only - - object - -
    - -
    - - anyOf - - + + +
    + + trace_roots_only + object + +
    +
    + anyOf + +
    - - boolean - -
    -
    -
    - - - wb_user_ids - - object - -
    - -
    - - anyOf - - + + +
    + + wb_user_ids + object + +
    +
    + anyOf + +
  • Array [
    -
  • +
    - - string - - -
  • +
  • +
  • ]
    @@ -569,55 +429,45 @@ Calls Query
  • -
    -
    - - - wb_run_ids - - object - -
    - -
    - - anyOf - - + + +
    + + wb_run_ids + object + +
    +
    + anyOf + +
  • Array [
    -
  • +
    - - string - - -
  • +
  • +
  • ]
    @@ -631,155 +481,95 @@ Calls Query
  • -
    -
    - - - limit - - object - -
    - -
    - - anyOf - - -
    - - + + +
    + + limit + object + +
    +
    + anyOf + + +
    integer - -
    -
    -
    - - - offset - - object - -
    - -
    - - anyOf - - -
    - - + + +
    + + offset + object + +
    +
    + anyOf + + +
    integer - -
    -
    -
    - - - sort_by - - object - -
    - -
    - - anyOf - - + + +
    + + sort_by + object + +
    +
    + anyOf + +
  • Array [
    -
  • + - - + - -
  • + schema={{ + type: "string", + enum: ["asc", "desc"], + title: "Direction", + }} + > +
  • ]
    @@ -788,101 +578,64 @@ Calls Query
  • -
    -
    - - - query - - object - -
    - -
    - - anyOf - - + + +
    + + query + object + +
    +
    + anyOf + + - - + schema={{ title: "$Expr", type: "object" }} + >
    -
    -
    - - - columns - - object - -
    - -
    - - anyOf - - + + +
    + + columns + object + +
    +
    + anyOf + +
  • Array [
    -
  • - - + +
    string - - -
  • +
  • +
  • ]
    @@ -895,38 +648,17 @@ Calls Query
-
+ +
- - + + +
Successful Response
- - - Successful Response - - -
- - - - + + + +
- - Schema - -
- -
    - + Schema + +
    +
      +
      - - - + + + calls - - object[] - + + object[] + + - - + > + required -
      +
      +
    • Array [
      -
    • + - - + - - + - - + @@ -1023,53 +741,42 @@ Calls Query style={{}} className={"openapi-markdown__details"} > - - - display_name - - object - -
      - -
      - + + display_name + object + +
      +
      + anyOf - + +
      - - string - -
      -
      + - - + @@ -1077,71 +784,62 @@ Calls Query style={{}} className={"openapi-markdown__details"} > - - - parent_id - - object - -
      - -
      - + + parent_id + object + +
      +
      + anyOf - + +
      - - string - -
- + - - + - - + - - + @@ -1149,44 +847,34 @@ Calls Query style={{}} className={"openapi-markdown__details"} > - - - ended_at - - object - -
- -
- + + ended_at + object + +
+
+ anyOf - + +
- - string - -
- + @@ -1194,62 +882,50 @@ Calls Query style={{}} className={"openapi-markdown__details"} > - - - exception - - object - -
- -
- + + exception + object + +
+
+ anyOf - + +
- - string - -
- + - - + - - + @@ -1257,44 +933,34 @@ Calls Query style={{}} className={"openapi-markdown__details"} > - - - wb_user_id - - object - -
- -
- + + wb_user_id + object + +
+
+ anyOf - + +
- - string - -
- + @@ -1302,44 +968,34 @@ Calls Query style={{}} className={"openapi-markdown__details"} > - - - wb_run_id - - object - -
- -
- + + wb_run_id + object + +
+
+ anyOf - + +
- - string - -
- + @@ -1347,46 +1003,40 @@ Calls Query style={{}} className={"openapi-markdown__details"} > - - - deleted_at - - object - -
- -
- + + deleted_at + object + +
+
+ anyOf - + +
- - string - -
-
  • + +
  • ]
    @@ -1396,47 +1046,30 @@ Calls Query - + - - + >
  • - + + +
    Validation Error
    - - - Validation Error - - -
    - - - - + + + +
    - - Schema - -
    - -
      - + Schema + +
      +
        +
        - - - + + + detail - - object[] + + + object[] -
        +
        +
      • Array [
        -
      • + @@ -1498,103 +1122,109 @@ Calls Query style={{}} className={"openapi-markdown__details"} > - - + + loc - - object[] - + + object[] + + - - + required -
        +
        +
      • Array [
        -
      • - + +
        + anyOf - + +
        - - string - -
        -
        +
        - - integer - -
        -
      • +
      • +
      • ]
      • -
        + - - + - -
      • + schema={{ type: "string", title: "Error Type" }} + > +
      • ]
        @@ -1604,16 +1234,17 @@ Calls Query
    -
    + - - + >
    @@ -1623,4 +1254,3 @@ Calls Query
    - \ No newline at end of file diff --git a/docs/docs/reference/service-api/calls-query-stats-calls-query-stats-post.api.mdx b/docs/docs/reference/service-api/calls-query-stats-calls-query-stats-post.api.mdx index d092d685bc1..ab5de871187 100644 --- a/docs/docs/reference/service-api/calls-query-stats-calls-query-stats-post.api.mdx +++ b/docs/docs/reference/service-api/calls-query-stats-calls-query-stats-post.api.mdx @@ -29,17 +29,9 @@ import TabItem from "@theme/TabItem"; as={"h1"} className={"openapi__heading"} children={"Calls Query Stats"} -> - - - - - - +> + Calls Query Stats @@ -48,132 +40,81 @@ Calls Query Stats as={"h2"} className={"openapi-tabs__heading"} children={"Request"} -> - +> - - + +
    - -

    + +

    Body -

    - required - -
    - -
      +

    + required +
    +
    +
      - - -
      - - - filter - - object - -
      - -
      - - anyOf - - - -
      - - - op_names - - object - -
      - -
      - - anyOf - - + schema={{ type: "string", title: "Project Id" }} + > + +
      + + filter + object + +
      +
      + anyOf + + + +
      + + op_names + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -182,55 +123,45 @@ Calls Query Stats
    • -
      -
      - - - input_refs - - object - -
      - -
      - - anyOf - - + + +
      + + input_refs + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -239,55 +170,45 @@ Calls Query Stats
    • -
      -
      - - - output_refs - - object - -
      - -
      - - anyOf - - + + +
      + + output_refs + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -296,55 +217,45 @@ Calls Query Stats
    • -
      -
      - - - parent_ids - - object - -
      - -
      - - anyOf - - + + +
      + + parent_ids + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -353,55 +264,45 @@ Calls Query Stats
    • -
      -
      - - - trace_ids - - object - -
      - -
      - - anyOf - - + + +
      + + trace_ids + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -410,55 +311,45 @@ Calls Query Stats
    • -
      -
      - - - call_ids - - object - -
      - -
      - - anyOf - - + + +
      + + call_ids + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -467,100 +358,69 @@ Calls Query Stats
    • -
      -
      - - - trace_roots_only - - object - -
      - -
      - - anyOf - - + + +
      + + trace_roots_only + object + +
      +
      + anyOf + +
      - - boolean - -
      -
      -
      - - - wb_user_ids - - object - -
      - -
      - - anyOf - - + + +
      + + wb_user_ids + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -569,55 +429,45 @@ Calls Query Stats
    • -
      -
      - - - wb_run_ids - - object - -
      - -
      - - anyOf - - + + +
      + + wb_run_ids + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -631,48 +481,26 @@ Calls Query Stats
    • -
      -
      - - - query - - object - -
      - -
      - - anyOf - - + + +
      + + query + object + +
      +
      + anyOf + + - - + schema={{ title: "$Expr", type: "object" }} + >
      @@ -681,38 +509,17 @@ Calls Query Stats
    -
    + +
    - - + + +
    Successful Response
    - - - Successful Response - - -
    - - - - + + + +
    - - Schema - -
    - -
      + Schema + +
      +
        - - + schema={{ type: "integer", title: "Count" }} + >
    -
    + - - + >
    -
    + + +
    Validation Error
    - - - Validation Error - - -
    - - - - + + + +
    - - Schema - -
    - -
      - + Schema + +
      +
        +
        - - - + + + detail - - object[] + + + object[] -
        +
        +
      • Array [
        -
      • + @@ -847,103 +620,109 @@ Calls Query Stats style={{}} className={"openapi-markdown__details"} > - - + + loc - - object[] - + + object[] + + - - + required -
        +
        +
      • Array [
        -
      • - + +
        + anyOf - + +
        - - string - -
        -
        +
        - - integer - -
        -
      • +
      • +
      • ]
      • -
        + - - + - -
      • + schema={{ type: "string", title: "Error Type" }} + > +
      • ]
        @@ -953,16 +732,17 @@ Calls Query Stats
    -
    + - - + >
    @@ -972,4 +752,3 @@ Calls Query Stats
    - \ No newline at end of file diff --git a/docs/docs/reference/service-api/calls-query-stream-calls-stream-query-post.api.mdx b/docs/docs/reference/service-api/calls-query-stream-calls-stream-query-post.api.mdx index 4c0a442a185..9c374fb8c87 100644 --- a/docs/docs/reference/service-api/calls-query-stream-calls-stream-query-post.api.mdx +++ b/docs/docs/reference/service-api/calls-query-stream-calls-stream-query-post.api.mdx @@ -29,17 +29,9 @@ import TabItem from "@theme/TabItem"; as={"h1"} className={"openapi__heading"} children={"Calls Query Stream"} -> - - - - - - +> + Calls Query Stream @@ -48,156 +40,110 @@ Calls Query Stream as={"h2"} className={"openapi-tabs__heading"} children={"Request"} -> - +>
    - -

    + +

    Header Parameters

    -
    +

    +
      - - + param={{ + name: "accept", + in: "header", + required: false, + schema: { + type: "string", + default: "application/jsonl", + title: "Accept", + }, + }} + >
    -
    - + + +
    - -

    + +

    Body -

    - required - -
    - -
      +

    + required +
    +
    +
      - - -
      - - - filter - - object - -
      - -
      - - anyOf - - - -
      - - - op_names - - object - -
      - -
      - - anyOf - - + schema={{ type: "string", title: "Project Id" }} + > + +
      + + filter + object + +
      +
      + anyOf + + + +
      + + op_names + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -206,55 +152,45 @@ Calls Query Stream
    • -
      -
      - - - input_refs - - object - -
      - -
      - - anyOf - - + + +
      + + input_refs + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -263,55 +199,45 @@ Calls Query Stream
    • -
      -
      - - - output_refs - - object - -
      - -
      - - anyOf - - + + +
      + + output_refs + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -320,55 +246,45 @@ Calls Query Stream
    • -
      -
      - - - parent_ids - - object - -
      - -
      - - anyOf - - + + +
      + + parent_ids + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -377,55 +293,45 @@ Calls Query Stream
    • -
      -
      - - - trace_ids - - object - -
      - -
      - - anyOf - - + + +
      + + trace_ids + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -434,55 +340,45 @@ Calls Query Stream
    • -
      -
      - - - call_ids - - object - -
      - -
      - - anyOf - - + + +
      + + call_ids + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -491,100 +387,69 @@ Calls Query Stream
    • -
      -
      - - - trace_roots_only - - object - -
      - -
      - - anyOf - - + + +
      + + trace_roots_only + object + +
      +
      + anyOf + +
      - - boolean - -
      -
      -
      - - - wb_user_ids - - object - -
      - -
      - - anyOf - - + + +
      + + wb_user_ids + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -593,55 +458,45 @@ Calls Query Stream
    • -
      -
      - - - wb_run_ids - - object - -
      - -
      - - anyOf - - + + +
      + + wb_run_ids + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -655,155 +510,95 @@ Calls Query Stream
    • -
      -
      - - - limit - - object - -
      - -
      - - anyOf - - -
      - - + + +
      + + limit + object + +
      +
      + anyOf + + +
      integer - -
      -
      -
      - - - offset - - object - -
      - -
      - - anyOf - - -
      - - + + +
      + + offset + object + +
      +
      + anyOf + + +
      integer - -
      -
      -
      - - - sort_by - - object - -
      - -
      - - anyOf - - + + +
      + + sort_by + object + +
      +
      + anyOf + +
    • Array [
      -
    • + - - + - -
    • + schema={{ + type: "string", + enum: ["asc", "desc"], + title: "Direction", + }} + > +
    • ]
      @@ -812,101 +607,64 @@ Calls Query Stream
    • -
      -
      - - - query - - object - -
      - -
      - - anyOf - - + + +
      + + query + object + +
      +
      + anyOf + + - - + schema={{ title: "$Expr", type: "object" }} + >
      -
      -
      - - - columns - - object - -
      - -
      - - anyOf - - + + +
      + + columns + object + +
      +
      + anyOf + +
    • Array [
      -
    • - - + +
      string - - -
    • +
    • +
    • ]
      @@ -919,38 +677,17 @@ Calls Query Stream
    -
    + +
    - - + + +
    Successful Response
    - - - Successful Response - - -
    - - - - + + + +
    - - Schema - -
    - -
      - any -
    + Schema + +
    +
      any
    -
    + + +
    Validation Error
    - - - Validation Error - - -
    - - - - + + + +
    - - Schema - -
    - -
      - + Schema + +
      +
        +
        - - - + + + detail - - object[] + + + object[] -
        +
        +
      • Array [
        -
      • + @@ -1066,103 +770,109 @@ Calls Query Stream style={{}} className={"openapi-markdown__details"} > - - + + loc - - object[] - + + object[] + + - - + required -
        +
        +
      • Array [
        -
      • - + +
        + anyOf - + +
        - - string - -
        -
        +
        - - integer - -
        -
      • +
      • +
      • ]
      • -
        + - - + - -
      • + schema={{ type: "string", title: "Error Type" }} + > +
      • ]
        @@ -1172,16 +882,17 @@ Calls Query Stream
    -
    + - - + >
    @@ -1191,4 +902,3 @@ Calls Query Stream
    - \ No newline at end of file diff --git a/docs/docs/reference/service-api/objs-query-objs-query-post.api.mdx b/docs/docs/reference/service-api/objs-query-objs-query-post.api.mdx index 1cab59d2f38..c3c4fa4bad8 100644 --- a/docs/docs/reference/service-api/objs-query-objs-query-post.api.mdx +++ b/docs/docs/reference/service-api/objs-query-objs-query-post.api.mdx @@ -29,17 +29,9 @@ import TabItem from "@theme/TabItem"; as={"h1"} className={"openapi__heading"} children={"Objs Query"} -> - - - - - - +> + Objs Query @@ -48,132 +40,84 @@ Objs Query as={"h2"} className={"openapi-tabs__heading"} children={"Request"} -> - +> - - + +
    - -

    + +

    Body -

    - required - -
    - -
      +

    + required +
    +
    +
      - - -
      - - - filter - - object - -
      - -
      - - anyOf - + schema={{ type: "string", title: "Project Id" }} + > + +
      + + filter + object + +
      +
      + anyOf + - -
      - - - base_object_classes - - object - -
      - -
      - - anyOf - - + +
      + + base_object_classes + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -182,55 +126,45 @@ Objs Query
    • -
      -
      - - - object_ids - - object - -
      - -
      - - anyOf - - + + +
      + + object_ids + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -239,91 +173,49 @@ Objs Query
    • -
      -
      - - - is_op - - object - -
      - -
      - - anyOf - - + + +
      + + is_op + object + +
      +
      + anyOf + +
      - - boolean - -
      -
      -
      - - - latest_only - - object - -
      - -
      - - anyOf - - + + +
      + + latest_only + object + +
      +
      + anyOf + +
      - - boolean - -
      @@ -338,38 +230,17 @@ Objs Query
    -
    + +
    - - + + +
    Successful Response
    - - - Successful Response - - -
    - - - - + + + +
    - - Schema - -
    - -
      - + Schema + +
      +
        +
        - - - + + + objs - - object[] - + + object[] + + - - + > + required -
        +
        +
      • Array [
        -
      • + - - + - - + - - + @@ -466,80 +327,69 @@ Objs Query style={{}} className={"openapi-markdown__details"} > - - - deleted_at - - object - -
        - -
        - + + deleted_at + object + +
        +
        + anyOf - + +
        - - string - -
        -
        + - - + - - + - - + - - + @@ -547,59 +397,56 @@ Objs Query style={{}} className={"openapi-markdown__details"} > - - - base_object_class - - object - + base_object_class + object + - required + required -
        - -
        - + +
        +
        + anyOf - + +
        - - string - -
    - + - -
  • + schema={{ title: "Val" }} + > +
  • ]
    @@ -609,47 +456,30 @@ Objs Query - + - - + >
  • -
    + + +
    Validation Error
    - - - Validation Error - - -
    - - - - + + + +
    - - Schema - -
    - -
      - + Schema + +
      +
        +
        - - - + + + detail - - object[] + + + object[] -
        +
        +
      • Array [
        -
      • + @@ -711,103 +532,109 @@ Objs Query style={{}} className={"openapi-markdown__details"} > - - + + loc - - object[] - + + object[] + + - - + required -
        +
        +
      • Array [
        -
      • - + +
        + anyOf - + +
        - - string - -
        -
        +
        - - integer - -
        -
      • +
      • +
      • ]
      • -
        + - - + - -
      • + schema={{ type: "string", title: "Error Type" }} + > +
      • ]
        @@ -817,16 +644,17 @@ Objs Query
    -
    + - - + >
    @@ -836,4 +664,3 @@ Objs Query
    - \ No newline at end of file diff --git a/docs/docs/reference/service-api/table-query-table-query-post.api.mdx b/docs/docs/reference/service-api/table-query-table-query-post.api.mdx index e957add3e0e..ddb1d4aa63d 100644 --- a/docs/docs/reference/service-api/table-query-table-query-post.api.mdx +++ b/docs/docs/reference/service-api/table-query-table-query-post.api.mdx @@ -29,17 +29,9 @@ import TabItem from "@theme/TabItem"; as={"h1"} className={"openapi__heading"} children={"Table Query"} -> - - - - - - +> + Table Query @@ -48,141 +40,89 @@ Table Query as={"h2"} className={"openapi-tabs__heading"} children={"Request"} -> - +> - - + +
    - -

    + +

    Body -

    - required - -
    - -
      +

    + required +
    +
    +
      - - + - - -
      - - - filter - - object - -
      - -
      - - anyOf - - - -
      - - - row_digests - - object - -
      - -
      - - anyOf - - + schema={{ type: "string", title: "Digest" }} + > + +
      + + filter + object + +
      +
      + anyOf + + + +
      + + row_digests + object + +
      +
      + anyOf + +
    • Array [
      -
    • +
      - - string - - -
    • +
    • +
    • ]
      @@ -196,91 +136,39 @@ Table Query
    • -
      -
      - - - limit - - object - -
      - -
      - - anyOf - - -
      - - + + +
      + + limit + object + +
      +
      + anyOf + + +
      integer - -
      -
      -
      - - - offset - - object - -
      - -
      - - anyOf - - -
      - - + + +
      + + offset + object + +
      +
      + anyOf + + +
      integer - -
      @@ -290,38 +178,17 @@ Table Query
    -
    + +
    - - + + +
    Successful Response
    - - - Successful Response - - -
    - - - - + + + +
    - - Schema - -
    - -
      - + Schema + +
      +
        +
        - - - + + + rows - - object[] - + + object[] + + - - + > + required -
        +
        +
      • Array [
        -
      • + - - + - -
      • + schema={{ title: "Val" }} + > +
      • ]
        @@ -413,47 +271,30 @@ Table Query
    -
    + - - + >
    -
    + + +
    Validation Error
    - - - Validation Error - - -
    - - - - + + + +
    - - Schema - -
    - -
      - + Schema + +
      +
        +
        - - - + + + detail - - object[] + + + object[] -
        +
        +
      • Array [
        -
      • + @@ -515,103 +347,109 @@ Table Query style={{}} className={"openapi-markdown__details"} > - - + + loc - - object[] - + + object[] + + - - + required -
        +
        +
      • Array [
        -
      • - + +
        + anyOf - + +
        - - string - -
        -
        +
        - - integer - -
        -
      • +
      • +
      • ]
      • -
        + - - + - -
      • + schema={{ type: "string", title: "Error Type" }} + > +
      • ]
        @@ -621,16 +459,17 @@ Table Query
    -
    + - - + >
    @@ -640,4 +479,3 @@ Table Query
    - \ No newline at end of file diff --git a/weave/tests/test_client_trace.py b/weave/tests/test_client_trace.py index 8c1a255d132..ad0ddba7f87 100644 --- a/weave/tests/test_client_trace.py +++ b/weave/tests/test_client_trace.py @@ -383,7 +383,7 @@ def test_trace_call_query_filter_op_version_refs(client): res = get_client_trace_server(client).calls_query( tsi.CallsQueryReq( project_id=get_client_project_id(client), - filter=tsi._CallsFilter(op_names=op_version_refs), + filter=tsi.CallsFilter(op_names=op_version_refs), ) ) print(f"TEST CASE [{i}]", op_version_refs, exp_count) @@ -459,7 +459,7 @@ def test_trace_call_query_filter_input_object_version_refs(client): inner_res = get_client_trace_server(client).calls_query( tsi.CallsQueryReq( project_id=get_client_project_id(client), - filter=tsi._CallsFilter(input_refs=input_object_version_refs), + filter=tsi.CallsFilter(input_refs=input_object_version_refs), ) ) @@ -513,7 +513,7 @@ def test_trace_call_query_filter_output_object_version_refs(client): inner_res = get_client_trace_server(client).calls_query( tsi.CallsQueryReq( project_id=get_client_project_id(client), - filter=tsi._CallsFilter(output_refs=output_object_version_refs), + filter=tsi.CallsFilter(output_refs=output_object_version_refs), ) ) @@ -549,7 +549,7 @@ def test_trace_call_query_filter_parent_ids(client): inner_res = get_client_trace_server(client).calls_query( tsi.CallsQueryReq( project_id=get_client_project_id(client), - filter=tsi._CallsFilter(parent_ids=parent_ids), + filter=tsi.CallsFilter(parent_ids=parent_ids), ) ) @@ -576,7 +576,7 @@ def test_trace_call_query_filter_trace_ids(client): inner_res = get_client_trace_server(client).calls_query( tsi.CallsQueryReq( project_id=get_client_project_id(client), - filter=tsi._CallsFilter(trace_ids=trace_ids), + filter=tsi.CallsFilter(trace_ids=trace_ids), ) ) @@ -603,7 +603,7 @@ def test_trace_call_query_filter_call_ids(client): inner_res = get_client_trace_server(client).calls_query( tsi.CallsQueryReq( project_id=get_client_project_id(client), - filter=tsi._CallsFilter(call_ids=call_ids), + filter=tsi.CallsFilter(call_ids=call_ids), ) ) @@ -624,7 +624,7 @@ def test_trace_call_query_filter_trace_roots_only(client): inner_res = get_client_trace_server(client).calls_query( tsi.CallsQueryReq( project_id=get_client_project_id(client), - filter=tsi._CallsFilter(trace_roots_only=trace_roots_only), + filter=tsi.CallsFilter(trace_roots_only=trace_roots_only), ) ) @@ -650,7 +650,7 @@ def test_trace_call_query_filter_wb_run_ids(client, user_by_api_key_in_env): inner_res = get_client_trace_server(client).calls_query( tsi.CallsQueryReq( project_id=get_client_project_id(client), - filter=tsi._CallsFilter(wb_run_ids=wb_run_ids), + filter=tsi.CallsFilter(wb_run_ids=wb_run_ids), ) ) @@ -711,13 +711,13 @@ def basic_op(in_val: dict, delay) -> dict: basic_op({"prim": i, "list": [i], "dict": {"inner": i}}, i / 10) for first, last, sort_by in [ - (2, 0, [tsi._SortBy(field="started_at", direction="desc")]), - (2, 0, [tsi._SortBy(field="inputs.in_val.prim", direction="desc")]), - (2, 0, [tsi._SortBy(field="inputs.in_val.list.0", direction="desc")]), - (2, 0, [tsi._SortBy(field="inputs.in_val.dict.inner", direction="desc")]), - (2, 0, [tsi._SortBy(field="output.prim", direction="desc")]), - (2, 0, [tsi._SortBy(field="output.list.0", direction="desc")]), - (2, 0, [tsi._SortBy(field="output.dict.inner", direction="desc")]), + (2, 0, [tsi.SortBy(field="started_at", direction="desc")]), + (2, 0, [tsi.SortBy(field="inputs.in_val.prim", direction="desc")]), + (2, 0, [tsi.SortBy(field="inputs.in_val.list.0", direction="desc")]), + (2, 0, [tsi.SortBy(field="inputs.in_val.dict.inner", direction="desc")]), + (2, 0, [tsi.SortBy(field="output.prim", direction="desc")]), + (2, 0, [tsi.SortBy(field="output.list.0", direction="desc")]), + (2, 0, [tsi.SortBy(field="output.dict.inner", direction="desc")]), ]: inner_res = get_client_trace_server(client).calls_query( tsi.CallsQueryReq( @@ -767,7 +767,7 @@ def basic_op(in_val: dict) -> dict: inner_res = get_client_trace_server(client).calls_query( tsi.CallsQueryReq( project_id=get_client_project_id(client), - sort_by=[tsi._SortBy(field="inputs.in_val.prim", direction=direction)], + sort_by=[tsi.SortBy(field="inputs.in_val.prim", direction=direction)], ) ) @@ -1237,7 +1237,7 @@ class BaseTypeC(BaseTypeB): inner_res = client.server.objs_query( tsi.ObjQueryReq( project_id=client._project_id(), - filter=tsi._ObjectVersionFilter( + filter=tsi.ObjectVersionFilter( base_object_classes=["BaseTypeA"], ), ) @@ -1257,7 +1257,7 @@ def op_with_attrs(a: int, b: int) -> int: res = get_client_trace_server(client).calls_query( tsi.CallsQueryReq( project_id=get_client_project_id(client), - filter=tsi._CallsFilter(op_names=[ref_str(op_with_attrs)]), + filter=tsi.CallsFilter(op_names=[ref_str(op_with_attrs)]), ) ) @@ -1303,7 +1303,7 @@ def dataclass_maker(a: MyDataclass, b: MyDataclass) -> MyDataclass: res = get_client_trace_server(client).calls_query( tsi.CallsQueryReq( project_id=get_client_project_id(client), - filter=tsi._CallsFilter(op_names=[ref_str(dataclass_maker)]), + filter=tsi.CallsFilter(op_names=[ref_str(dataclass_maker)]), ) ) @@ -1403,7 +1403,7 @@ def tuple_maker(a, b): res = get_client_trace_server(client).calls_query( tsi.CallsQueryReq( project_id=get_client_project_id(client), - filter=tsi._CallsFilter(op_names=[ref_str(tuple_maker)]), + filter=tsi.CallsFilter(op_names=[ref_str(tuple_maker)]), ) ) @@ -1428,7 +1428,7 @@ def tuple_maker(a, b): res = get_client_trace_server(client).calls_query( tsi.CallsQueryReq( project_id=get_client_project_id(client), - filter=tsi._CallsFilter(op_names=[ref_str(tuple_maker)]), + filter=tsi.CallsFilter(op_names=[ref_str(tuple_maker)]), ) ) @@ -1466,7 +1466,7 @@ async def predict(self, x): res = get_client_trace_server(client).objs_query( tsi.ObjQueryReq( project_id=get_client_project_id(client), - filter=tsi._ObjectVersionFilter( + filter=tsi.ObjectVersionFilter( is_op=False, latest_only=True, base_object_classes=["Dataset"] ), ) @@ -2184,10 +2184,10 @@ def test_obj(val): ) for first, last, sort_by in [ - (0, 21, [tsi._SortBy(field="inputs.val.a.b.c.d", direction="asc")]), - (21, 0, [tsi._SortBy(field="inputs.val.a.b.c.d", direction="desc")]), - (0, 21, [tsi._SortBy(field="output.a.b.c.d", direction="asc")]), - (21, 0, [tsi._SortBy(field="output.a.b.c.d", direction="desc")]), + (0, 21, [tsi.SortBy(field="inputs.val.a.b.c.d", direction="asc")]), + (21, 0, [tsi.SortBy(field="inputs.val.a.b.c.d", direction="desc")]), + (0, 21, [tsi.SortBy(field="output.a.b.c.d", direction="asc")]), + (21, 0, [tsi.SortBy(field="output.a.b.c.d", direction="desc")]), ]: inner_res = get_client_trace_server(client).calls_query( tsi.CallsQueryReq( @@ -2241,7 +2241,7 @@ def test_obj(val): tsi.CallsQueryReq.model_validate( dict( project_id=get_client_project_id(client), - sort_by=[tsi._SortBy(field="inputs.val.a.b.c.d", direction="asc")], + sort_by=[tsi.SortBy(field="inputs.val.a.b.c.d", direction="asc")], query={"$expr": query}, ) ) @@ -2372,7 +2372,7 @@ def test_model_save(client): inner_res = get_client_trace_server(client).objs_query( tsi.ObjQueryReq( project_id=get_client_project_id(client), - filter=tsi._ObjectVersionFilter( + filter=tsi.ObjectVersionFilter( is_op=False, latest_only=True, base_object_classes=["Model"] ), ) diff --git a/weave/tests/test_evaluations.py b/weave/tests/test_evaluations.py index 09909d23558..22962ee4b3c 100644 --- a/weave/tests/test_evaluations.py +++ b/weave/tests/test_evaluations.py @@ -136,7 +136,7 @@ def is_op_ref_with_name(val: Any, name: str): objs = client.server.objs_query( tsi.ObjQueryReq( project_id=client._project_id(), - filter=tsi._ObjectVersionFilter(base_object_classes=["Model"]), + filter=tsi.ObjectVersionFilter(base_object_classes=["Model"]), ) ) assert len(objs.objs) == 1 diff --git a/weave/tests/test_weave_client.py b/weave/tests/test_weave_client.py index d126481a14e..6fc102ce400 100644 --- a/weave/tests/test_weave_client.py +++ b/weave/tests/test_weave_client.py @@ -289,7 +289,7 @@ def test_calls_query(client): call0 = client.create_call("x", {"a": 5, "b": 10}) call1 = client.create_call("x", {"a": 6, "b": 11}) call2 = client.create_call("y", {"a": 5, "b": 10}) - result = list(client.calls(weave_client._CallsFilter(op_names=[call1.op_name]))) + result = list(client.calls(weave_client.CallsFilter(op_names=[call1.op_name]))) assert len(result) == 2 assert result[0] == weave_client.Call( op_name="weave:///shawn/test-project/op/x:tzUhDyzVm5bqQsuqh5RT4axEXSosyLIYZn9zbRyenaw", @@ -340,16 +340,16 @@ def test_calls_delete(client): assert len(list(client.calls())) == 4 - result = list(client.calls(weave_client._CallsFilter(op_names=[call0.op_name]))) + result = list(client.calls(weave_client.CallsFilter(op_names=[call0.op_name]))) assert len(result) == 3 # should deleted call0_child1, _call0_child2, call1, but not call0 client.delete_call(call0_child1) - result = list(client.calls(weave_client._CallsFilter(op_names=[call0.op_name]))) + result = list(client.calls(weave_client.CallsFilter(op_names=[call0.op_name]))) assert len(result) == 1 - result = list(client.calls(weave_client._CallsFilter(op_names=[call1.op_name]))) + result = list(client.calls(weave_client.CallsFilter(op_names=[call1.op_name]))) assert len(result) == 0 # no-op if already deleted @@ -1228,13 +1228,13 @@ def models(text): callsWithCost = list( client.calls( - weave_client._CallsFilter(op_names=[call.op_name]), + weave_client.CallsFilter(op_names=[call.op_name]), include_costs=True, ) ) callsNoCost = list( client.calls( - weave_client._CallsFilter(op_names=[call.op_name]), + weave_client.CallsFilter(op_names=[call.op_name]), include_costs=False, ) ) diff --git a/weave/trace/tests/test_op_argument_forms.py b/weave/trace/tests/test_op_argument_forms.py index 913b7b8e07d..37fc4cad211 100644 --- a/weave/trace/tests/test_op_argument_forms.py +++ b/weave/trace/tests/test_op_argument_forms.py @@ -420,7 +420,7 @@ def test_general_arg_variations(client, fn, arg_variations): res = client.server.calls_query( tsi.CallsQueryReq( project_id=client._project_id(), - filter=tsi._CallsFilter(op_names=[wrapped_fn.ref.uri()]), + filter=tsi.CallsFilter(op_names=[wrapped_fn.ref.uri()]), ) ) diff --git a/weave/trace/vals.py b/weave/trace/vals.py index 0e9277b258b..da38d476704 100644 --- a/weave/trace/vals.py +++ b/weave/trace/vals.py @@ -26,8 +26,8 @@ from weave.trace_server.trace_server_interface import ( ObjReadReq, TableQueryReq, + TableRowFilter, TraceServerInterface, - _TableRowFilter, ) @@ -229,14 +229,14 @@ def __eq__(self, other: Any) -> bool: class WeaveTable(Traceable): - filter: _TableRowFilter + filter: TableRowFilter def __init__( self, table_ref: Optional[TableRef], ref: Optional[RefWithExtra], server: TraceServerInterface, - filter: _TableRowFilter, + filter: TableRowFilter, root: Optional[Traceable], parent: Optional[Traceable] = None, ) -> None: @@ -504,7 +504,7 @@ def make_trace_obj( table_ref=val_ref, ref=new_ref, server=server, - filter=_TableRowFilter(), + filter=TableRowFilter(), root=root, parent=parent, ) @@ -513,7 +513,7 @@ def make_trace_obj( table_ref=val, ref=new_ref, server=server, - filter=_TableRowFilter(), + filter=TableRowFilter(), root=root, parent=parent, ) @@ -539,7 +539,7 @@ def make_trace_obj( table_ref=val, ref=new_ref, server=server, - filter=_TableRowFilter(), + filter=TableRowFilter(), root=root, parent=parent, ) diff --git a/weave/trace_server/calls_query_builder.py b/weave/trace_server/calls_query_builder.py index 4329aa05238..a23e05b1005 100644 --- a/weave/trace_server/calls_query_builder.py +++ b/weave/trace_server/calls_query_builder.py @@ -180,7 +180,7 @@ def is_heavy(self) -> bool: class HardCodedFilter(BaseModel): - filter: tsi._CallsFilter + filter: tsi.CallsFilter def is_useful(self) -> bool: """Returns True if the filter is useful - i.e. it has any non-null fields @@ -659,7 +659,7 @@ def process_operand(operand: "tsi_query.Operand") -> str: def process_calls_filter_to_conditions( - filter: tsi._CallsFilter, + filter: tsi.CallsFilter, param_builder: ParamBuilder, table_alias: str, ) -> list[str]: diff --git a/weave/trace_server/clickhouse_trace_server_batched.py b/weave/trace_server/clickhouse_trace_server_batched.py index 5f423f6e75d..1c33113fd0d 100644 --- a/weave/trace_server/clickhouse_trace_server_batched.py +++ b/weave/trace_server/clickhouse_trace_server_batched.py @@ -204,7 +204,7 @@ def call_read(self, req: tsi.CallReadReq) -> tsi.CallReadRes: res = self.calls_query_stream( tsi.CallsQueryReq( project_id=req.project_id, - filter=tsi._CallsFilter( + filter=tsi.CallsFilter( call_ids=[req.id], ), limit=1, @@ -310,7 +310,7 @@ def calls_delete(self, req: tsi.CallsDeleteReq) -> tsi.CallsDeleteRes: self.calls_query_stream( tsi.CallsQueryReq( project_id=req.project_id, - filter=tsi._CallsFilter( + filter=tsi.CallsFilter( call_ids=req.call_ids, ), ) @@ -322,7 +322,7 @@ def calls_delete(self, req: tsi.CallsDeleteReq) -> tsi.CallsDeleteRes: self.calls_query_stream( tsi.CallsQueryReq( project_id=req.project_id, - filter=tsi._CallsFilter( + filter=tsi.CallsFilter( trace_ids=[p.trace_id for p in parents], ), ) diff --git a/weave/trace_server/orm.py b/weave/trace_server/orm.py index 8398b1127f2..39eab0d87dd 100644 --- a/weave/trace_server/orm.py +++ b/weave/trace_server/orm.py @@ -222,7 +222,7 @@ class Select: _project_id: typing.Optional[str] _fields: typing.Optional[list[str]] _query: typing.Optional[tsi.Query] - _order_by: typing.Optional[typing.List[tsi._SortBy]] + _order_by: typing.Optional[typing.List[tsi.SortBy]] _limit: typing.Optional[int] _offset: typing.Optional[int] _group_by: typing.Optional[list[str]] @@ -261,7 +261,7 @@ def where(self, query: typing.Optional[tsi.Query]) -> "Select": self._query = query return self - def order_by(self, order_by: typing.Optional[typing.List[tsi._SortBy]]) -> "Select": + def order_by(self, order_by: typing.Optional[typing.List[tsi.SortBy]]) -> "Select": if order_by: for o in order_by: assert o.direction in ( diff --git a/weave/trace_server/sqlite_trace_server.py b/weave/trace_server/sqlite_trace_server.py index 751f7865881..2402067b062 100644 --- a/weave/trace_server/sqlite_trace_server.py +++ b/weave/trace_server/sqlite_trace_server.py @@ -239,7 +239,7 @@ def call_read(self, req: tsi.CallReadReq) -> tsi.CallReadRes: tsi.CallsQueryReq( project_id=req.project_id, limit=1, - filter=tsi._CallsFilter(call_ids=[req.id]), + filter=tsi.CallsFilter(call_ids=[req.id]), ) ).calls return tsi.CallReadRes(call=calls[0] if calls else None) diff --git a/weave/trace_server/tests/test_calls_query_builder.py b/weave/trace_server/tests/test_calls_query_builder.py index bb10ac77879..3886f1cccba 100644 --- a/weave/trace_server/tests/test_calls_query_builder.py +++ b/weave/trace_server/tests/test_calls_query_builder.py @@ -72,7 +72,7 @@ def test_query_heavy_column_simple_filter() -> None: cq.add_field("inputs") cq.set_hardcoded_filter( HardCodedFilter( - filter=tsi._CallsFilter( + filter=tsi.CallsFilter( op_names=["a", "b"], ) ) @@ -113,7 +113,7 @@ def test_query_heavy_column_simple_filter_with_order() -> None: cq.add_order("started_at", "desc") cq.set_hardcoded_filter( HardCodedFilter( - filter=tsi._CallsFilter( + filter=tsi.CallsFilter( op_names=["a", "b"], ) ) @@ -156,7 +156,7 @@ def test_query_heavy_column_simple_filter_with_order_and_limit() -> None: cq.set_limit(10) cq.set_hardcoded_filter( HardCodedFilter( - filter=tsi._CallsFilter( + filter=tsi.CallsFilter( op_names=["a", "b"], ) ) @@ -203,7 +203,7 @@ def test_query_heavy_column_simple_filter_with_order_and_limit_and_mixed_query_c cq.set_limit(10) cq.set_hardcoded_filter( HardCodedFilter( - filter=tsi._CallsFilter( + filter=tsi.CallsFilter( op_names=["a", "b"], ) ) @@ -287,7 +287,7 @@ def test_query_light_column_with_costs() -> None: cq.add_field("started_at") cq.set_hardcoded_filter( HardCodedFilter( - filter=tsi._CallsFilter( + filter=tsi.CallsFilter( op_names=["a", "b"], ) ) diff --git a/weave/trace_server/trace_server_interface.py b/weave/trace_server/trace_server_interface.py index eb1e296a02f..64df67db54d 100644 --- a/weave/trace_server/trace_server_interface.py +++ b/weave/trace_server/trace_server_interface.py @@ -222,7 +222,7 @@ class CallsDeleteRes(BaseModel): pass -class _CallsFilter(BaseModel): +class CallsFilter(BaseModel): op_names: typing.Optional[typing.List[str]] = None input_refs: typing.Optional[typing.List[str]] = None output_refs: typing.Optional[typing.List[str]] = None @@ -234,7 +234,7 @@ class _CallsFilter(BaseModel): wb_run_ids: typing.Optional[typing.List[str]] = None -class _SortBy(BaseModel): +class SortBy(BaseModel): # Field should be a key of `CallSchema`. For dictionary fields # (`attributes`, `inputs`, `outputs`, `summary`), the field can be # dot-separated. @@ -245,16 +245,16 @@ class _SortBy(BaseModel): class CallsQueryReq(BaseModel): project_id: str - filter: typing.Optional[_CallsFilter] = None + filter: typing.Optional[CallsFilter] = None limit: typing.Optional[int] = None offset: typing.Optional[int] = None # Sort by multiple fields - sort_by: typing.Optional[typing.List[_SortBy]] = None + sort_by: typing.Optional[typing.List[SortBy]] = None query: typing.Optional[Query] = None include_costs: typing.Optional[bool] = False # TODO: type this with call schema columns, following the same rules as - # _SortBy and thus GetFieldOperator.get_field_ (without direction) + # SortBy and thus GetFieldOperator.get_field_ (without direction) columns: typing.Optional[typing.List[str]] = None @@ -264,7 +264,7 @@ class CallsQueryRes(BaseModel): class CallsQueryStatsReq(BaseModel): project_id: str - filter: typing.Optional[_CallsFilter] = None + filter: typing.Optional[CallsFilter] = None query: typing.Optional[Query] = None @@ -306,14 +306,14 @@ class OpReadRes(BaseModel): op_obj: ObjSchema -class _OpVersionFilter(BaseModel): +class OpVersionFilter(BaseModel): op_names: typing.Optional[typing.List[str]] = None latest_only: typing.Optional[bool] = None class OpQueryReq(BaseModel): project_id: str - filter: typing.Optional[_OpVersionFilter] = None + filter: typing.Optional[OpVersionFilter] = None class OpQueryRes(BaseModel): @@ -338,7 +338,7 @@ class ObjReadRes(BaseModel): obj: ObjSchema -class _ObjectVersionFilter(BaseModel): +class ObjectVersionFilter(BaseModel): base_object_classes: typing.Optional[typing.List[str]] = None object_ids: typing.Optional[typing.List[str]] = None is_op: typing.Optional[bool] = None @@ -347,7 +347,7 @@ class _ObjectVersionFilter(BaseModel): class ObjQueryReq(BaseModel): project_id: str - filter: typing.Optional[_ObjectVersionFilter] = None + filter: typing.Optional[ObjectVersionFilter] = None class ObjQueryRes(BaseModel): @@ -456,14 +456,14 @@ class TableCreateRes(BaseModel): digest: str -class _TableRowFilter(BaseModel): +class TableRowFilter(BaseModel): row_digests: typing.Optional[typing.List[str]] = None class TableQueryReq(BaseModel): project_id: str digest: str - filter: typing.Optional[_TableRowFilter] = None + filter: typing.Optional[TableRowFilter] = None limit: typing.Optional[int] = None offset: typing.Optional[int] = None @@ -527,8 +527,7 @@ class FeedbackQueryReq(BaseModel): query: typing.Optional[Query] = None # TODO: I think I would prefer to call this order_by to match SQL, but this is what calls API uses # TODO: Might be nice to have shortcut for single field and implied ASC direction - # TODO: I think _SortBy shouldn't have leading underscore - sort_by: typing.Optional[typing.List[_SortBy]] = None + sort_by: typing.Optional[typing.List[SortBy]] = None limit: typing.Optional[int] = Field(default=None, examples=[10]) offset: typing.Optional[int] = Field(default=None, examples=[0]) @@ -674,3 +673,11 @@ def feedback_purge(self, req: FeedbackPurgeReq) -> FeedbackPurgeRes: CallsDeleteReqForInsert = CallsDeleteReq CallUpdateReqForInsert = CallUpdateReq FeedbackCreateReqForInsert = FeedbackCreateReq + +# Legacy Names (i think these might be used in a few growth examples, so keeping +# around until we clean those up of them) +_CallsFilter = CallsFilter +_SortBy = SortBy +_OpVersionFilter = OpVersionFilter +_ObjectVersionFilter = ObjectVersionFilter +_TableRowFilter = TableRowFilter diff --git a/weave/weave_client.py b/weave/weave_client.py index 406ff2a3118..60ab9c4d5b5 100644 --- a/weave/weave_client.py +++ b/weave/weave_client.py @@ -44,11 +44,13 @@ CallEndReq, CallSchema, CallsDeleteReq, + CallsFilter, CallsQueryReq, CallStartReq, CallUpdateReq, EndedCallSchemaForInsert, ObjCreateReq, + ObjectVersionFilter, ObjQueryReq, ObjReadReq, ObjSchema, @@ -59,8 +61,6 @@ TableCreateReq, TableSchemaForInsert, TraceServerInterface, - _CallsFilter, - _ObjectVersionFilter, ) if typing.TYPE_CHECKING: @@ -206,7 +206,7 @@ def children(self) -> "CallsIter": return CallsIter( client.server, self.project_id, - _CallsFilter(parent_ids=[self.id]), + CallsFilter(parent_ids=[self.id]), ) def delete(self) -> bool: @@ -230,14 +230,14 @@ def remove_display_name(self) -> None: class CallsIter: server: TraceServerInterface - filter: _CallsFilter + filter: CallsFilter include_costs: bool def __init__( self, server: TraceServerInterface, project_id: str, - filter: _CallsFilter, + filter: CallsFilter, include_costs: bool = False, ) -> None: self.server = server @@ -470,11 +470,11 @@ def get(self, ref: ObjectRef) -> Any: @trace_sentry.global_trace_sentry.watch() def calls( self, - filter: Optional[_CallsFilter] = None, + filter: Optional[CallsFilter] = None, include_costs: Optional[bool] = False, ) -> CallsIter: if filter is None: - filter = _CallsFilter() + filter = CallsFilter() return CallsIter( self.server, self._project_id(), filter, include_costs or False @@ -485,7 +485,7 @@ def call(self, call_id: str, include_costs: Optional[bool] = False) -> WeaveObje response = self.server.calls_query( CallsQueryReq( project_id=self._project_id(), - filter=_CallsFilter(call_ids=[call_id]), + filter=CallsFilter(call_ids=[call_id]), include_costs=include_costs, ) ) @@ -851,17 +851,15 @@ def _op_calls(self, op: Op) -> CallsIter: op_ref = get_ref(op) if op_ref is None: raise ValueError(f"Can't get runs for unpublished op: {op}") - return self.calls(_CallsFilter(op_names=[op_ref.uri()])) + return self.calls(CallsFilter(op_names=[op_ref.uri()])) @trace_sentry.global_trace_sentry.watch() - def _objects( - self, filter: Optional[_ObjectVersionFilter] = None - ) -> list[ObjSchema]: + def _objects(self, filter: Optional[ObjectVersionFilter] = None) -> list[ObjSchema]: if not filter: - filter = _ObjectVersionFilter() + filter = ObjectVersionFilter() else: filter = filter.model_copy() - filter = typing.cast(_ObjectVersionFilter, filter) + filter = typing.cast(ObjectVersionFilter, filter) filter.is_op = False response = self.server.objs_query(