mirror of
https://github.com/lightbroker/llmsecops-research.git
synced 2026-08-04 02:18:38 +02:00
add test 0 results
This commit is contained in:
@@ -14,7 +14,7 @@ class TestRunLoggingService(AbstractTestRunLoggingService):
|
||||
def __init__(self, test_id: int):
|
||||
self._lock = threading.Lock()
|
||||
timestamp = calendar.timegm(time.gmtime())
|
||||
self.log_file_path = f"./tests/logs/test_{test_id}_logs_{timestamp}.json"
|
||||
self.log_file_path = f"./tests/logs/test_{test_id}/test_{test_id}_logs_{timestamp}.json"
|
||||
self._ensure_log_file_exists()
|
||||
|
||||
def _ensure_log_file_exists(self):
|
||||
|
||||
@@ -17,6 +17,8 @@ class SemanticSimilarityService(AbstractSemanticSimilarityService):
|
||||
self.constants = Constants()
|
||||
|
||||
def use_comparison_texts(self, comparison_texts: list[str]):
|
||||
if not comparison_texts:
|
||||
raise ValueError('Comparison texts collection cannot be empty')
|
||||
self.comparison_texts = comparison_texts
|
||||
|
||||
def analyze(self, text: str) -> AbstractSemanticSimilarityResult:
|
||||
@@ -25,7 +27,11 @@ class SemanticSimilarityService(AbstractSemanticSimilarityService):
|
||||
orthogonal is 0;
|
||||
opposite is -1
|
||||
"""
|
||||
print(f'===== Using {len(self.comparison_texts)} comparison texts')
|
||||
|
||||
if not self.comparison_texts:
|
||||
raise ValueError('Comparison texts are required')
|
||||
|
||||
print(f'Using {len(self.comparison_texts)} comparison texts')
|
||||
query_embedding = array(self.embeddings.embed_query(text)).reshape(1, -1)
|
||||
doc_embeddings = array(self.embeddings.embed_documents(self.comparison_texts))
|
||||
|
||||
|
||||
@@ -124,7 +124,6 @@ class TextGenerationCompletionService(
|
||||
active_params = {}
|
||||
if hasattr(pipeline_obj.model, 'generation_config'):
|
||||
gen_config = pipeline_obj.model.generation_config
|
||||
print(gen_config)
|
||||
active_params.update({
|
||||
'temperature': getattr(gen_config, 'temperature', None),
|
||||
'top_p': getattr(gen_config, 'top_p', None),
|
||||
|
||||
Reference in New Issue
Block a user