Closed TuanaCelik closed 1 year ago
Hey @TuanaCelik, just had a closer look at this and the issue seems to be that there's no output_parser
defined for PromptTemplate
in the YAML. Therefore, PromptNode
returns a list of plain strings while the REST API expects a list of Answer
objects. output_parser
should be set to AnswerParser
in this case. There are two ways of doing this in YAML.
Either:
- name: lfqa_template
params:
name: lfqa
prompt_text: "Given the context please generate a comprehensive, summarized answer. Context: $documents; Question: $query; Answer:"
output_parser:
type: AnswerParser
type: PromptTemplate
Or:
- name: answer_parser
type: AnswerParser
- name: lfqa_template
params:
name: lfqa
prompt_text: "Given the context please generate a comprehensive, summarized answer. Context: $documents; Question: $query; Answer:"
output_parser: answer_parser
type: PromptTemplate
Do I understand correctly that with the introduction of AnswerParser
this problem basically got resolved? We just have to make sure to add the output_parser
?
Yes, exactly.
Closing this issue as it seems to be resolved with the introduction of AnswerParser
.
There is a bug while running the Rest API with a pipeline that includes a
PromptNode
andPromptTemplate
that was noticed by @rolandtannous and @recrudesce An example YAML for reproducing is below. The result we get is sometimes a response where theanswers=[]
is empty. However, whether we get a response or anything at all, the logs of the rest api actually contain the answer, followed by an exception. See below an example response followed by an exception. As you can see, it includes the answer it should return: "answers": ["The Biglan study included two universities."]But then it fails.
An example YAML to reproduce this:
I also noticed that this type of template where there is more than one argument being provided is not tested in the unit tests.