Output in L5_Evaluation cell 16 does not allow me to move on to next steps

I am having trouble with cell output on L5_Evaluation–specifically in the cell with this code:

new_examples = example_gen_chain.apply_and_parse(
[{“doc”: t} for t in data[:5]]

Instead of,

{‘query’: ‘What is the main feature of the EcoFlex 3L Storm Pants and how does it keep the wearer comfortable?’,
‘answer’: ‘The main feature of the EcoFlex 3L Storm Pants is the TEK O2 technology which offers the most breathability the company has ever tested. This technology allows air to permeate the pants while keeping water out, ensuring that the wearer stays dry and comfortable during any outdoor activity.’}

It gives this:

{‘qa_pairs’: {‘query’: “What is the weight of the Women’s Campside Oxfords per pair?”,
‘answer’: “The weight of the Women’s Campside Oxfords per pair is approximately 1 lb.1 oz.”}}

I would like help figuring out why this is happening and how I should fix it? Thanks!

1 Like

Hi @wattow24,

When I run it, it gives me this as well:

Why do you think it should output this ?


I have the same issue.


i think @wattow24 is pointing out that the a nested dict is returned and we need to flatten it by taking out the “qa_pairs” keys.

BTW, I think the notebook is still working fine, but when using the most recent version of langchain running locally it causes the problem.

I was able to get this to work by flattening the dictionary in the “new_examples” list with this line of code:

new_examples = [item[‘qa_pairs’] for item in new_examples]

Now new_examples[0] returns what is shown in the video in the class.

Thanks @jebradfield, a long as the notebook is running fine on the platform, no action is needed.

Thank you for sharing the solution for when using the latest libraries of langchain.