(*, content: str | None = "hi there", tool_calls: list | None = None,
choices: list | None = None)
| 52 | |
| 53 | |
| 54 | def _completion(*, content: str | None = "hi there", tool_calls: list | None = None, |
| 55 | choices: list | None = None) -> ChatResponse: |
| 56 | message: dict = {"role": "assistant"} |
| 57 | if content is not None: |
| 58 | message["content"] = content |
| 59 | if tool_calls is not None: |
| 60 | message["tool_calls"] = tool_calls |
| 61 | if choices is None: |
| 62 | choices = [{"index": 0, "message": message, "finish_reason": "stop"}] |
| 63 | return ChatResponse.openai_completion({ |
| 64 | "id": "chatcmpl-test", |
| 65 | "object": "chat.completion", |
| 66 | "created": 1700000000, |
| 67 | "model": "gpt-test", |
| 68 | "choices": choices, |
| 69 | "usage": {"prompt_tokens": 5, "completion_tokens": 3, "total_tokens": 8}, |
| 70 | }) |
| 71 | |
| 72 | |
| 73 | def _read_only_trace(log_dir: Path) -> dict: |
no test coverage detected