2929_SESSION_CACHE = flags .DEFINE_string (
3030 'session_cache' , '' , 'Location of any pre-cached results'
3131)
32- _TEXT = flags .DEFINE_string ('text' , 'AB ' , 'The message' )
32+ _TEXT = flags .DEFINE_string ('text' , 'Today is a good day ' , 'The message' )
3333_PRIORITY = flags .DEFINE_integer ('priority' , 0 , 'Message priority' )
3434_MAX_TOKENS = flags .DEFINE_integer ('max_tokens' , 3 , 'Maximum number of tokens' )
3535
@@ -41,22 +41,23 @@ def _GetResponseAsync(
4141 """Gets an async response."""
4242
4343 response = stub .Decode (request )
44+ output = ""
4445 for token_list in response :
45- print (token_list .response [0 ], end = '' , flush = True )
46- print ('\n ' )
46+ output += token_list .response [0 ]
47+ print (f'Prompt: { _TEXT .value } ' )
48+ print (f'Response: { output } ' )
4749
4850
4951def main (argv : Sequence [str ]) -> None :
5052 del argv
5153 # Note: Uses insecure_channel only for local testing. Please add grpc credentials for Production.
5254 address = f'{ _SERVER .value } :{ _PORT .value } '
53- print (address )
5455 with grpc .insecure_channel (
5556 address
5657 ) as channel :
5758 grpc .channel_ready_future (channel ).result ()
5859 stub = jetstream_pb2_grpc .OrchestratorStub (channel )
59- print ('Making request' )
60+ print (f'Sending request to: { address } ' )
6061 request = jetstream_pb2 .DecodeRequest (
6162 session_cache = _SESSION_CACHE .value ,
6263 additional_text = _TEXT .value ,
0 commit comments