Skip to content

Commit 9593d37

Browse files
langfuse-botlangfuse-bot
andauthored
feat(api): update API spec from langfuse/langfuse a44d88c (#1749)
Co-authored-by: langfuse-bot <langfuse-bot@langfuse.com>
1 parent 69e74df commit 9593d37

7 files changed

Lines changed: 35 additions & 14 deletions

File tree

langfuse/api/blob_storage_integrations/types/blob_storage_integration_file_type.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,27 @@
88

99

1010
class BlobStorageIntegrationFileType(enum.StrEnum):
11+
"""
12+
File format for exported data. `PARQUET` is a columnar binary format encoded and compressed by the storage engine; gzip compression does not apply to it. Note that the model-price columns (`input_price`, `output_price`, `total_price`) are not included in Parquet observation exports.
13+
"""
14+
1115
JSON = "JSON"
1216
CSV = "CSV"
1317
JSONL = "JSONL"
18+
PARQUET = "PARQUET"
1419

1520
def visit(
1621
self,
1722
json: typing.Callable[[], T_Result],
1823
csv: typing.Callable[[], T_Result],
1924
jsonl: typing.Callable[[], T_Result],
25+
parquet: typing.Callable[[], T_Result],
2026
) -> T_Result:
2127
if self is BlobStorageIntegrationFileType.JSON:
2228
return json()
2329
if self is BlobStorageIntegrationFileType.CSV:
2430
return csv()
2531
if self is BlobStorageIntegrationFileType.JSONL:
2632
return jsonl()
33+
if self is BlobStorageIntegrationFileType.PARQUET:
34+
return parquet()

langfuse/api/blob_storage_integrations/types/blob_storage_integration_file_type_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class BlobStorageIntegrationFileTypeResponse(enum.StrEnum):
1111
"""
12-
File type reported for an existing integration. Includes `PARQUET`, which a project may enable through the Langfuse UI but cannot yet be set via this API (the request `fileType` omits it).
12+
File type reported for an existing integration.
1313
"""
1414

1515
JSON = "JSON"

langfuse/api/trace/client.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def list(
180180
```json
181181
[
182182
{
183-
"type": string, // Required. One of: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "boolean", "null"
183+
"type": string, // Required. One of: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "booleanObject", "boolean", "null"
184184
"column": string, // Required. Column to filter on (see available columns below)
185185
"operator": string, // Required. Operator based on type:
186186
// - datetime: ">", "<", ">=", "<="
@@ -191,10 +191,11 @@ def list(
191191
// - number: "=", ">", "<", ">=", "<="
192192
// - stringObject: "=", "contains", "does not contain", "starts with", "ends with"
193193
// - numberObject: "=", ">", "<", ">=", "<="
194+
// - booleanObject: "=", "<>"
194195
// - boolean: "=", "<>"
195196
// - null: "is null", "is not null"
196197
"value": any, // Required (except for null type). Value to compare against. Type depends on filter type
197-
"key": string // Required only for stringObject, numberObject, and categoryOptions types when filtering on nested fields like metadata
198+
"key": string // Required only for stringObject, numberObject, booleanObject, and categoryOptions types when filtering on nested fields like metadata or score names
198199
}
199200
]
200201
```
@@ -237,6 +238,7 @@ def list(
237238
### Scores (requires join with scores table)
238239
- `scores_avg` (number) - Average of numeric scores (alias: `scores`)
239240
- `score_categories` (categoryOptions) - Categorical score values
241+
- `score_booleans` (booleanObject) - Boolean score values. Use `key` for the score name and a boolean `value`, e.g. `{"type": "booleanObject", "column": "score_booleans", "key": "is_correct", "operator": "=", "value": true}`. The `<>` operator also matches traces without a score of that name.
240242
241243
## Filter Examples
242244
```json
@@ -546,7 +548,7 @@ async def list(
546548
```json
547549
[
548550
{
549-
"type": string, // Required. One of: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "boolean", "null"
551+
"type": string, // Required. One of: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "booleanObject", "boolean", "null"
550552
"column": string, // Required. Column to filter on (see available columns below)
551553
"operator": string, // Required. Operator based on type:
552554
// - datetime: ">", "<", ">=", "<="
@@ -557,10 +559,11 @@ async def list(
557559
// - number: "=", ">", "<", ">=", "<="
558560
// - stringObject: "=", "contains", "does not contain", "starts with", "ends with"
559561
// - numberObject: "=", ">", "<", ">=", "<="
562+
// - booleanObject: "=", "<>"
560563
// - boolean: "=", "<>"
561564
// - null: "is null", "is not null"
562565
"value": any, // Required (except for null type). Value to compare against. Type depends on filter type
563-
"key": string // Required only for stringObject, numberObject, and categoryOptions types when filtering on nested fields like metadata
566+
"key": string // Required only for stringObject, numberObject, booleanObject, and categoryOptions types when filtering on nested fields like metadata or score names
564567
}
565568
]
566569
```
@@ -603,6 +606,7 @@ async def list(
603606
### Scores (requires join with scores table)
604607
- `scores_avg` (number) - Average of numeric scores (alias: `scores`)
605608
- `score_categories` (categoryOptions) - Categorical score values
609+
- `score_booleans` (booleanObject) - Boolean score values. Use `key` for the score name and a boolean `value`, e.g. `{"type": "booleanObject", "column": "score_booleans", "key": "is_correct", "operator": "=", "value": true}`. The `<>` operator also matches traces without a score of that name.
606610
607611
## Filter Examples
608612
```json

langfuse/api/trace/raw_client.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def list(
308308
```json
309309
[
310310
{
311-
"type": string, // Required. One of: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "boolean", "null"
311+
"type": string, // Required. One of: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "booleanObject", "boolean", "null"
312312
"column": string, // Required. Column to filter on (see available columns below)
313313
"operator": string, // Required. Operator based on type:
314314
// - datetime: ">", "<", ">=", "<="
@@ -319,10 +319,11 @@ def list(
319319
// - number: "=", ">", "<", ">=", "<="
320320
// - stringObject: "=", "contains", "does not contain", "starts with", "ends with"
321321
// - numberObject: "=", ">", "<", ">=", "<="
322+
// - booleanObject: "=", "<>"
322323
// - boolean: "=", "<>"
323324
// - null: "is null", "is not null"
324325
"value": any, // Required (except for null type). Value to compare against. Type depends on filter type
325-
"key": string // Required only for stringObject, numberObject, and categoryOptions types when filtering on nested fields like metadata
326+
"key": string // Required only for stringObject, numberObject, booleanObject, and categoryOptions types when filtering on nested fields like metadata or score names
326327
}
327328
]
328329
```
@@ -365,6 +366,7 @@ def list(
365366
### Scores (requires join with scores table)
366367
- `scores_avg` (number) - Average of numeric scores (alias: `scores`)
367368
- `score_categories` (categoryOptions) - Categorical score values
369+
- `score_booleans` (booleanObject) - Boolean score values. Use `key` for the score name and a boolean `value`, e.g. `{"type": "booleanObject", "column": "score_booleans", "key": "is_correct", "operator": "=", "value": true}`. The `<>` operator also matches traces without a score of that name.
368370
369371
## Filter Examples
370372
```json
@@ -910,7 +912,7 @@ async def list(
910912
```json
911913
[
912914
{
913-
"type": string, // Required. One of: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "boolean", "null"
915+
"type": string, // Required. One of: "datetime", "string", "number", "stringOptions", "categoryOptions", "arrayOptions", "stringObject", "numberObject", "booleanObject", "boolean", "null"
914916
"column": string, // Required. Column to filter on (see available columns below)
915917
"operator": string, // Required. Operator based on type:
916918
// - datetime: ">", "<", ">=", "<="
@@ -921,10 +923,11 @@ async def list(
921923
// - number: "=", ">", "<", ">=", "<="
922924
// - stringObject: "=", "contains", "does not contain", "starts with", "ends with"
923925
// - numberObject: "=", ">", "<", ">=", "<="
926+
// - booleanObject: "=", "<>"
924927
// - boolean: "=", "<>"
925928
// - null: "is null", "is not null"
926929
"value": any, // Required (except for null type). Value to compare against. Type depends on filter type
927-
"key": string // Required only for stringObject, numberObject, and categoryOptions types when filtering on nested fields like metadata
930+
"key": string // Required only for stringObject, numberObject, booleanObject, and categoryOptions types when filtering on nested fields like metadata or score names
928931
}
929932
]
930933
```
@@ -967,6 +970,7 @@ async def list(
967970
### Scores (requires join with scores table)
968971
- `scores_avg` (number) - Average of numeric scores (alias: `scores`)
969972
- `score_categories` (categoryOptions) - Categorical score values
973+
- `score_booleans` (booleanObject) - Boolean score values. Use `key` for the score name and a boolean `value`, e.g. `{"type": "booleanObject", "column": "score_booleans", "key": "is_correct", "operator": "=", "value": true}`. The `<>` operator also matches traces without a score of that name.
970974
971975
## Filter Examples
972976
```json

langfuse/api/unstable/commons/types/evaluation_rule_mapping.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ class EvaluationRuleMapping(UniversalBaseModel):
5555
Source field that should populate the prompt variable.
5656
5757
Quick reference:
58-
- `target=observation`: `input`, `output`, `metadata`
59-
- `target=experiment`: `input`, `output`, `metadata`, `expected_output`, `experiment_item_metadata`
58+
- `target=observation`: `input`, `output`, `metadata`, `tool_calls`
59+
- `target=experiment`: `input`, `output`, `metadata`, `tool_calls`, `expected_output`, `experiment_item_metadata`
6060
"""
6161

6262
json_path: typing_extensions.Annotated[

langfuse/api/unstable/commons/types/evaluation_rule_mapping_source.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,22 @@ class EvaluationRuleMappingSource(enum.StrEnum):
1414
Use these values when mapping evaluator prompt variables to live data.
1515
1616
Target-specific rules:
17-
- `target=observation` supports `input`, `output`, and `metadata`
18-
- `target=experiment` supports `input`, `output`, `metadata`, `expected_output`, and `experiment_item_metadata`
17+
- `target=observation` supports `input`, `output`, `metadata`, and `tool_calls`
18+
- `target=experiment` supports `input`, `output`, `metadata`, `tool_calls`, `expected_output`, and `experiment_item_metadata`
1919
2020
Source semantics:
2121
- `input`: the observation or experiment input payload
2222
- `output`: the observation or experiment output payload
2323
- `metadata`: the metadata object for the target. Combine with `jsonPath` when you need one nested field instead of the whole object.
24+
- `tool_calls`: the tool calls recorded on the observation, as an array of `{id, name, arguments, type, index}` objects in the order the model emitted them. Combine with `jsonPath` (for example `$[*].name`) to select parts of each call.
2425
- `expected_output`: the experiment item's expected output. Only valid for `target=experiment`.
2526
- `experiment_item_metadata`: the experiment item's metadata object. Only valid for `target=experiment`.
2627
"""
2728

2829
INPUT = "input"
2930
OUTPUT = "output"
3031
METADATA = "metadata"
32+
TOOL_CALLS = "tool_calls"
3133
EXPECTED_OUTPUT = "expected_output"
3234
EXPERIMENT_ITEM_METADATA = "experiment_item_metadata"
3335

@@ -36,6 +38,7 @@ def visit(
3638
input: typing.Callable[[], T_Result],
3739
output: typing.Callable[[], T_Result],
3840
metadata: typing.Callable[[], T_Result],
41+
tool_calls: typing.Callable[[], T_Result],
3942
expected_output: typing.Callable[[], T_Result],
4043
experiment_item_metadata: typing.Callable[[], T_Result],
4144
) -> T_Result:
@@ -45,6 +48,8 @@ def visit(
4548
return output()
4649
if self is EvaluationRuleMappingSource.METADATA:
4750
return metadata()
51+
if self is EvaluationRuleMappingSource.TOOL_CALLS:
52+
return tool_calls()
4853
if self is EvaluationRuleMappingSource.EXPECTED_OUTPUT:
4954
return expected_output()
5055
if self is EvaluationRuleMappingSource.EXPERIMENT_ITEM_METADATA:

langfuse/api/unstable/commons/types/evaluation_rule_target.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class EvaluationRuleTarget(enum.StrEnum):
1313
1414
Choose the target first, because it changes both the valid filter columns and the valid variable-mapping sources:
1515
- `observation` evaluates live-ingested observations such as generations, spans, and events.
16-
It supports mapping from `input`, `output`, and `metadata`.
16+
It supports mapping from `input`, `output`, `metadata`, and `tool_calls`.
1717
- `experiment` evaluates live experiment executions and can additionally map `expected_output` and `experiment_item_metadata`.
1818
It currently supports filtering by `datasetId`.
1919
Discover valid dataset IDs with `GET /api/public/v2/datasets`, then use the returned dataset `id` values in your filter.

0 commit comments

Comments
 (0)