ccproxy.services.adapters.chat_accumulator¶
ccproxy.services.adapters.chat_accumulator
¶
ChatCompletion accumulator for OpenAI streaming format.
ChatCompletionAccumulator
¶
Accumulator for OpenAI ChatCompletion streaming format.
Handles partial tool calls and other streaming data by accumulating chunks until complete objects are ready for validation.
Follows the OpenAI SDK ChatCompletionStreamManager pattern.
Source code in ccproxy/services/adapters/chat_accumulator.py
accumulate_chunk
¶
Accumulate a streaming chunk and return complete object if ready.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chunk
|
dict[str, Any]
|
The incoming stream chunk data |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
None if accumulation is ongoing, or the complete object when ready |
dict[str, Any] | None
|
for validation |