Skip to content

Commit cb8ed4f

Browse files
committed
fixed eval output
1 parent 4aa747e commit cb8ed4f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

examples/graph_examples/graph_evaluation_example.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# Create the TrulensEvaluator instance
2828
trulens_evaluator = TrulensEvaluator(openai_key)
2929
# Evaluate SmartScraperGraph on the list of inputs
30-
results_df = trulens_evaluator.evaluate(list_of_inputs, dashboard=False)
30+
(results_df, answer) = trulens_evaluator.evaluate(list_of_inputs, dashboard=False)
3131

3232
# Print the results
33-
print(results_df)
33+
print(answer)

scrapegraphai/evaluators/trulens_evaluator.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ def __init__(self, key: str):
3333
app_id="smart_scraper_evaluator",
3434
feedbacks=[self.f_relevance,
3535
self.f_custom_function])
36+
37+
self.graph_output = []
3638

3739
def evaluate(self, graph_params: list[tuple[str, str, dict]], dashboard: bool = True):
3840
"""
@@ -44,14 +46,16 @@ def evaluate(self, graph_params: list[tuple[str, str, dict]], dashboard: bool =
4446
Returns:
4547
None
4648
"""
49+
4750
with self.tru_llm_standalone_recorder as recording:
4851
for params in graph_params:
4952
output = SmartScraperGraph(*params).run()
5053
self.tru_llm_standalone_recorder.app(params[0], output)
54+
self.graph_output.append(output)
5155
if dashboard:
5256
self.tru.run_dashboard()
5357
else:
54-
return self.tru.get_records_and_feedback(app_ids=[])[0]
58+
return (self.tru.get_records_and_feedback(app_ids=[])[0], self.graph_output)
5559

5660
def llm_standalone(self, prompt, response):
5761
"""

0 commit comments

Comments
 (0)