Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion langfuse/_client/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def _serialize(obj: Any) -> Optional[str]:
if obj is None or isinstance(obj, str):
return obj

return json.dumps(obj, cls=EventSerializer)
return json.dumps(obj, cls=EventSerializer, ensure_ascii=False)


def _flatten_and_serialize_metadata(
Expand Down
1 change: 1 addition & 0 deletions langfuse/_client/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def span_formatter(span: ReadableSpan) -> str:
"instrumentationScope": instrumentationScope,
},
indent=2,
ensure_ascii=False,
)
+ "\n"
)
4 changes: 2 additions & 2 deletions langfuse/_task_manager/score_ingestion_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def _next(self) -> list:

# check for serialization errors
try:
json.dumps(event, cls=EventSerializer)
json.dumps(event, cls=EventSerializer, ensure_ascii=False)
except Exception as e:
self._log.error(
f"Data error: Failed to serialize score object for ingestion. Score will be dropped. Error: {e}"
Expand Down Expand Up @@ -117,7 +117,7 @@ def _next(self) -> list:

def _get_item_size(self, item: Any) -> int:
"""Return the size of the item in bytes."""
return len(json.dumps(item, cls=EventSerializer).encode())
return len(json.dumps(item, cls=EventSerializer, ensure_ascii=False).encode())

def run(self) -> None:
"""Run the consumer."""
Expand Down
2 changes: 1 addition & 1 deletion langfuse/_utils/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def post(self, **kwargs: Any) -> httpx.Response:
"""Post the `kwargs` to the API"""
log = logging.getLogger("langfuse")
url = self._remove_trailing_slash(self._base_url) + "/api/public/ingestion"
data = json.dumps(kwargs, cls=EventSerializer)
data = json.dumps(kwargs, cls=EventSerializer, ensure_ascii=False)
log.debug("making request: %s to %s", data, url)
headers = self.generate_headers()
res = self._session.post(
Expand Down