LLM Slots#
Warning! This is an experimental feature.
This module contains Slots based on LLMs structured outputs, that can easily extract requested information from an unstructured user’s request.
- class LLMSlot(caption, llm_model_name='')[source]#
Bases:
ValueSlotLLMSlot is a slot type that extracts information described in caption parameter using LLM.
- caption: str#
- return_type: type#
- llm_model_name: str#
- async extract_value(ctx)[source]#
Return value extracted from context.
Return
SlotNotExtractedto mark extraction as unsuccessful.Raising exceptions is also allowed and will result in an unsuccessful extraction as well.
- Return type:
Union[str,SlotNotExtracted]
- class LLMGroupSlot(allow_partial_extraction=False, *, llm_model_name: str, **kwargs)[source]#
Bases:
GroupSlotLLMSlots based
GroupSlotimplementation. Fetches data for all LLMSlots in a single API request contrary toGroupSlot.- llm_model_name: str#
- async get_value(ctx)[source]#
Extract slot value from
Contextand return an instance ofExtractedSlot.- Return type: