f"#Instructions \nGiven the following as clue, the word for the {word_len}-letter word. ¥n {add_hint_str} ¥nReply only answer words.without numbering.separate with comma.\n#Clues\n{hint_str[0]}"
i in range(max_trial): response = client.chat.completions.create( model="gpt-4", messages=[ {"role":"system","content":"You are a powerful AI and specialize in the ability to help users solve crosswords.The user will give you crossword clues and you will be asked to suggest some possible candidate words. Please answer only the candidate words, separated by commas(no numbering, no explanation)."}, {"role":"user","content":f"{request_str}"}, ], temperature=1.0, top_p=1, max_tokens=256, frequency_penalty=0, presence_penalty=0 )
in row: continue candidates = row['ans_candidate'] candidates_len = len(candidates) # if we have no candidate words , skip if candidates_len == 0: continue tmp_H1 = 0 for i in range(candidates_len): x[(row['id'],row['axis'],i)] = Binary(f"x_{row['id']}_{row['axis']}_{i}") tmp_H1 += x[(row['id'],row['axis'],i)] H1 += Constraint((tmp_H1-1)*(tmp_H1-1), label = f"one answer for id,axis = ({row['id']},{row['axis']})")