File tree Expand file tree Collapse file tree 3 files changed +30
-14
lines changed Expand file tree Collapse file tree 3 files changed +30
-14
lines changed Original file line number Diff line number Diff line change @@ -522,19 +522,11 @@ def handle_batch_response(
522
522
"""
523
523
output_messages : List [BaseMessage ] = []
524
524
for choice in response .choices :
525
- if isinstance (choice .message , list ):
526
- # If choice.message is a list, handle accordingly
527
- # It's a check to fit with Nemotron model integration.
528
- content = "" .join (
529
- [msg .content for msg in choice .message if msg .content ]
530
- )
531
- else :
532
- content = choice .message .content or ""
533
525
chat_message = BaseMessage (
534
526
role_name = self .role_name ,
535
527
role_type = self .role_type ,
536
528
meta_dict = dict (),
537
- content = content ,
529
+ content = choice . message . content or "" ,
538
530
)
539
531
output_messages .append (chat_message )
540
532
finish_reasons = [
Original file line number Diff line number Diff line change 18
18
from camel .models import ModelFactory
19
19
from camel .types import ModelPlatformType , ModelType
20
20
21
- model = ModelFactory .create (
21
+ model_gpt = ModelFactory .create (
22
22
ModelPlatformType .OPENAI ,
23
23
model_type = ModelType .GPT_3_5_TURBO ,
24
24
model_config_dict = {},
25
25
)
26
26
27
+ model_stub = ModelFactory .create (
28
+ ModelPlatformType .OPENAI ,
29
+ model_type = ModelType .STUB ,
30
+ model_config_dict = {},
31
+ )
32
+
27
33
28
34
def test_role_generation_example ():
29
35
with patch ('time.sleep' , return_value = None ):
30
- examples .role_description .role_generation .main (model )
36
+ examples .role_description .role_generation .main (model_gpt )
31
37
32
38
33
39
def test_role_playing_with_role_description_example ():
34
40
with patch ('time.sleep' , return_value = None ):
35
41
examples .role_description .role_playing_with_role_description .main (
36
- model , model , chat_turn_limit = 2
42
+ model_gpt , model_stub , chat_turn_limit = 2
37
43
)
Original file line number Diff line number Diff line change @@ -39,7 +39,16 @@ def test_single_agent(model):
39
39
examples .single_agent .main (model = model )
40
40
41
41
42
- @parametrize
42
+ @pytest .mark .parametrize (
43
+ 'model' ,
44
+ [
45
+ ModelFactory .create (
46
+ ModelPlatformType .OPENAI ,
47
+ model_type = ModelType .STUB ,
48
+ model_config_dict = {},
49
+ )
50
+ ],
51
+ )
43
52
def test_misalignment_single_agent (model ):
44
53
examples .misalignment .single_agent .main (model = model )
45
54
@@ -54,6 +63,15 @@ def test_code_generate_metadata(model):
54
63
examples .code .generate_meta_data .main (model = model )
55
64
56
65
57
- @parametrize
66
+ @pytest .mark .parametrize (
67
+ 'model' ,
68
+ [
69
+ ModelFactory .create (
70
+ ModelPlatformType .OPENAI ,
71
+ model_type = ModelType .STUB ,
72
+ model_config_dict = {},
73
+ )
74
+ ],
75
+ )
58
76
def test_code_task_generation (model ):
59
77
examples .code .task_generation .main (model = model )
You can’t perform that action at this time.
0 commit comments