...
File "/Users/palsujit/Projects/hgraph-sujitpal/llamaindex-apollo-preprocessing/src/../external/question_generator/questiongenerator.py", line 250, in _get_MC_answers
choices.extend(random.sample(pool, num_choices - len(choices)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/random.py", line 439, in sample
raise TypeError("Population must be a sequence. "
TypeError: Population must be a sequence. For dicts or sets, use sorted(d).
It seems to be because pool is a set and random.sample expects a list, so I updated line 249 of questiongenerator.py to read:
My environment:
Running the following code (as shown in README):
returns the following error:
It seems to be because
pool
is aset
andrandom.sample
expects alist
, so I updated line 249 ofquestiongenerator.py
to read:and this seems to have fixed it.