From a0b409b93a918ea37f694593866cc38280fcf3a4 Mon Sep 17 00:00:00 2001
From: Hassieb Pakzad <68423100+hassiebp@users.noreply.github.com>
Date: Mon, 23 Jun 2025 11:38:51 +0200
Subject: [PATCH 1/3] chore: update client
---
langfuse/api/reference.md | 16 ++++++++++++++--
langfuse/api/resources/metrics/client.py | 16 ++++++++++++----
.../resources/metrics/types/metrics_response.py | 1 +
langfuse/api/resources/trace/client.py | 10 ++++++++++
4 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/langfuse/api/reference.md b/langfuse/api/reference.md
index 4b249b575..e5595df8c 100644
--- a/langfuse/api/reference.md
+++ b/langfuse/api/reference.md
@@ -2419,7 +2419,7 @@ JSON string containing the query parameters with the following structure:
"metrics": [ // Required. At least one metric must be provided
{
"measure": string, // What to measure, e.g. "count", "latency", "value"
- "aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95"
+ "aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95", "histogram"
}
],
"filters": [ // Optional. Default: []
@@ -2441,7 +2441,11 @@ JSON string containing the query parameters with the following structure:
"field": string, // Field to order by
"direction": string // "asc" or "desc"
}
- ]
+ ],
+ "config": { // Optional. Query-specific configuration
+ "bins": number, // Optional. Number of bins for histogram (1-100), default: 10
+ "row_limit": number // Optional. Row limit for results (1-1000)
+ }
}
```
@@ -6024,6 +6028,14 @@ client.trace.list()
-
+**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'
+
+
+
+
+
+-
+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
diff --git a/langfuse/api/resources/metrics/client.py b/langfuse/api/resources/metrics/client.py
index 0eb830717..f46dc75f2 100644
--- a/langfuse/api/resources/metrics/client.py
+++ b/langfuse/api/resources/metrics/client.py
@@ -40,7 +40,7 @@ def metrics(
"metrics": [ // Required. At least one metric must be provided
{
"measure": string, // What to measure, e.g. "count", "latency", "value"
- "aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95"
+ "aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95", "histogram"
}
],
"filters": [ // Optional. Default: []
@@ -62,7 +62,11 @@ def metrics(
"field": string, // Field to order by
"direction": string // "asc" or "desc"
}
- ]
+ ],
+ "config": { // Optional. Query-specific configuration
+ "bins": number, // Optional. Number of bins for histogram (1-100), default: 10
+ "row_limit": number // Optional. Row limit for results (1-1000)
+ }
}
```
@@ -147,7 +151,7 @@ async def metrics(
"metrics": [ // Required. At least one metric must be provided
{
"measure": string, // What to measure, e.g. "count", "latency", "value"
- "aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95"
+ "aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95", "histogram"
}
],
"filters": [ // Optional. Default: []
@@ -169,7 +173,11 @@ async def metrics(
"field": string, // Field to order by
"direction": string // "asc" or "desc"
}
- ]
+ ],
+ "config": { // Optional. Query-specific configuration
+ "bins": number, // Optional. Number of bins for histogram (1-100), default: 10
+ "row_limit": number // Optional. Row limit for results (1-1000)
+ }
}
```
diff --git a/langfuse/api/resources/metrics/types/metrics_response.py b/langfuse/api/resources/metrics/types/metrics_response.py
index ec1ecd97f..af0121c84 100644
--- a/langfuse/api/resources/metrics/types/metrics_response.py
+++ b/langfuse/api/resources/metrics/types/metrics_response.py
@@ -12,6 +12,7 @@ class MetricsResponse(pydantic_v1.BaseModel):
"""
The metrics data. Each item in the list contains the metric values and dimensions requested in the query.
Format varies based on the query parameters.
+ Histograms will return an array with [lower, upper, height] tuples.
"""
def json(self, **kwargs: typing.Any) -> str:
diff --git a/langfuse/api/resources/trace/client.py b/langfuse/api/resources/trace/client.py
index ece75f3a6..c73901123 100644
--- a/langfuse/api/resources/trace/client.py
+++ b/langfuse/api/resources/trace/client.py
@@ -172,6 +172,7 @@ def list(
version: typing.Optional[str] = None,
release: typing.Optional[str] = None,
environment: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
+ fields: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> Traces:
"""
@@ -212,6 +213,9 @@ def list(
environment : typing.Optional[typing.Union[str, typing.Sequence[str]]]
Optional filter for traces where the environment is one of the provided values.
+ 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'
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -253,6 +257,7 @@ def list(
"version": version,
"release": release,
"environment": environment,
+ "fields": fields,
},
request_options=request_options,
)
@@ -518,6 +523,7 @@ async def list(
version: typing.Optional[str] = None,
release: typing.Optional[str] = None,
environment: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
+ fields: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> Traces:
"""
@@ -558,6 +564,9 @@ async def list(
environment : typing.Optional[typing.Union[str, typing.Sequence[str]]]
Optional filter for traces where the environment is one of the provided values.
+ 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'
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -607,6 +616,7 @@ async def main() -> None:
"version": version,
"release": release,
"environment": environment,
+ "fields": fields,
},
request_options=request_options,
)
From 7ff538518cdcb6db81cda2c8390230641e5b367e Mon Sep 17 00:00:00 2001
From: Hassieb Pakzad <68423100+hassiebp@users.noreply.github.com>
Date: Mon, 23 Jun 2025 15:58:55 +0200
Subject: [PATCH 2/3] fix(client): use tracing_enabled in get_client (#1220)
---
langfuse/_client/get_client.py | 2 ++
langfuse/_client/resource_manager.py | 5 ++++-
tests/test_core_sdk.py | 2 +-
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/langfuse/_client/get_client.py b/langfuse/_client/get_client.py
index 2ce1d656c..f53886e46 100644
--- a/langfuse/_client/get_client.py
+++ b/langfuse/_client/get_client.py
@@ -65,6 +65,7 @@ def get_client(*, public_key: Optional[str] = None) -> Langfuse:
public_key=instance.public_key,
secret_key=instance.secret_key,
host=instance.host,
+ tracing_enabled=instance.tracing_enabled,
)
else:
@@ -94,4 +95,5 @@ def get_client(*, public_key: Optional[str] = None) -> Langfuse:
public_key=public_key,
secret_key=instance.secret_key,
host=instance.host,
+ tracing_enabled=instance.tracing_enabled,
)
diff --git a/langfuse/_client/resource_manager.py b/langfuse/_client/resource_manager.py
index 72b55b276..b0acd40d8 100644
--- a/langfuse/_client/resource_manager.py
+++ b/langfuse/_client/resource_manager.py
@@ -114,7 +114,9 @@ def __new__(
media_upload_thread_count=media_upload_thread_count,
sample_rate=sample_rate,
mask=mask,
- tracing_enabled=tracing_enabled if tracing_enabled is not None else True,
+ tracing_enabled=tracing_enabled
+ if tracing_enabled is not None
+ else True,
)
cls._instances[public_key] = instance
@@ -140,6 +142,7 @@ def _initialize_instance(
):
self.public_key = public_key
self.secret_key = secret_key
+ self.tracing_enabled = tracing_enabled
self.host = host
self.mask = mask
diff --git a/tests/test_core_sdk.py b/tests/test_core_sdk.py
index 914b2fb65..b519d5877 100644
--- a/tests/test_core_sdk.py
+++ b/tests/test_core_sdk.py
@@ -381,7 +381,7 @@ def test_create_generation():
assert generation_api.model_parameters == {
"max_tokens": "1000",
"temperature": "0.9",
- "stop": ["user-1", "user-2"],
+ "stop": '["user-1","user-2"]',
}
assert generation_api.input == [
{"role": "system", "content": "You are a helpful assistant."},
From 60d84995b7c67d426d748f3c7d3cc84d0effeae7 Mon Sep 17 00:00:00 2001
From: Hassieb Pakzad <68423100+hassiebp@users.noreply.github.com>
Date: Mon, 23 Jun 2025 19:10:08 +0200
Subject: [PATCH 3/3] chore: release v3.0.4
---
langfuse/version.py | 2 +-
pyproject.toml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/langfuse/version.py b/langfuse/version.py
index d9a263f00..92424380b 100644
--- a/langfuse/version.py
+++ b/langfuse/version.py
@@ -1,3 +1,3 @@
"""@private"""
-__version__ = "3.0.3"
+__version__ = "3.0.4"
diff --git a/pyproject.toml b/pyproject.toml
index 828041320..e9d342391 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,7 +1,7 @@
[tool.poetry]
name = "langfuse"
-version = "3.0.3"
+version = "3.0.4"
description = "A client library for accessing langfuse"
authors = ["langfuse "]
license = "MIT"
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy