Skip to content

Commit

Permalink
style: Run black
Browse files Browse the repository at this point in the history
  • Loading branch information
kdestin committed Oct 25, 2024
1 parent e41f69d commit 43a38d7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ async def __call__(
template_parameters = completed_task.get("template_parameters", {}) # type: ignore
xpia_attack_type = template_parameters.get("xpia_attack_type", "") # type: ignore
action = template_parameters.get("action", "") # type: ignore
document_type = template_parameters.get("document_type", "") # type: ignore
document_type = template_parameters.get("document_type", "") # type: ignore
sim_results.append(
{
"messages": completed_task["messages"], # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ async def _simulate_with_predefined_turns(
assistant_response, assistant_context = await self._get_target_response(
target=target, api_call_delay_sec=api_call_delay_sec, conversation_history=current_simulation
)
assistant_turn = Turn(role=ConversationRole.ASSISTANT, content=assistant_response, context=assistant_context)
assistant_turn = Turn(
role=ConversationRole.ASSISTANT, content=assistant_response, context=assistant_context
)
current_simulation.add_to_history(assistant_turn)
progress_bar.update(1) # Update progress bar for both user and assistant turns

Expand Down Expand Up @@ -305,7 +307,9 @@ async def _extend_conversation_with_simulator(
assistant_response, assistant_context = await self._get_target_response(
target=target, api_call_delay_sec=api_call_delay_sec, conversation_history=current_simulation
)
assistant_turn = Turn(role=ConversationRole.ASSISTANT, content=assistant_response, context=assistant_context)
assistant_turn = Turn(
role=ConversationRole.ASSISTANT, content=assistant_response, context=assistant_context
)
current_simulation.add_to_history(assistant_turn)
progress_bar.update(1)

Expand Down Expand Up @@ -642,7 +646,9 @@ async def _complete_conversation(
assistant_response, assistant_context = await self._get_target_response(
target=target, api_call_delay_sec=api_call_delay_sec, conversation_history=conversation_history
)
assistant_turn = Turn(role=ConversationRole.ASSISTANT, content=assistant_response, context=assistant_context)
assistant_turn = Turn(
role=ConversationRole.ASSISTANT, content=assistant_response, context=assistant_context
)
conversation_history.add_to_history(assistant_turn)
progress_bar.update(1)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,17 @@ def test_retrieval_evaluator_keys(self, mock_model_config):
conversation = {
"messages": [
{"role": "user", "content": "What is the value of 2 + 2?"},
{"role": "assistant", "content": "2 + 2 = 4", "context": {
"citations": [
{
"role": "assistant",
"content": "2 + 2 = 4",
"context": {
"citations": [
{"id": "math_doc.md", "content": "Information about additions: 1 + 2 = 3, 2 + 2 = 4"}
]
}
}
},
},
]
}

result = retrieval_eval(conversation=conversation)
assert result["retrieval"] == result["gpt_retrieval"] == 1
assert result["retrieval"] == result["gpt_retrieval"] == 1

0 comments on commit 43a38d7

Please sign in to comment.