MCPcopy Index your code
hub / github.com/google/adk-python / create

Method create

tests/unittests/workflow/testing_utils.py:390–431  ·  view source on GitHub ↗
(
      cls,
      responses: (
          list[types.Part]
          | list[LlmResponse]
          | list[str]
          | list[list[types.Part]]
      ),
      error: Exception | None = None,
      wait_for_realtime_input: bool = False,
  )

Source from the content-addressed store, hash-verified

388
389 @classmethod
390 def create(
391 cls,
392 responses: (
393 list[types.Part]
394 | list[LlmResponse]
395 | list[str]
396 | list[list[types.Part]]
397 ),
398 error: Exception | None = None,
399 wait_for_realtime_input: bool = False,
400 ):
401 if error and not responses:
402 return cls(
403 responses=[],
404 error=error,
405 wait_for_realtime_input=wait_for_realtime_input,
406 )
407 if not responses:
408 return cls(responses=[], wait_for_realtime_input=wait_for_realtime_input)
409 elif isinstance(responses[0], LlmResponse):
410 # responses is list[LlmResponse]
411 return cls(
412 responses=responses, wait_for_realtime_input=wait_for_realtime_input
413 )
414 else:
415 responses = [
416 LlmResponse(content=ModelContent(item))
417 if isinstance(item, list) and isinstance(item[0], types.Part)
418 # responses is list[list[Part]]
419 else LlmResponse(
420 content=ModelContent(
421 # responses is list[str] or list[Part]
422 [Part(text=item) if isinstance(item, str) else item]
423 )
424 )
425 for item in responses
426 if item
427 ]
428
429 return cls(
430 responses=responses, wait_for_realtime_input=wait_for_realtime_input
431 )
432
433 @classmethod
434 @override

Calls 2

LlmResponseClass · 0.90
ModelContentClass · 0.70

Tested by

no test coverage detected