Skip to content

Commit f1d6d44

Browse files
authored
Update openai_tools.py
1 parent 9d00275 commit f1d6d44

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

GraphReasoning/openai_tools.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def is_url(val) -> bool:
237237
def get_answer( query='What is shown in this image?',model="gpt-4o",
238238
image=None, payload=None, max_tokens=1024, temperature=0.1,
239239
top_p=0.95, top_k=40, init_instr = "Look at this image: ",
240-
display_image=False,
240+
display_image=False, system='You are a helpful assistant.'
241241
):
242242

243243
base64_image=None
@@ -267,7 +267,13 @@ def get_answer( query='What is shown in this image?',model="gpt-4o",
267267
if base64_image!=None:
268268
payload = {
269269
"model": model,
270-
"messages": [
270+
"messages": [{
271+
"role": "system",
272+
"content": [ {
273+
"type": "text",
274+
"text": system
275+
}, ]
276+
},
271277
{
272278
"role": "user",
273279
"content": [
@@ -287,18 +293,23 @@ def get_answer( query='What is shown in this image?',model="gpt-4o",
287293
"max_tokens": max_tokens
288294
}
289295
else:
296+
290297
payload = {
291298
"model": model,
292299
"messages": [
300+
{
301+
"role": "system",
302+
"content": [ {
303+
"type": "text",
304+
"text": system
305+
}, ]
306+
},
293307
{
294308
"role": "user",
295-
"content": [
296-
{
309+
"content": [ {
297310
"type": "text",
298311
"text": query
299-
},
300-
301-
]
312+
}, ]
302313
}
303314
],
304315
"max_tokens": max_tokens

0 commit comments

Comments
 (0)