This API serves as a question-answering interface for questions on the german law, leveraging a backend that processes queries and returns answers sourced from a database made out of german law books. The API is designed to receive questions through a RESTful endpoint and provide answers in a conversational format, mimicking a dialogue with a virtual character named "Harvey Specter" from the series suits. Each response includes the answer content, the sender's name, and a timestamp, enriching the user experience with a personalized touch.
- Question-Answering Capability: Processes textual queries and provides accurate answers by consulting an extensive database.
- Conversational Responses: Returns answers in a conversational format, attributed to the virtual character "Harvey Specter."
- Timestamped Replies: Each response is accompanied by a timestamp, adding context to the dialogue flow.
Follow these steps to set up the API server:
- Clone the repository:
git clone <repository-url>
- Navigate to the cloned directory:
cd <repository-directory>
- Install the required dependencies
- Launch the API server:
python app.py
Ensure Python 3.9+ and pip are installed on your system before proceeding.
To interact with the API, you'll need to send a POST request to the /query
endpoint with a JSON payload containing your question.
- Endpoint:
/query
- Method: POST
- Headers:
- Content-Type: application/json
- Body:
message
: The text of your question.
Here's how to use curl
to send a question to the API:
curl -X POST http://localhost:5000/query \
-H "Content-Type: application/json" \
-d '{"message": "What is the theory of relativity?"}'
The API will return a JSON object that includes the answer to your question, the name of the sender (Harvey Specter), and a timestamp marking the response time.
{
"content": "The theory of relativity, proposed by Albert Einstein, explains the interrelations of time and space...",
"sender": "Harvey Specter",
"timestamp": "2024-02-22T12:34:56.789Z"
}
For any questions or issues, please open an issue in the GitHub repository or contact the project maintainers directly.