Создаём промт:
# num_sol - максимальное кол-во наблюдений в промте
def create_prompt_bias(num_sol):
meta_prompt_start = f'''Now you will help me minimize a function with two input variables w, b. I have some (w, b) pairs and the function values at those points.
The pairs are arranged in descending order based on their function values, where lower values are better.\n\n'''
solutions = ''
if num_sol > len(df.loss):
num_sol = len(df.loss)
for i in range(num_sol):
solutions += f'''input:\nw={df.w.iloc[-num_sol + i]:.3f}, b={df.b.iloc[-num_sol + i]:.3f}\nvalue:\n{df.loss.iloc[-num_sol + i]:.3f}\n\n'''
meta_prompt_end = f'''Give me a new (w, b) pair that is different from all pairs above, and has a function value lower than
any of the above. Do not write code. The output must end with a pair [w, b], where w and b are numerical values.
w, b ='''
return meta_prompt_start + solutions + meta_prompt_end