Skip to content

Commit 28b1e4e

Browse files
pjoshi30Preetam Joshi
andauthored
Updating tests (#11)
* Updating tests --------- Co-authored-by: Preetam Joshi <info@aimon.ai>
1 parent 4658cc9 commit 28b1e4e

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

aimon/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def detect(self, data_to_send: List[Dict[str, Any]], config=Config()):
186186
if 'config' not in item:
187187
item['config'] = config.detectors
188188
payload.append(item)
189-
response = requests.post(self.DETECTION_API_URL, json=payload, headers=headers, timeout=30)
189+
response = requests.post(self.DETECTION_API_URL, json=payload, headers=headers, timeout=90)
190190
if response.status_code in [503, 504]:
191191
raise RetryableError("Status code: {} received".format(response.status_code))
192192
if response.status_code == 401:

test/client_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def test_short_text_valid_response_hallucination_v0_2(self):
123123
config = Config({'hallucination_v0.2': 'default'})
124124
client = Client(api_key=API_KEY, email="preetam@aimon.ai")
125125
short_text = "Yes"
126-
data_to_send = [{"context": "This is the context", "generated_text": short_text}]
126+
data_to_send = [{"context": "This is the context", "user_query": "summarization", "generated_text": short_text}]
127127
response = client.detect(data_to_send, config=config)[0]
128128
assert "hallucination_v0.2" in response
129129
assert "is_hallucinated" in response['hallucination_v0.2']
@@ -138,7 +138,7 @@ def test_special_characters_valid_response_hallucination_v0_2(self):
138138
config = Config({'hallucination_v0.2': 'default'})
139139
client = Client(api_key=API_KEY, email="preetam@aimon.ai")
140140
special_text = "!@#$%^&*()_+"
141-
data_to_send = [{"context": "This is the context", "generated_text": special_text}]
141+
data_to_send = [{"context": "This is the context", "user_query": "summarization", "generated_text": special_text}]
142142
response = client.detect(data_to_send, config=config)[0]
143143
assert "hallucination_v0.2" in response
144144
assert "is_hallucinated" in response['hallucination_v0.2']
@@ -185,7 +185,6 @@ def test_valid_data_valid_response_instruction_adherence(self):
185185
assert "results" in response["instruction_adherence"]
186186
assert len(response["instruction_adherence"]["results"]) == 3
187187
assert "instruction" in response["instruction_adherence"]["results"][2]
188-
assert "examples" in response["instruction_adherence"]["results"][2]
189188
assert "detailed_explanation" in response["instruction_adherence"]["results"][2]
190189
assert "adherence" in response["instruction_adherence"]["results"][2]
191190
# print(response)

0 commit comments

Comments
 (0)