slotmatch / examples /test_slotmatch.py
GenAIDevTOProd's picture
Upload folder using huggingface_hub
8983b2d verified
raw
history blame contribute delete
373 Bytes
from slotmatch import SlotExtractor
from pprint import pprint
schema = {
"name": str,
"intent": str,
"destination": str
}
llm_output = '''
Hi, I’m Alice. I’d like to book a flight to New York.
{
"intnt": "book_flight",
"dest": "New York",
"name": "Alice"
}
'''
extractor = SlotExtractor(schema)
result = extractor.extract(llm_output)
pprint(result)