MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / encode_sse_payload

Method encode_sse_payload

examples/server/server.py:7855–7864  ·  view source on GitHub ↗
(payload: BaseModel | Dict[str, Any])

Source from the content-addressed store, hash-verified

7853
7854 @staticmethod
7855 def encode_sse_payload(payload: BaseModel | Dict[str, Any]) -> bytes:
7856 data = (
7857 payload.model_dump(mode="json", exclude_none=True)
7858 if isinstance(payload, BaseModel)
7859 else payload
7860 )
7861 return (
7862 "data: "
7863 f"{json.dumps(data, ensure_ascii=False, separators=(',', ':'))}\n\n"
7864 ).encode("utf-8")
7865
7866 @staticmethod
7867 def next_stream_chunk(

Callers 2

stream_sse_chunksFunction · 0.80
stream_sse_outputsFunction · 0.80

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected