Skip to content

Commit 2470af7

Browse files
authored
feat(api): update API spec from langfuse/langfuse dee644d (#1398)
1 parent 9b4dcd5 commit 2470af7

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

langfuse/api/reference.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6906,6 +6906,38 @@ client.trace.list()
69066906
<dl>
69076907
<dd>
69086908

6909+
**filter:** `typing.Optional[str]`
6910+
6911+
JSON string containing an array of filter conditions. When provided, this takes precedence over legacy filter parameters (userId, name, sessionId, tags, version, release, environment, fromTimestamp, toTimestamp).
6912+
Each filter condition has the following structure:
6913+
```json
6914+
[
6915+
{
6916+
"type": string, // Required. One of: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "boolean", "null"
6917+
"column": string, // Required. Column to filter on
6918+
"operator": string, // Required. Operator based on type:
6919+
// - datetime: ">", "<", ">=", "<="
6920+
// - string: "=", "contains", "does not contain", "starts with", "ends with"
6921+
// - stringOptions: "any of", "none of"
6922+
// - categoryOptions: "any of", "none of"
6923+
// - arrayOptions: "any of", "none of", "all of"
6924+
// - number: "=", ">", "<", ">=", "<="
6925+
// - stringObject: "=", "contains", "does not contain", "starts with", "ends with"
6926+
// - numberObject: "=", ">", "<", ">=", "<="
6927+
// - boolean: "=", "<>"
6928+
// - null: "is null", "is not null"
6929+
"value": any, // Required (except for null type). Value to compare against. Type depends on filter type
6930+
"key": string // Required only for stringObject, numberObject, and categoryOptions types when filtering on nested fields like metadata
6931+
}
6932+
]
6933+
```
6934+
6935+
</dd>
6936+
</dl>
6937+
6938+
<dl>
6939+
<dd>
6940+
69096941
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
69106942

69116943
</dd>

langfuse/api/resources/trace/client.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ def list(
173173
release: typing.Optional[str] = None,
174174
environment: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
175175
fields: typing.Optional[str] = None,
176+
filter: typing.Optional[str] = None,
176177
request_options: typing.Optional[RequestOptions] = None,
177178
) -> Traces:
178179
"""
@@ -216,6 +217,31 @@ def list(
216217
fields : typing.Optional[str]
217218
Comma-separated list of fields to include in the response. Available field groups: 'core' (always included), 'io' (input, output, metadata), 'scores', 'observations', 'metrics'. If not specified, all fields are returned. Example: 'core,scores,metrics'. Note: Excluded 'observations' or 'scores' fields return empty arrays; excluded 'metrics' returns -1 for 'totalCost' and 'latency'.
218219
220+
filter : typing.Optional[str]
221+
JSON string containing an array of filter conditions. When provided, this takes precedence over legacy filter parameters (userId, name, sessionId, tags, version, release, environment, fromTimestamp, toTimestamp).
222+
Each filter condition has the following structure:
223+
```json
224+
[
225+
{
226+
"type": string, // Required. One of: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "boolean", "null"
227+
"column": string, // Required. Column to filter on
228+
"operator": string, // Required. Operator based on type:
229+
// - datetime: ">", "<", ">=", "<="
230+
// - string: "=", "contains", "does not contain", "starts with", "ends with"
231+
// - stringOptions: "any of", "none of"
232+
// - categoryOptions: "any of", "none of"
233+
// - arrayOptions: "any of", "none of", "all of"
234+
// - number: "=", ">", "<", ">=", "<="
235+
// - stringObject: "=", "contains", "does not contain", "starts with", "ends with"
236+
// - numberObject: "=", ">", "<", ">=", "<="
237+
// - boolean: "=", "<>"
238+
// - null: "is null", "is not null"
239+
"value": any, // Required (except for null type). Value to compare against. Type depends on filter type
240+
"key": string // Required only for stringObject, numberObject, and categoryOptions types when filtering on nested fields like metadata
241+
}
242+
]
243+
```
244+
219245
request_options : typing.Optional[RequestOptions]
220246
Request-specific configuration.
221247
@@ -258,6 +284,7 @@ def list(
258284
"release": release,
259285
"environment": environment,
260286
"fields": fields,
287+
"filter": filter,
261288
},
262289
request_options=request_options,
263290
)
@@ -524,6 +551,7 @@ async def list(
524551
release: typing.Optional[str] = None,
525552
environment: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
526553
fields: typing.Optional[str] = None,
554+
filter: typing.Optional[str] = None,
527555
request_options: typing.Optional[RequestOptions] = None,
528556
) -> Traces:
529557
"""
@@ -567,6 +595,31 @@ async def list(
567595
fields : typing.Optional[str]
568596
Comma-separated list of fields to include in the response. Available field groups: 'core' (always included), 'io' (input, output, metadata), 'scores', 'observations', 'metrics'. If not specified, all fields are returned. Example: 'core,scores,metrics'. Note: Excluded 'observations' or 'scores' fields return empty arrays; excluded 'metrics' returns -1 for 'totalCost' and 'latency'.
569597
598+
filter : typing.Optional[str]
599+
JSON string containing an array of filter conditions. When provided, this takes precedence over legacy filter parameters (userId, name, sessionId, tags, version, release, environment, fromTimestamp, toTimestamp).
600+
Each filter condition has the following structure:
601+
```json
602+
[
603+
{
604+
"type": string, // Required. One of: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "boolean", "null"
605+
"column": string, // Required. Column to filter on
606+
"operator": string, // Required. Operator based on type:
607+
// - datetime: ">", "<", ">=", "<="
608+
// - string: "=", "contains", "does not contain", "starts with", "ends with"
609+
// - stringOptions: "any of", "none of"
610+
// - categoryOptions: "any of", "none of"
611+
// - arrayOptions: "any of", "none of", "all of"
612+
// - number: "=", ">", "<", ">=", "<="
613+
// - stringObject: "=", "contains", "does not contain", "starts with", "ends with"
614+
// - numberObject: "=", ">", "<", ">=", "<="
615+
// - boolean: "=", "<>"
616+
// - null: "is null", "is not null"
617+
"value": any, // Required (except for null type). Value to compare against. Type depends on filter type
618+
"key": string // Required only for stringObject, numberObject, and categoryOptions types when filtering on nested fields like metadata
619+
}
620+
]
621+
```
622+
570623
request_options : typing.Optional[RequestOptions]
571624
Request-specific configuration.
572625
@@ -617,6 +670,7 @@ async def main() -> None:
617670
"release": release,
618671
"environment": environment,
619672
"fields": fields,
673+
"filter": filter,
620674
},
621675
request_options=request_options,
622676
)

0 commit comments

Comments
 (0)