From 9dd2ac2c74aa72da5e8cd4fda16c49d178a622a4 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 18 Dec 2024 16:05:31 -0800 Subject: [PATCH] Update documentation and tests to account for history handling change --- neon_data_models/models/api/llm.py | 3 ++- tests/models/api/test_llm.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/neon_data_models/models/api/llm.py b/neon_data_models/models/api/llm.py index 0ad8cea..ada21ba 100644 --- a/neon_data_models/models/api/llm.py +++ b/neon_data_models/models/api/llm.py @@ -95,7 +95,8 @@ class LLMRequest(BaseModel): "Mutually exclusive with `stream`.") max_history: int = Field( default=2, description="Maximum number of user/assistant " - "message pairs to include in history context.") + "message pairs to include in history context. " + "Excludes system prompt and incoming query.") @model_validator(mode='before') @classmethod diff --git a/tests/models/api/test_llm.py b/tests/models/api/test_llm.py index 8fe8ecf..9db702a 100644 --- a/tests/models/api/test_llm.py +++ b/tests/models/api/test_llm.py @@ -71,7 +71,9 @@ def test_llm_request(self): self.assertFalse(valid_request.beam_search) self.assertEqual(len(valid_request.history), len(test_history)) self.assertEqual(len(valid_request.to_completion_kwargs()['messages']), - 2 * valid_request.max_history + 1) + 2 * valid_request.max_history + 2) + self.assertEqual(valid_request.to_completion_kwargs()['messages'][-1], + test_query) # Valid explicit streaming streaming_request = LLMRequest(query=test_query, history=test_history,