Added a few fixes and refactored the base app
This commit is contained in:
parent
81b8fd923c
commit
9936248942
2 changed files with 29 additions and 10 deletions
|
|
@ -28,6 +28,7 @@ class TestOutput(Base):
|
||||||
user_id = Column(String, ForeignKey('users.id'), index=True) # Added user_id field
|
user_id = Column(String, ForeignKey('users.id'), index=True) # Added user_id field
|
||||||
test_set_id = Column(String, ForeignKey('test_sets.id'), index=True)
|
test_set_id = Column(String, ForeignKey('test_sets.id'), index=True)
|
||||||
operation_id = Column(String, ForeignKey('operations.id'), index=True)
|
operation_id = Column(String, ForeignKey('operations.id'), index=True)
|
||||||
|
test_params= Column(String, nullable=True)
|
||||||
test_result = Column(String, nullable=True)
|
test_result = Column(String, nullable=True)
|
||||||
test_score = Column(String, nullable=True)
|
test_score = Column(String, nullable=True)
|
||||||
test_metric_name = Column(String, nullable=True)
|
test_metric_name = Column(String, nullable=True)
|
||||||
|
|
|
||||||
|
|
@ -407,22 +407,40 @@ async def start_test(data, test_set=None, user_id=None, params=None, job_id=None
|
||||||
|
|
||||||
if retriever_type:
|
if retriever_type:
|
||||||
test_id, result = await run_test(test=None, loader_settings=loader_settings, metadata=metadata,
|
test_id, result = await run_test(test=None, loader_settings=loader_settings, metadata=metadata,
|
||||||
retriever_type=retriever_type)
|
retriever_type=retriever_type) # No params for this case
|
||||||
results.append(result)
|
results.append([result, "No params"])
|
||||||
|
|
||||||
for param in test_params:
|
for param in test_params:
|
||||||
test_id, result = await run_test(param, loader_settings, metadata, retriever_type=retriever_type)
|
test_id, result = await run_test(param, loader_settings, metadata, retriever_type=retriever_type) # Add the params to the result
|
||||||
results.append(result)
|
results.append([result, param])
|
||||||
|
|
||||||
|
for b, r in results:
|
||||||
|
print("Here is the result", r)
|
||||||
|
for result_list in b:
|
||||||
|
for result in result_list:
|
||||||
|
print("here is the result", result)
|
||||||
|
|
||||||
for result_list in results[0]:
|
# for result_list in results[0]:
|
||||||
for result in result_list:
|
# for result in result_list:
|
||||||
print("Here is one result", result)
|
|
||||||
await add_entity(session, TestOutput(id=test_id , test_set_id=test_set_id, operation_id=job_id, set_id=str(uuid.uuid4()), user_id=user_id, test_results=result['success'], test_score=str(result['score']), test_metric_name=result['metric_name'], test_query=result['query'], test_output=result['output'], test_expected_output=str(['expected_output']), test_context=result['context'][0]))
|
|
||||||
|
|
||||||
print(results)
|
print("Here is one result", result)
|
||||||
|
await add_entity(session, TestOutput(
|
||||||
|
id=test_id,
|
||||||
|
test_set_id=test_set_id,
|
||||||
|
operation_id=job_id,
|
||||||
|
set_id=str(uuid.uuid4()),
|
||||||
|
user_id=user_id,
|
||||||
|
test_results=result['success'],
|
||||||
|
test_score=str(result['score']),
|
||||||
|
test_metric_name=result['metric_name'],
|
||||||
|
test_query=result['query'],
|
||||||
|
test_output=result['output'],
|
||||||
|
test_expected_output=str(['expected_output']),
|
||||||
|
test_context=result['context'][0],
|
||||||
|
test_params=str(r) # Add params to the database table
|
||||||
|
))
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue