File size: 373 Bytes
8983b2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)