Clone the repository:
git clone https://github.com/ableneo/samo
Install Ableneo ChatBot Samo via:
pip install .
For demonstration purposes, we have already prepared all the prerequisites. The ChatBot is configured to serve as a helpful Biology assistant. It utilizes information from biological pages on Wikipedia as its knowledge base (data were downloaded from https://commoncrawl.org/). All responses will be in Slovak, so no additional translation is necessary.
To run chatbot Samo server run::
- Duplicate the
config.example.yaml
file - Fill in all placeholders in the config file
- Run the following command::
ableneo-chatbot server run --config-file <config.yaml>
- Run the server
For more information, run:
ableneo-chatbot server --help
If you would like to use your data in your ChatBot system, follow these steps:
- Remove the
./db
folder - Copy your
*.txt
data to the./data
folder - Run the following command:
ableneo-chatbot knowledge-base init --data-root './data' --data-type '.txt' --config-file './config.yaml' --encoding 'utf-8'
For more information, run::
ableneo-chatbot knowledge-base --help
Request
curl -i --request GET 'http://127.0.0.1:6628/health'
Response
HTTP/1.1 200 OK
Server: Werkzeug/3.0.3 Python/3.11.9
Date: Thu, 06 Jun 2024 15:41:15 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 2
Access-Control-Allow-Origin: *
Connection: close
OK
Request
curl -i --request GET 'http://127.0.0.1:6628/version'
Response
HTTP/1.1 200 OK
Server: Werkzeug/3.0.3 Python/3.11.9
Date: Thu, 06 Jun 2024 15:41:48 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 5
Access-Control-Allow-Origin: *
Connection: close
0.1.1
Request
GET /version
curl -i --request POST 'http://127.0.0.1:6628/v1/chatbot/prompt' \
--header 'Content-Type: application/json' \
--data '{
"chat_id": "abb99ff0-22ad-4992-ac54-997b95ebbc11",
"chat_history": [],
"question": "Koľko mláďat ročne má Myšiarka ušatá?"
}'
Response
HTTP/1.1 200 OK
Server: Werkzeug/3.0.3 Python/3.11.9
Date: Thu, 06 Jun 2024 16:12:54 GMT
Content-Type: text/plain; charset=utf-8
Access-Control-Allow-Origin: *
Transfer-Encoding: chunked
Connection: close
Myšiarka ušatá (Asio otus) kladie 3 až 7 svetlých vajec ročne.
Zdroj: <a href='data\\mysiarka_usata.txt'>data\\mysiarka_usata.txt</a>
Request
curl -i --request POST 'http://127.0.0.1:6628/v1/chatbot/history' \
--header 'Content-Type: application/json' \
--data '{"chat_id": "abb99ff0-22ad-4992-ac54-997b95ebbc11"}'
Response
HTTP/1.1 200 OK
Server: Werkzeug/3.0.3 Python/3.11.9
Date: Thu, 06 Jun 2024 16:14:26 GMT
Content-Type: application/json
Content-Length: 259
Access-Control-Allow-Origin: *
Connection: close
[{"role": "user", "content": "Koľko mláďat ročne má Myšiarka ušatá?"}, {"role": "assistant", "content": "Myšiarka ušatá (Asio otus) kladie 3 až 7 svetlých vajec ročne. <a href='data\\mysiarka_usata.txt'>data\\mysiarka_usata.txt</a>"}]
Request
curl -i --request POST 'http://127.0.0.1:6628/v1/chatbot/feedback' \
--header 'Content-Type: application/json' \
--data '{
"chat_id": "abb99ff0-22ad-4992-ac54-997b95ebbc11",
"chat_history": [],
"question": "Koľko mláďat ročne má Myšiarka ušatá?",
"feedback": "Správne",
"answer": "Myšiarka ušatá (Asio otus) kladie 3 až 7 svetlých vajec ročne. <a href='\''data\\mysiarka_usata.txt'\''>data\\mysiarka_usata.txt</a>",
"reporter": "učiteľ"
}'
Response
HTTP/1.1 200 OK
Server: Werkzeug/3.0.3 Python/3.11.9
Date: Thu, 06 Jun 2024 16:21:00 GMT
Content-Type: application/json
Content-Length: 22
Access-Control-Allow-Origin: *
Connection: close
{"message": "success"}
If you would like to customize the source code, you can install all development dependencies via:
pip install -e .[dev]
For more information, contact:
- info@ableneo.com
- +421 2 32 144 791