diff options
| author | tanaka takashi <isazaka@gmail.com> | 2026-07-09 19:52:03 +0900 |
|---|---|---|
| committer | tanaka takashi <isazaka@gmail.com> | 2026-07-09 19:52:03 +0900 |
| commit | 77eef27cad9b0e5b0551d5a8ea9485779ee7dc18 (patch) | |
| tree | 31adca93be2c5bb7f8b43613df2fd438a897de25 /tests/test_llm.py | |
| parent | b4f3c99a7d458d32517077ef77b0e5676020b9a2 (diff) | |
停止ボタンの不具合修正(停止ボタンを押すと送信できなくなるバグを修正)
LLMがメッセージ生成途上で画面スクロールしにくい問題を修正
チャットメッセージバルーンをコピペ対応
トークン消費量をリングゲージで可視化(表示タイミングに不具合あり)
Diffstat (limited to 'tests/test_llm.py')
| -rw-r--r-- | tests/test_llm.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_llm.py b/tests/test_llm.py index cbb9910..3002a77 100644 --- a/tests/test_llm.py +++ b/tests/test_llm.py @@ -12,6 +12,7 @@ from ollama._types import ResponseError from ollama_web.llm import ( _embed_images_in_content, _is_image_message, + _token_counts, chat_with_tools, stream_chat_with_tools, ) @@ -81,3 +82,26 @@ def test_stream_chat_with_tools_accepts_capability_set() -> None: ) with pytest.raises(ResponseError): list(gen) + + +def test_token_counts_extracts_from_dict() -> None: + assert _token_counts({"prompt_eval_count": 100, "eval_count": 50}) == { + "prompt_eval_count": 100, + "eval_count": 50, + } + + +def test_token_counts_extracts_from_object() -> None: + class FakeResp: + prompt_eval_count = 200 + eval_count = 30 + + assert _token_counts(FakeResp()) == { + "prompt_eval_count": 200, + "eval_count": 30, + } + + +def test_token_counts_returns_none_when_missing() -> None: + assert _token_counts({}) is None + assert _token_counts(None) is None
\ No newline at end of file |
