Replies: 1 comment
|
The issue you're experiencing is that the Instead, you should use the Step 1: Query scores with your filter criteria url = f"{settings.langfuse_host}/api/public/v2/scores"
params = {
'page': page,
'limit': limit,
'name': 'toxicity',
'operator': '>',
'value': 0.01,
'dataType': 'NUMERIC'
}
response = requests.get(url, headers=headers, params=params)
scores_data = response.json()Step 2: Extract trace IDs from the scores response trace_ids = [score['traceId'] for score in scores_data['data']]Step 3: Fetch individual traces for trace_id in trace_ids:
trace_url = f"{settings.langfuse_host}/api/public/traces/{trace_id}"
trace_response = requests.get(trace_url, headers=headers)
# Process trace dataImportant Note: There is a known open issue with the scores API operator parameter where filtering with certain operators (particularly Alternatively, you can use the Langfuse Python SDK which provides a more convenient interface: from langfuse import Langfuse
langfuse = Langfuse()
# This approach is recommended in the documentation
trace = langfuse.get_trace(trace_id)
scores = trace["scores"]📚 Sources:
Have another question? Just tag @inkeep. |
Uh oh!
There was an error while loading. Please reload this page.
This is my code snippet.
I am getting this error
I am using Langfuse v3.117.2
Does anyone know how to solve this ? Thank you
All reactions