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

Method _chat_chunk_payload

examples/server/server.py:7588–7611  ·  view source on GitHub ↗
(
        *,
        chunk_id: str,
        created: int,
        model: str,
        index: int,
        delta: Dict[str, Any],
        finish_reason: Optional[str],
        logprobs: Optional[Dict[str, Any]] = None,
    )

Source from the content-addressed store, hash-verified

7586
7587 @staticmethod
7588 def _chat_chunk_payload(
7589 *,
7590 chunk_id: str,
7591 created: int,
7592 model: str,
7593 index: int,
7594 delta: Dict[str, Any],
7595 finish_reason: Optional[str],
7596 logprobs: Optional[Dict[str, Any]] = None,
7597 ) -> Dict[str, Any]:
7598 choice: Dict[str, Any] = {
7599 "index": index,
7600 "delta": delta,
7601 "finish_reason": finish_reason,
7602 }
7603 if logprobs is not None:
7604 choice["logprobs"] = logprobs
7605 return {
7606 "id": "chat" + chunk_id,
7607 "object": "chat.completion.chunk",
7608 "created": created,
7609 "model": model,
7610 "choices": [choice],
7611 }
7612
7613 def _chunk_payloads(
7614 self,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected