MCPcopy Index your code
hub / github.com/google/adk-python / _encode_chunk_to_json

Function _encode_chunk_to_json

src/google/adk/cli/fast_api.py:788–795  ·  view source on GitHub ↗

Encodes a chunk to a JSON string with a newline.

(chunk: Any)

Source from the content-addressed store, hash-verified

786 adk_app._tmpl_attrs["artifact_service"] = artifact_service
787
788 def _encode_chunk_to_json(chunk: Any) -> str | None:
789 """Encodes a chunk to a JSON string with a newline."""
790 try:
791 json_chunk = jsonable_encoder(chunk)
792 return f"{json.dumps(json_chunk)}\n"
793 except Exception:
794 logging.exception("Failed to encode chunk")
795 return None
796
797 async def json_generator(output: AsyncIterator[Any]) -> AsyncIterator[str]:
798 async for chunk in output:

Callers 1

json_generatorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected