(
*,
content: str | None = None,
finish_reason: str | None = None,
)
| 42 | |
| 43 | |
| 44 | def _chat_chunk( |
| 45 | *, |
| 46 | content: str | None = None, |
| 47 | finish_reason: str | None = None, |
| 48 | ) -> ChatCompletionChunk: |
| 49 | delta: dict[str, Any] = {} |
| 50 | if content is not None: |
| 51 | delta["content"] = content |
| 52 | return ChatCompletionChunk.model_validate( |
| 53 | { |
| 54 | "id": "chatcmpl-test", |
| 55 | "object": "chat.completion.chunk", |
| 56 | "created": 1700000000, |
| 57 | "model": "backend-model", |
| 58 | "choices": [ |
| 59 | { |
| 60 | "index": 0, |
| 61 | "delta": delta, |
| 62 | "finish_reason": finish_reason, |
| 63 | } |
| 64 | ], |
| 65 | } |
| 66 | ) |
| 67 | |
| 68 | |
| 69 | def _chat_tool_chunk( |
no outgoing calls
no test coverage detected