MCPcopy Create free account
hub / github.com/microsoft/TypeChat / request_handler

Function request_handler

python/examples/calendar/demo.py:15–26  ·  view source on GitHub ↗
(message: str)

Source from the content-addressed store, hash-verified

13 translator = TypeChatJsonTranslator(model, validator, calendar.CalendarActions)
14
15 async def request_handler(message: str):
16 result = await translator.translate(message)
17 if isinstance(result, Failure):
18 print(result.message)
19 else:
20 result = result.value
21 print(json.dumps(result, indent=2))
22 if any(item["actionType"] == "Unknown" for item in result["actions"]):
23 print("I did not understand the following")
24 for item in result["actions"]:
25 if item["actionType"] == "Unknown":
26 print(item["text"])
27
28 file_path = sys.argv[1] if len(sys.argv) == 2 else None
29 await process_requests("📅> ", file_path, request_handler)

Callers

nothing calls this directly

Calls 1

translateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…