Skip to content

Commit

Permalink
Revert "Add conditions and restraints to LLM prompt"
Browse files Browse the repository at this point in the history
This reverts commit 25a6e44.
  • Loading branch information
eriknovak committed Nov 9, 2024
1 parent 77307a3 commit 63a5589
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions anonipy/anonymize/generators/llm_label_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def generate(
},
{
"role": "user",
"content": f"What is a random {add_entity_attrs} {entity.label} replacement for {entity.text}? Respond only with the replacement, on additional information.",
"content": f"What is a random {add_entity_attrs} {entity.label} replacement for {entity.text}? Respond only with the replacement.",
},
]
return self._generate_response(message, temperature, top_p)
Expand Down Expand Up @@ -179,9 +179,5 @@ def _parse_response(self, response: str) -> str:
"""

res_match = re.search(r"assistant\s*(.*)", response, re.IGNORECASE | re.DOTALL)
tmp_response = res_match.group(1).strip() if res_match else response

res_match = re.search(r"\:\s*(.*)", tmp_response, re.IGNORECASE | re.DOTALL)

return
match = re.search(r"assistant\s*(.*)", response, re.IGNORECASE | re.DOTALL)
return match.group(1).strip() if match else response

0 comments on commit 63a5589

Please sign in to comment.