/openAI-server-client-chat

Simplified example demonstrating how to use gRPC in Python to create a client-server application where a Python script interacts with the GPT-4 language model hosted on a server

Primary LanguagePythonApache License 2.0Apache-2.0

openAI-server-client-chat

Simplified example demonstrating how to use gRPC in Python to create a client-server application where a Python script interacts with the GPT-4 language model hosted on a server

This example demonstrates a basic client-server interaction using gRPC in Python, where the server uses the GPT-4 language model to generate responses to input text received from the client. You can extend it further by handling multiple concurrent requests, implementing error handling, and integrating with real-world applications.

Clone the repository: git clone https://github.com/your-username/openAI-server-client-chat.git

Install the necessary dependencies: pip install -r requirements.txt

Set up your OpenAI API key: Sign up for an account on the OpenAI platform and obtain an API key. Set your API key as an environment variable: '''export OPENAI_API_KEY="your-api-key'''

Start the server by running: python server.py.

In another terminal window, run: python client.py.

You should see the client sending input text to the server, and the server responding with text generated by the GPT-4 model.