mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-16 06:53:47 +00:00
remove prints, cleanup braintrust in this branch
This commit is contained in:
parent
9b410a87bf
commit
91e5ad18b0
6 changed files with 45 additions and 33 deletions
|
@ -77,7 +77,6 @@ async def test_eval(eval_settings):
|
|||
|
||||
eval_response = await eval_impl.job_result(response.job_id)
|
||||
|
||||
print(eval_response)
|
||||
assert eval_response is not None
|
||||
assert len(eval_response.generations) == 5
|
||||
assert "meta-reference::subset_of" in eval_response.scores
|
||||
|
|
|
@ -55,6 +55,47 @@ async def test_scoring_functions_list(scoring_settings):
|
|||
assert "meta-reference::llm_as_judge_8b_correctness" in function_ids
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_scoring_functions_register(scoring_settings):
|
||||
scoring_impl = scoring_settings["scoring_impl"]
|
||||
scoring_functions_impl = scoring_settings["scoring_functions_impl"]
|
||||
datasets_impl = scoring_settings["datasets_impl"]
|
||||
test_prompt = """Output a number between 0 to 10. Your answer must match the format \n Number: <answer>"""
|
||||
# register the scoring function
|
||||
await scoring_functions_impl.register_scoring_function(
|
||||
ScoringFnDefWithProvider(
|
||||
identifier="meta-reference::llm_as_judge_8b_random",
|
||||
description="Llm As Judge Scoring Function",
|
||||
parameters=[],
|
||||
return_type=NumberType(),
|
||||
context=LLMAsJudgeContext(
|
||||
prompt_template=test_prompt,
|
||||
judge_model="Llama3.1-8B-Instruct",
|
||||
judge_score_regex=[r"Number: (\d+)"],
|
||||
),
|
||||
provider_id="test-meta",
|
||||
)
|
||||
)
|
||||
|
||||
scoring_functions = await scoring_functions_impl.list_scoring_functions()
|
||||
assert isinstance(scoring_functions, list)
|
||||
assert len(scoring_functions) > 0
|
||||
function_ids = [f.identifier for f in scoring_functions]
|
||||
assert "meta-reference::llm_as_judge_8b_random" in function_ids
|
||||
|
||||
# test score using newly registered scoring function
|
||||
await register_dataset(datasets_impl)
|
||||
response = await datasets_impl.list_datasets()
|
||||
assert len(response) == 1
|
||||
response = await scoring_impl.score_batch(
|
||||
dataset_id=response[0].identifier,
|
||||
scoring_functions=[
|
||||
"meta-reference::llm_as_judge_8b_random",
|
||||
],
|
||||
)
|
||||
assert "meta-reference::llm_as_judge_8b_random" in response.results
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_scoring_score(scoring_settings):
|
||||
scoring_impl = scoring_settings["scoring_impl"]
|
||||
|
@ -73,7 +114,6 @@ async def test_scoring_score(scoring_settings):
|
|||
],
|
||||
)
|
||||
|
||||
print(response)
|
||||
assert len(response.results) == 3
|
||||
assert "meta-reference::equality" in response.results
|
||||
assert "meta-reference::subset_of" in response.results
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue