This service offers a straightforward implementation for generating vector embeddings and computing similarities between vectors. The functionality is primarily defined using Protocol Buffers (protobuf), making the service interoperable across various languages and platforms.
Here's a brief overview of the project's directory structure:
-
protos/: Contains the
.proto
definition files. These define the message types and service definitions.vector_models.proto
: Contains data type definitionsvector_service.proto
: Contains the service + corresponding request/response messages
-
generate_protos.sh: A shell script to regenerate Python code from
.proto
files whenever they are modified. -
main.py: The main entry point of the service.
-
vector_service.py: Implements the RPC handlers for VectorService.
Protocol Buffers (protobuf) is a language-neutral, platform-neutral extensible mechanism for serializing structured data. This project uses protobuf to define message formats and service contracts, ensuring a consistent and type-safe way of communication.
If you make any changes to the .proto
files in the protos/
directory, you must regenerate the corresponding Python code.
To regenerate the Python code from the .proto
files, you can use the provided generate_protos.sh
script:
./generate_protos.sh
Please ensure that you have protoc
, the Protocol Buffers compiler, installed and that the grpcio-tools
Python package is available.
- Clone the repository:
git clone <repository-url>
cd <repository-directory>
- Ensure you have the necessary dependencies installed:
pip install -r requirements.txt
- If you've made changes to the
.proto
files, remember to regenerate the Python code:
./generate_protos.sh
- Run the application:
python main.py