Skip to content

Commit a0b409b

Browse files
committed
chore: update client
1 parent 42e38c6 commit a0b409b

4 files changed

Lines changed: 37 additions & 6 deletions

File tree

langfuse/api/reference.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2419,7 +2419,7 @@ JSON string containing the query parameters with the following structure:
24192419
"metrics": [ // Required. At least one metric must be provided
24202420
{
24212421
"measure": string, // What to measure, e.g. "count", "latency", "value"
2422-
"aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95"
2422+
"aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95", "histogram"
24232423
}
24242424
],
24252425
"filters": [ // Optional. Default: []
@@ -2441,7 +2441,11 @@ JSON string containing the query parameters with the following structure:
24412441
"field": string, // Field to order by
24422442
"direction": string // "asc" or "desc"
24432443
}
2444-
]
2444+
],
2445+
"config": { // Optional. Query-specific configuration
2446+
"bins": number, // Optional. Number of bins for histogram (1-100), default: 10
2447+
"row_limit": number // Optional. Row limit for results (1-1000)
2448+
}
24452449
}
24462450
```
24472451

@@ -6024,6 +6028,14 @@ client.trace.list()
60246028
<dl>
60256029
<dd>
60266030

6031+
**fields:** `typing.Optional[str]` — Comma-separated list of fields to include in the response. Available field groups are 'core' (always included), 'io' (input, output, metadata), 'scores', 'observations', 'metrics'. If not provided, all fields are included. Example: 'core,scores,metrics'
6032+
6033+
</dd>
6034+
</dl>
6035+
6036+
<dl>
6037+
<dd>
6038+
60276039
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
60286040

60296041
</dd>

langfuse/api/resources/metrics/client.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def metrics(
4040
"metrics": [ // Required. At least one metric must be provided
4141
{
4242
"measure": string, // What to measure, e.g. "count", "latency", "value"
43-
"aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95"
43+
"aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95", "histogram"
4444
}
4545
],
4646
"filters": [ // Optional. Default: []
@@ -62,7 +62,11 @@ def metrics(
6262
"field": string, // Field to order by
6363
"direction": string // "asc" or "desc"
6464
}
65-
]
65+
],
66+
"config": { // Optional. Query-specific configuration
67+
"bins": number, // Optional. Number of bins for histogram (1-100), default: 10
68+
"row_limit": number // Optional. Row limit for results (1-1000)
69+
}
6670
}
6771
```
6872
@@ -147,7 +151,7 @@ async def metrics(
147151
"metrics": [ // Required. At least one metric must be provided
148152
{
149153
"measure": string, // What to measure, e.g. "count", "latency", "value"
150-
"aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95"
154+
"aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95", "histogram"
151155
}
152156
],
153157
"filters": [ // Optional. Default: []
@@ -169,7 +173,11 @@ async def metrics(
169173
"field": string, // Field to order by
170174
"direction": string // "asc" or "desc"
171175
}
172-
]
176+
],
177+
"config": { // Optional. Query-specific configuration
178+
"bins": number, // Optional. Number of bins for histogram (1-100), default: 10
179+
"row_limit": number // Optional. Row limit for results (1-1000)
180+
}
173181
}
174182
```
175183

langfuse/api/resources/metrics/types/metrics_response.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class MetricsResponse(pydantic_v1.BaseModel):
1212
"""
1313
The metrics data. Each item in the list contains the metric values and dimensions requested in the query.
1414
Format varies based on the query parameters.
15+
Histograms will return an array with [lower, upper, height] tuples.
1516
"""
1617

1718
def json(self, **kwargs: typing.Any) -> str:

langfuse/api/resources/trace/client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ def list(
172172
version: typing.Optional[str] = None,
173173
release: typing.Optional[str] = None,
174174
environment: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
175+
fields: typing.Optional[str] = None,
175176
request_options: typing.Optional[RequestOptions] = None,
176177
) -> Traces:
177178
"""
@@ -212,6 +213,9 @@ def list(
212213
environment : typing.Optional[typing.Union[str, typing.Sequence[str]]]
213214
Optional filter for traces where the environment is one of the provided values.
214215
216+
fields : typing.Optional[str]
217+
Comma-separated list of fields to include in the response. Available field groups are 'core' (always included), 'io' (input, output, metadata), 'scores', 'observations', 'metrics'. If not provided, all fields are included. Example: 'core,scores,metrics'
218+
215219
request_options : typing.Optional[RequestOptions]
216220
Request-specific configuration.
217221
@@ -253,6 +257,7 @@ def list(
253257
"version": version,
254258
"release": release,
255259
"environment": environment,
260+
"fields": fields,
256261
},
257262
request_options=request_options,
258263
)
@@ -518,6 +523,7 @@ async def list(
518523
version: typing.Optional[str] = None,
519524
release: typing.Optional[str] = None,
520525
environment: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
526+
fields: typing.Optional[str] = None,
521527
request_options: typing.Optional[RequestOptions] = None,
522528
) -> Traces:
523529
"""
@@ -558,6 +564,9 @@ async def list(
558564
environment : typing.Optional[typing.Union[str, typing.Sequence[str]]]
559565
Optional filter for traces where the environment is one of the provided values.
560566
567+
fields : typing.Optional[str]
568+
Comma-separated list of fields to include in the response. Available field groups are 'core' (always included), 'io' (input, output, metadata), 'scores', 'observations', 'metrics'. If not provided, all fields are included. Example: 'core,scores,metrics'
569+
561570
request_options : typing.Optional[RequestOptions]
562571
Request-specific configuration.
563572
@@ -607,6 +616,7 @@ async def main() -> None:
607616
"version": version,
608617
"release": release,
609618
"environment": environment,
619+
"fields": fields,
610620
},
611621
request_options=request_options,
612622
)

0 commit comments

Comments
 (0)