Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions langfuse/api/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -7207,6 +7207,14 @@ client.score_v_2.get()
<dl>
<dd>

**filter:** `typing.Optional[str]` — A JSON stringified array of filter objects. Each object requires type, column, operator, and value. Supports filtering by score metadata using the stringObject type. Example: [{"type":"stringObject","column":"metadata","key":"user_id","operator":"=","value":"abc123"}]. Supported types: stringObject (metadata key-value filtering), string, number, datetime, stringOptions, arrayOptions. Supported operators for stringObject: =, contains, does not contain, starts with, ends with.

</dd>
</dl>
Comment on lines 7207 to +7213
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ambiguous filter format

The docs say filter is a “JSON stringified array” but the example is shown as a raw JSON array ([{...}]). That mismatch will confuse users and leads to incorrect requests (passing an array instead of a string, or vice versa). Please either (a) show the example as a quoted string (e.g. '[{"type":...}]') or (b) change the type/wording to indicate it accepts an array/object rather than a string.


<dl>
<dd>

**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.

</dd>
Expand Down
10 changes: 10 additions & 0 deletions langfuse/api/resources/score_v_2/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def get(
data_type: typing.Optional[ScoreDataType] = None,
trace_tags: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
fields: typing.Optional[str] = None,
filter: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> GetScoresResponse:
"""
Expand Down Expand Up @@ -115,6 +116,9 @@ def get(
fields : typing.Optional[str]
Comma-separated list of field groups to include in the response. Available field groups: 'score' (core score fields), 'trace' (trace properties: userId, tags, environment). If not specified, both 'score' and 'trace' are returned by default. Example: 'score' to exclude trace data, 'score,trace' to include both. Note: When filtering by trace properties (using userId or traceTags parameters), the 'trace' field group must be included, otherwise a 400 error will be returned.

filter : typing.Optional[str]
A JSON stringified array of filter objects. Each object requires type, column, operator, and value. Supports filtering by score metadata using the stringObject type. Example: [{"type":"stringObject","column":"metadata","key":"user_id","operator":"=","value":"abc123"}]. Supported types: stringObject (metadata key-value filtering), string, number, datetime, stringOptions, arrayOptions. Supported operators for stringObject: =, contains, does not contain, starts with, ends with.

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Expand Down Expand Up @@ -164,6 +168,7 @@ def get(
"dataType": data_type,
"traceTags": trace_tags,
"fields": fields,
"filter": filter,
},
request_options=request_options,
)
Expand Down Expand Up @@ -286,6 +291,7 @@ async def get(
data_type: typing.Optional[ScoreDataType] = None,
trace_tags: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
fields: typing.Optional[str] = None,
filter: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> GetScoresResponse:
"""
Expand Down Expand Up @@ -353,6 +359,9 @@ async def get(
fields : typing.Optional[str]
Comma-separated list of field groups to include in the response. Available field groups: 'score' (core score fields), 'trace' (trace properties: userId, tags, environment). If not specified, both 'score' and 'trace' are returned by default. Example: 'score' to exclude trace data, 'score,trace' to include both. Note: When filtering by trace properties (using userId or traceTags parameters), the 'trace' field group must be included, otherwise a 400 error will be returned.

filter : typing.Optional[str]
A JSON stringified array of filter objects. Each object requires type, column, operator, and value. Supports filtering by score metadata using the stringObject type. Example: [{"type":"stringObject","column":"metadata","key":"user_id","operator":"=","value":"abc123"}]. Supported types: stringObject (metadata key-value filtering), string, number, datetime, stringOptions, arrayOptions. Supported operators for stringObject: =, contains, does not contain, starts with, ends with.

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Expand Down Expand Up @@ -410,6 +419,7 @@ async def main() -> None:
"dataType": data_type,
"traceTags": trace_tags,
"fields": fields,
"filter": filter,
},
request_options=request_options,
)
Expand Down
Loading