Просмотр исходного кода

fix: extra input for opening statement was not suitable for prompt (#143)

tags/0.2.2
John Wang 2 лет назад
Родитель
Сommit
54a6571462
Аккаунт пользователя с таким Email не найден
1 измененных файлов: 10 добавлений и 2 удалений
  1. 10
    2
      api/core/completion.py

+ 10
- 2
api/core/completion.py Просмотреть файл

@@ -177,13 +177,21 @@ Avoid mentioning that you obtained the information from the context.
And answer according to the language of the user's question.
"""
if pre_prompt:
human_inputs.update(inputs)
extra_inputs = {k: inputs[k] for k in
OutLinePromptTemplate.from_template(template=pre_prompt).input_variables
if k in inputs}
if extra_inputs:
human_inputs.update(extra_inputs)
human_message_instruction += pre_prompt + "\n"

human_message_prompt = human_message_instruction + "Q:{query}\nA:"
else:
if pre_prompt:
human_inputs.update(inputs)
extra_inputs = {k: inputs[k] for k in
OutLinePromptTemplate.from_template(template=pre_prompt).input_variables
if k in inputs}
if extra_inputs:
human_inputs.update(extra_inputs)
human_message_prompt = pre_prompt + "\n" + human_message_prompt

# construct main prompt

Загрузка…
Отмена
Сохранить