| 337 | |
| 338 | |
| 339 | class ComplexNestedXMLTool(XMLToolMessage): |
| 340 | request: str = "complex_nested_tool" |
| 341 | purpose: str = "To present a complex nested structure" |
| 342 | |
| 343 | person: Person |
| 344 | hobbies: List[str] |
| 345 | phones: Dict[str, int] |
| 346 | friends: List[Person] | None = None |
| 347 | |
| 348 | @classmethod |
| 349 | def examples(cls) -> List[XMLToolMessage | Tuple[str, XMLToolMessage]]: |
| 350 | return [ |
| 351 | ( |
| 352 | "I want to present a person named John Doe, aged 30, " |
| 353 | "living at 123 Main St, Anytown, USA, with hobbies of " |
| 354 | "reading and cycling, " |
| 355 | " phone numbers: home (1234567890) and work (9876543210)" |
| 356 | " and two friends: " |
| 357 | " Jane Doe, aged 28, living at 456 Elm St, Somewhere, Canada, " |
| 358 | " Jack Doe, aged 32, living at 789 Oak St, Anywhere, UK", |
| 359 | cls( |
| 360 | person=Person( |
| 361 | name="John Doe", |
| 362 | age=30, |
| 363 | address=Address( |
| 364 | street="123 Main St", city="Anytown", country="USA" |
| 365 | ), |
| 366 | ), |
| 367 | hobbies=["reading", "cycling"], |
| 368 | phones={"home": 1234567890, "work": 9876543210}, |
| 369 | friends=[ |
| 370 | Person( |
| 371 | name="Jane Doe", |
| 372 | age=28, |
| 373 | address=Address( |
| 374 | street="456 Elm St", city="Somewhere", country="Canada" |
| 375 | ), |
| 376 | ), |
| 377 | Person( |
| 378 | name="Jack Doe", |
| 379 | age=32, |
| 380 | address=Address( |
| 381 | street="789 Oak St", city="Anywhere", country="UK" |
| 382 | ), |
| 383 | ), |
| 384 | ], |
| 385 | ), |
| 386 | ) |
| 387 | ] |
| 388 | |
| 389 | def handle(self) -> ResultTool: |
| 390 | return ResultTool( |
| 391 | person=self.person, |
| 392 | hobbies=self.hobbies, |
| 393 | phones=self.phones, |
| 394 | friends=self.friends, |
| 395 | ) |
| 396 |
no outgoing calls
searching dependent graphs…