import grpc
from link_pb2 import ChatRequest, ChatResponse
from link_pb2_grpc import ChatServiceStub
def main():
channel = grpc.insecure_channel('localhost:50051')
stub = ChatServiceStub(channel)
# Create a request
request = ChatRequest(request="Hello, YAFAI-Core!")
# Send the request and receive the response
response_stream = stub.ChatStream(iter([request]))
for response in response_stream:
print(f"Response: {response.response}, Trace: {response.trace}")
channel.close()
if __name__ == "__main__":
main()