@@ -137,9 +137,7 @@ async def main():
137137 await client.start()
138138
139139 session = await client.create_session(on_permission_request = PermissionHandler.approve_all, model = " gpt-4.1" )
140- response = await session.send_and_wait({" prompt" : " What is 2 + 2?" })
141-
142- response = await session.send_and_wait({" prompt" : " What is 2 + 2?" })
140+ response = await session.send_and_wait(" What is 2 + 2?" )
143141 print (response.data.content)
144142
145143 await client.stop()
@@ -296,7 +294,7 @@ async def main():
296294
297295 session.on(handle_event)
298296
299- await session.send_and_wait({ " prompt " : " Tell me a short joke" } )
297+ await session.send_and_wait(" Tell me a short joke" )
300298
301299 await client.stop()
302300
@@ -430,10 +428,11 @@ unsubscribeIdle();
430428``` python
431429from copilot import CopilotClient
432430from copilot.generated.session_events import SessionEvent, SessionEventType
431+ from copilot.session import PermissionRequestResult
433432
434433client = CopilotClient()
435434
436- session = client.create_session(on_permission_request = lambda req , inv : { " kind" : " approved" } )
435+ session = await client.create_session(on_permission_request = lambda req , inv : PermissionRequestResult( kind = " approved" ) )
437436
438437# Subscribe to all events
439438unsubscribe = session.on(lambda event : print (f " Event: { event.type} " ))
@@ -688,9 +687,7 @@ async def main():
688687
689688 session.on(handle_event)
690689
691- await session.send_and_wait({
692- " prompt" : " What's the weather like in Seattle and Tokyo?"
693- })
690+ await session.send_and_wait(" What's the weather like in Seattle and Tokyo?" )
694691
695692 await client.stop()
696693
@@ -965,7 +962,7 @@ async def main():
965962 break
966963
967964 sys.stdout.write(" Assistant: " )
968- await session.send_and_wait({ " prompt " : user_input} )
965+ await session.send_and_wait(user_input)
969966 print (" \n " )
970967
971968 await client.stop()
0 commit comments