From 39a0d521e9a7dbc5efdf60e9a97e7e163bc3db55 Mon Sep 17 00:00:00 2001 From: siyunzhao Date: Thu, 7 Mar 2024 08:39:38 +0000 Subject: [PATCH] update unittest data --- tests/test_llmlingua.py | 16 +++++++++------- tests/test_longllmlingua.py | 14 +++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/tests/test_llmlingua.py b/tests/test_llmlingua.py index 59302a7..0416f1e 100644 --- a/tests/test_llmlingua.py +++ b/tests/test_llmlingua.py @@ -36,16 +36,18 @@ class LLMLinguaTester(unittest.TestCase): "id": "987654", "name": "John Doe", "isActive": "true", - "biography": " Doe, born in York in 1985 a renowned engineer with over the field.John from MIT and has since worked with several.He has a for developing innovative solutions and has to numerous projectsJohn is also avid and speaker at conferences, his on and their the business.In his enjoys, reading fiction and playing piano.", + "biography": " Doe, born in York in 1985 a renowned engineer with over in the field. John from MIT a Science and has since worked with several He has a for developing innovative solutions and has to numerous projects John is also avid and speaker at conferences, his on technologies and their the business. In his enjoys, reading fiction and playing piano.", "employmentHistory": [ { "company": "TechCorp", - "role": "Senior", - "description": " John was for leading of engineers and of scalable.He in the of cloud technologies, significantly the of their digital operations."}, + "role": "Senior Engineer", + "description": " John was for leading of engineers and of scalable He in the of cloud technologies company, significantly the of their digital operations." + }, { "company": "Innovatech", "role": "Lead", - "description": "In his John on developingedge AI and implementing learning solutions for various was in developing a predictive analytics tool that transformed the company's approach to data-driven decision making."} + "description": "In his John on developingedge AI and implementing machine learning solutions for various business applications. He was instrumental in developing a predictive analytics tool that transformed the company's approach to data-driven decision making." + } ], "skills": "Java, Python, Machine Learning, Cloud Computing, AI Development" }""" @@ -109,9 +111,9 @@ def test_general_structured_compress_prompt(self): self.JSON_COMPRESSED_PROMPT, ) self.assertEqual(compressed_prompt["origin_tokens"], 318) - self.assertEqual(compressed_prompt["compressed_tokens"], 225) - self.assertEqual(compressed_prompt["ratio"], "1.4x") - self.assertEqual(compressed_prompt["rate"], "70.8%") + self.assertEqual(compressed_prompt["compressed_tokens"], 241) + self.assertEqual(compressed_prompt["ratio"], "1.3x") + self.assertEqual(compressed_prompt["rate"], "75.8%") # Multiple Stuctured Context compressed_prompt = self.llmlingua.structured_compress_prompt( diff --git a/tests/test_longllmlingua.py b/tests/test_longllmlingua.py index 9b5fc5b..7fe906c 100644 --- a/tests/test_longllmlingua.py +++ b/tests/test_longllmlingua.py @@ -37,17 +37,17 @@ class LongLLMLinguaTester(unittest.TestCase): "id": "765", "name": " Doe", "isActive": "true", - "biography": "John York is a software years experience in the. MIT with degree Science and has worked with several Fortune companies He developing solutions and projects is and speaker tech conferences emerging business world. In his time, enjoys, reading, playing.", + "biography": "John York is a software years experience in the. MIT with degree Science and has worked with several Fortune companies He developing solutions and projects is and speaker tech conferences emerging business world. ", "employmentHistory": [ { "company": "TechCorp", "role": "", - "description": " Tech, was leading software engineers overseeing web played key the cloud technologies within the company, significantly enhancing their digital." + "description": " Tech, was leading software engineers overseeing web played key the cloud technologies within the company, significantly enhancing their digital operations." }, { "company": "Innovatech", "role": "", - "description": " role developingedge AI implementing machine learning solutions for various business applications. He was instrumental in developing a predictive analytics tool that transformed the company's approach to data-driven decision making." + "description": " his role developingedge AI implementing learning for He was developing a analytics tool transformed the company's approach to data-driven decision making." } ], "skills": "Java, Python, Machine Learning, Cloud Computing, AI Development" @@ -121,7 +121,7 @@ def test_general_structured_compress_prompt(self): [self.JSON_PROMPT], question=self.STRUCTURED_QUESTION, target_token=150, - use_sentence_level_filter=False, + use_sentence_level_filter=True, condition_in_question="after_condition", reorder_context="sort", dynamic_context_compression_ratio=0.4, @@ -136,9 +136,9 @@ def test_general_structured_compress_prompt(self): self.JSON_COMPRESSED_PROMPT, ) self.assertEqual(compressed_prompt["origin_tokens"], 329) - self.assertEqual(compressed_prompt["compressed_tokens"], 205) - self.assertEqual(compressed_prompt["ratio"], "1.6x") - self.assertEqual(compressed_prompt["rate"], "62.3%") + self.assertEqual(compressed_prompt["compressed_tokens"], 188) + self.assertEqual(compressed_prompt["ratio"], "1.8x") + self.assertEqual(compressed_prompt["rate"], "57.1%") # Multiple Stuctured Context compressed_prompt = self.llmlingua.structured_compress_prompt(