File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -115,10 +115,8 @@ def invoke(
115
115
try :
116
116
if isinstance (message_history , MessageHistory ):
117
117
message_history = message_history .messages
118
- # We know these are compatible with OpenAI's API at runtime
119
- messages = self .get_messages (input , message_history , system_instruction )
120
118
response = self .client .chat .completions .create (
121
- messages = messages ,
119
+ messages = self . get_messages ( input , message_history , system_instruction ) ,
122
120
model = self .model_name ,
123
121
** self .model_params ,
124
122
)
@@ -158,15 +156,13 @@ def invoke_with_tools(
158
156
if "temperature" not in params :
159
157
params ["temperature" ] = 0.0
160
158
161
- # We know these are compatible with OpenAI's API at runtime
162
- messages = self .get_messages (input , message_history , system_instruction )
163
159
# Convert tools to OpenAI's expected type
164
160
openai_tools : List [ChatCompletionToolParam ] = []
165
161
for tool in tools :
166
162
openai_tools .append (cast (ChatCompletionToolParam , tool ))
167
163
168
164
response = self .client .chat .completions .create (
169
- messages = messages ,
165
+ messages = self . get_messages ( input , message_history , system_instruction ) ,
170
166
model = self .model_name ,
171
167
tools = openai_tools ,
172
168
tool_choice = "auto" ,
You can’t perform that action at this time.
0 commit comments