import asyncio
import os
from google.adk.integrations.typesafe import TypesafeClassifier
from google.adk.labs.classifiers import Binary, Choice, Score
sage = TypesafeClassifier(
model='sage-latest',
base_url='https://api.levanto.ai',
api_key=os.environ['LEVANTO_API_KEY'],
)
async def main():
response = await sage.classify(
input='I was charged twice. Please refund the duplicate today.',
questions={
'refund': Binary(instructions='Is the customer asking for money back?'),
'team': Choice(
instructions='Which team should handle this?',
criteria={'billing': 'Charges and refunds', 'technical': 'Bugs and outages'},
),
'urgency': Score(instructions='How urgent is it?', criteria=['Can wait', 'This week', 'Today']),
},
)
response.answers['refund'].probability # 0.996
response.answers['team'].choice # 'billing'
response.answers['urgency'].score # 1.99, from 0 to 2
asyncio.run(main())