Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Fixes]: Release Cycle 63 #2302

Merged
merged 16 commits into from
Nov 27, 2024
Merged
Changes from 4 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 30 additions & 8 deletions agenta-backend/agenta_backend/services/evaluators_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -947,12 +947,23 @@ async def rag_faithfulness(
)

# Turn distributed trace into trace tree
trace = process_distributed_trace_into_trace_tree(output["trace"])
trace = {}
version = output.get("version")
if version == "3.0":
trace = output.get("tree", {})
elif version == "2.0":
trace = output.get("trace", {})

trace = process_distributed_trace_into_trace_tree(trace, version)

# Get value of required keys for rag evaluator
question_val: Any = get_field_value_from_trace_tree(trace, question_key)
answer_val: Any = get_field_value_from_trace_tree(trace, answer_key)
contexts_val: Any = get_field_value_from_trace_tree(trace, contexts_key)
question_val: Any = get_field_value_from_trace_tree(
trace, question_key, version
)
answer_val: Any = get_field_value_from_trace_tree(trace, answer_key, version)
contexts_val: Any = get_field_value_from_trace_tree(
trace, contexts_key, version
)

if None in [question_val, answer_val, contexts_val]:
logging.error(
Expand Down Expand Up @@ -1048,12 +1059,23 @@ async def rag_context_relevancy(
)

# Turn distributed trace into trace tree
trace = process_distributed_trace_into_trace_tree(output["trace"])
trace = {}
version = output.get("version")
if version == "3.0":
trace = output.get("tree", {})
elif version == "2.0":
trace = output.get("trace", {})

trace = process_distributed_trace_into_trace_tree(trace, version)

# Get value of required keys for rag evaluator
question_val: Any = get_field_value_from_trace_tree(trace, question_key)
answer_val: Any = get_field_value_from_trace_tree(trace, answer_key)
contexts_val: Any = get_field_value_from_trace_tree(trace, contexts_key)
question_val: Any = get_field_value_from_trace_tree(
trace, question_key, version
)
answer_val: Any = get_field_value_from_trace_tree(trace, answer_key, version)
contexts_val: Any = get_field_value_from_trace_tree(
trace, contexts_key, version
)

if None in [question_val, answer_val, contexts_val]:
logging.error(
Expand Down
Loading