Skip to content

Commit

Permalink
update unittest data
Browse files Browse the repository at this point in the history
  • Loading branch information
SiyunZhao committed Mar 7, 2024
1 parent 717248e commit 39a0d52
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
16 changes: 9 additions & 7 deletions tests/test_llmlingua.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}"""
Expand Down Expand Up @@ -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(
Expand Down
14 changes: 7 additions & 7 deletions tests/test_longllmlingua.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand All @@ -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(
Expand Down

0 comments on commit 39a0d52

Please sign in to comment.