You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.`<COLUMN>`: The column name to filter on, these can be:
66
-
-`name`
67
-
-`input`
68
-
-`output`
69
-
-`start_time`
70
-
-`end_time`
71
-
-`metadata`
72
-
-`feedback_scores`
73
-
-`tags`
74
-
-`usage.total_tokens`
75
-
-`usage.prompt_tokens`
76
-
-`usage.completion_tokens`.
77
-
2.`<OPERATOR>`: The operator to use for the filter, this can be `=`, `!=`, `>`, `>=`, `<`, `<=`, `contains`, `not_contains`. Not that not all operators are supported for all columns.
78
-
3.`<VALUE>`: The value to use in the comparison to `<COLUMN>`. If the value is a string, you will need to wrap it in double quotes.
79
-
80
-
You can add as many `and` clauses as required.
81
-
82
-
If a `<COLUMN>` item refers to a nested object, then you can use the
83
-
dot notation to access contained values by using its key. For example,
Copy file name to clipboardExpand all lines: sdks/python/src/opik/api_objects/opik_client.py
+96-5Lines changed: 96 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -977,7 +977,41 @@ def search_traces(
977
977
978
978
Args:
979
979
project_name: The name of the project to search traces in. If not provided, will search across the project name configured when the Client was created which defaults to the `Default Project`.
980
-
filter_string: A filter string to narrow down the search. If not provided, all traces in the project will be returned up to the limit.
980
+
filter_string: A filter string to narrow down the search using Opik Query Language (OQL).
981
+
The format is: "<COLUMN> <OPERATOR> <VALUE> [AND <COLUMN> <OPERATOR> <VALUE>]*"
982
+
983
+
Supported columns include:
984
+
- `id`, `name`, `created_by`, `thread_id`, `type`, `model`, `provider`: String fields with full operator support
985
+
- `status`: String field (=, contains, not_contains only)
986
+
- `start_time`, `end_time`: DateTime fields (use ISO 8601 format, e.g., "2024-01-01T00:00:00Z")
- `start_time >= "2024-01-01T00:00:00Z"` - Filter by start date
1006
+
- `start_time > "2024-01-01T00:00:00Z" AND start_time < "2024-02-01T00:00:00Z"` - Date range
1007
+
- `input contains "question"` - Filter by input content
1008
+
- `usage.total_tokens > 1000` - Filter by token usage
1009
+
- `feedback_scores.accuracy > 0.8` - Filter by feedback score
1010
+
- `tags contains "production"` - Filter by tag
1011
+
- `metadata.model = "gpt-4"` - Filter by metadata field
1012
+
- `thread_id = "thread_123"` - Filter by thread ID
1013
+
1014
+
If not provided, all traces in the project will be returned up to the limit.
981
1015
max_results: The maximum number of traces to return.
982
1016
truncate: Whether to truncate image data stored in input, output, or metadata
983
1017
"""
@@ -1015,7 +1049,41 @@ def search_spans(
1015
1049
Args:
1016
1050
project_name: The name of the project to search spans in. If not provided, will search across the project name configured when the Client was created which defaults to the `Default Project`.
1017
1051
trace_id: The ID of the trace to search spans in. If provided, the search will be limited to the spans in the given trace.
1018
-
filter_string: A filter string to narrow down the search.
1052
+
filter_string: A filter string to narrow down the search using Opik Query Language (OQL).
1053
+
The format is: "<COLUMN> <OPERATOR> <VALUE> [AND <COLUMN> <OPERATOR> <VALUE>]*"
1054
+
1055
+
Supported columns include:
1056
+
- `id`, `name`, `created_by`, `thread_id`, `type`, `model`, `provider`: String fields with full operator support
1057
+
- `status`: String field (=, contains, not_contains only)
1058
+
- `start_time`, `end_time`: DateTime fields (use ISO 8601 format, e.g., "2024-01-01T00:00:00Z")
Retrieve the latest prompt versions for the given search parameters.
1217
1287
1218
1288
Parameters:
1219
-
filter_string: A filter string using Opik Query Language. It will be parsed and
1220
-
converted into a stringified list of filters expected by the backend.
1289
+
name: The substring of the prompt name to search for. If you have an exact name, consider using the `get_prompt` method instead since the name is a unique identifier.
1290
+
filter_string: A filter string to narrow down the search using Opik Query Language (OQL).
1291
+
The format is: "<COLUMN> <OPERATOR> <VALUE> [AND <COLUMN> <OPERATOR> <VALUE>]*"
1292
+
1293
+
Supported columns include:
1294
+
- `id`, `name`: String fields
1295
+
- `tags`: List field (use "contains" operator only)
0 commit comments