MCPcopy Index your code
hub / github.com/abetlen/llama-cpp-python / _stream_state_complete

Method _stream_state_complete

examples/server/server.py:7562–7585  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

7560 return self._parsed_chat_message(parsed=parsed, partial=partial)
7561
7562 def _stream_state_complete(self) -> bool:
7563 if self._stream_plan is None:
7564 return False
7565 if self._direct.deltas:
7566 return (
7567 not self._direct.pending
7568 and self._direct.mode in {self.DIRECT_MODE_CONTENT, self.DIRECT_MODE_AFTER_TOOL_ITEM}
7569 )
7570 if self._stream_state is None:
7571 return False
7572 if self._stream_plan["kind"] == "json-root":
7573 return True
7574 if self._stream_plan["kind"] == "segment-message":
7575 return (
7576 not self._stream_state.pending
7577 and self._stream_state.current_item is None
7578 and self._stream_state.current_segment is None
7579 and self._stream_state.mode == "segment-start"
7580 )
7581 return (
7582 not self._stream_state.pending
7583 and self._stream_state.current_item is None
7584 and self._stream_state.mode in {"content", "after-tool-item"}
7585 )
7586
7587 @staticmethod
7588 def _chat_chunk_payload(

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected