Skip to content

Commit

Permalink
Update code style
Browse files Browse the repository at this point in the history
  • Loading branch information
congminh1254 committed Jul 7, 2024
1 parent e95090e commit e502132
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
24 changes: 12 additions & 12 deletions test/integration_new/object/ai_itest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ def test_send_ai_question(parent_folder, small_file_path):
'content': 'The sun raises in the east.'
}]
answer = CLIENT.send_ai_question(
items=items,
items=items,
prompt='Which direction does the sun raise?',
mode='single_item_qa'
)
assert 'east' in answer['answer'].lower()
assert answer['completion_reason'] == 'done'


def test_send_ai_text_gen(parent_folder, small_file_path):
with BoxTestFile(parent_folder=parent_folder, file_path=small_file_path) as file:
items = [{
Expand All @@ -39,15 +39,15 @@ def test_send_ai_text_gen(parent_folder, small_file_path):
'content': 'The sun raises in the east.'
}]
dialogue_history = [{
'prompt': 'How does the sun rise?',
'answer': 'The sun raises in the east.',
'created_at': '2013-12-12T10:53:43-08:00'
},
{
'prompt': 'How many hours does it take for the sun to rise?',
'answer': 'It takes 24 hours for the sun to rise.',
'created_at': '2013-12-12T11:20:43-08:00'
}]
'prompt': 'How does the sun rise?',
'answer': 'The sun raises in the east.',
'created_at': '2013-12-12T10:53:43-08:00'
},
{
'prompt': 'How many hours does it take for the sun to rise?',
'answer': 'It takes 24 hours for the sun to rise.',
'created_at': '2013-12-12T11:20:43-08:00'
}]
answer = CLIENT.send_ai_text_gen(
dialogue_history=dialogue_history,
items=items,
Expand Down
22 changes: 11 additions & 11 deletions test/unit/client/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1928,9 +1928,9 @@ def test_send_ai_question(mock_client, mock_box_session, mock_ai_question_respon
}]
question = 'Why are public APIs important?'
mode = 'single_item_qa'

answer = mock_client.send_ai_question(items, question, mode)

mock_box_session.post.assert_called_once_with(expected_url, data=json.dumps({
'items': items,
'prompt': question,
Expand All @@ -1950,21 +1950,21 @@ def test_send_ai_text_gen(mock_client, mock_box_session, mock_ai_question_respon
'id': '12345'
}]
dialogue_history = [{
"prompt": "Make my email about public APIs sound more professional",
"answer": "Here is the first draft of your professional email about public APIs",
"created_at": "2013-12-12T10:53:43-08:00"
},
{
"prompt": "Can you add some more information?",
"answer": "Public API schemas provide necessary information to integrate with APIs...",
"created_at": "2013-12-12T11:20:43-08:00"
"prompt": "Make my email about public APIs sound more professional",
"answer": "Here is the first draft of your professional email about public APIs",
"created_at": "2013-12-12T10:53:43-08:00"
},
{
"prompt": "Can you add some more information?",
"answer": "Public API schemas provide necessary information to integrate with APIs...",
"created_at": "2013-12-12T11:20:43-08:00"
}]
answer = mock_client.send_ai_text_gen(
dialogue_history=dialogue_history,
items=items,
prompt="Write an email to a client about the importance of public APIs."
)

mock_box_session.post.assert_called_once_with(expected_url, data=json.dumps({
'dialogue_history': dialogue_history,
'items': items,
Expand Down

0 comments on commit e502132

Please sign in to comment.