1.2 KiB
1.2 KiB
Backend Project Task Description
Goal
The goal of this project is to implement a backend service that streams valid versions of JSON objects. So each iteration in the stream should be a valid, parsable json object that complies with a certain definition. The input for your JSON is gathered from a generator that produces the json a few characters at a time (to simulate the behavior of a Large Language Model that is streaming). At each update you get from the generator, you will need to stream a new (valid) version of the json object.
Requirements
- The schema of the JSON object is already defined in
schema/response.py
. Make sure to use this schema for generating the JSON objects. - A generator function for the JSON objects is provided in
generators.py
. You should use this function to generate the JSON objects. - The backend service should stream the JSON objects character by character, rather than sending the entire JSON object at once.
- Each iteration of your stream should send a valid json object.
Additional Considerations
- Make sure to handle any potential errors or exceptions that may occur during the streaming process.
- Consider implementing appropriate error handling.