Hi!, New to Llamaindex discord. Running into issues using LLMSingleSelector (running 0.8.8v). Code and a snip of trace below. Any help appreciated! thank you.
from llama_index.tools import ToolMetadata
from llama_index.selectors.llm_selectors import LLMSingleSelector
# choices as a list of tool metadata
choices = [
ToolMetadata(description="I am choice 1", name="choice_1"),
ToolMetadata(description="I am choice 2", name="choice_2"),
]
# choices as a list of strings
choices = ["choice 1 - description for choice 1", "choice 2: description for choice 2"]
selector = LLMSingleSelector.from_defaults()
selector_result = selector.select(choices, query="What choices do I have?")
print(selector_result.selections)
File ~/.pyenv/versions/llm-3.11.3/lib/python3.11/site-packages/llama_index/output_parsers/selection.py:56, in <listcomp>(.0)
54 if isinstance(json_output, dict):
55 json_output = [json_output]
---> 56 answers = [Answer.from_dict(json_dict) for json_dict in json_output]
57 return StructuredOutput(raw_output=output, parsed_output=answers)
File ~/.pyenv/versions/llm-3.11.3/lib/python3.11/site-packages/dataclasses_json/api.py:70, in DataClassJsonMixin.from_dict(cls, kvs, infer_missing)
65 @classmethod
66 def from_dict(cls: Type[A],
67 kvs: Json,
68 *,
69 infer_missing=False) -> A:
---> 70 return _decode_dataclass(cls, kvs, infer_missing)
File ~/.pyenv/versions/llm-3.11.3/lib/python3.11/site-packages/dataclasses_json/core.py:168, in _decode_dataclass(cls, kvs, infer_missing)
165 if not field.init:
166 continue
--> 168 field_value = kvs[field.name]
169 field_type = types[field.name]
170 if field_value is None:
KeyError: 'choice'