17
17
from dotenv import load_dotenv
18
18
19
19
from gpt_researcher import GPTResearcher
20
- from gpt_researcher .utils .enum import ReportType
20
+ from gpt_researcher .utils .enum import ReportType , Tone
21
21
from backend .report_type import DetailedReport
22
22
23
23
# =============================================================================
64
64
choices = choices ,
65
65
required = True )
66
66
67
+ # First, let's see what values are actually in the Tone enum
68
+ print ([t .value for t in Tone ])
69
+
70
+ cli .add_argument (
71
+ "--tone" ,
72
+ type = str ,
73
+ help = "The tone of the report (optional)." ,
74
+ choices = ["objective" , "formal" , "analytical" , "persuasive" , "informative" ,
75
+ "explanatory" , "descriptive" , "critical" , "comparative" , "speculative" ,
76
+ "reflective" , "narrative" , "humorous" , "optimistic" , "pessimistic" ],
77
+ default = "objective"
78
+ )
79
+
67
80
# =============================================================================
68
81
# Main
69
82
# =============================================================================
@@ -83,9 +96,30 @@ async def main(args):
83
96
84
97
report = await detailed_report .run ()
85
98
else :
99
+ # Convert the simple keyword to the full Tone enum value
100
+ tone_map = {
101
+ "objective" : Tone .Objective ,
102
+ "formal" : Tone .Formal ,
103
+ "analytical" : Tone .Analytical ,
104
+ "persuasive" : Tone .Persuasive ,
105
+ "informative" : Tone .Informative ,
106
+ "explanatory" : Tone .Explanatory ,
107
+ "descriptive" : Tone .Descriptive ,
108
+ "critical" : Tone .Critical ,
109
+ "comparative" : Tone .Comparative ,
110
+ "speculative" : Tone .Speculative ,
111
+ "reflective" : Tone .Reflective ,
112
+ "narrative" : Tone .Narrative ,
113
+ "humorous" : Tone .Humorous ,
114
+ "optimistic" : Tone .Optimistic ,
115
+ "pessimistic" : Tone .Pessimistic
116
+ }
117
+
86
118
researcher = GPTResearcher (
87
119
query = args .query ,
88
- report_type = args .report_type )
120
+ report_type = args .report_type ,
121
+ tone = tone_map [args .tone ]
122
+ )
89
123
90
124
await researcher .conduct_research ()
91
125
0 commit comments