MCPcopy Create free account
hub / github.com/google/adk-python / run_prompt

Function run_prompt

contributing/samples/models/hello_world_gemma/main.py:48–59  ·  view source on GitHub ↗
(session: Session, new_message: str)

Source from the content-addressed store, hash-verified

46 )
47
48 async def run_prompt(session: Session, new_message: str):
49 content = types.Content(
50 role='user', parts=[types.Part.from_text(text=new_message)]
51 )
52 print('** User says:', content.model_dump(exclude_none=True))
53 async for event in runner.run_async(
54 user_id=user_id_1,
55 session_id=session.id,
56 new_message=content,
57 ):
58 if event.content.parts and event.content.parts[0].text:
59 print(f'** {event.author}: {event.content.parts[0].text}')
60
61 start_time = time.time()
62 print('Start time:', start_time)

Callers 1

mainFunction · 0.70

Calls 2

model_dumpMethod · 0.45
run_asyncMethod · 0.45

Tested by

no test coverage detected