Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This documentation contains information on how to setup the API.

Optional:

API Setup

Paste the API Code

The command is

git clone https://github.com/gcapuzzi/aifaq_api1

Obtain ReadTheDocs Documentation

Download the ReadTheDocs documentation in "rtdocs" folder

...

via the following command

wget -r -A.html -P rtdocs https://hyperledger-fabric.readthedocs.io/en/release-2.5/

Once it starts to download the previous versions, we can interrupt the code (CTRL + C)

...


Then, move into rtdocs folder and move the release-2.5 content to rtdocs. To do so, first compress the content of the folder, moving there via command:

tar -czvf rtdocs.tar.gz .


After, move the readthedocs.tar.gz to the parent directory (../) by repeating the following 2 commands until we are into rtdocs folder:

  • mv readthedocs.tar.gz ..
  • cd ..


Then, enter the following command in the terminal:

rm -rf hyperledger-fabric.readthedocs.io

Finally, uncompress the file here and remove compress file:

  • tar -xzvf rtdocs.tar.gz
  • rm rtdocs.tar.gz

Create VectorDB

First, install all the required libraries/packages via

pip install -r requirements.txt

* ensure that you are in the parent directory


Then, run ingest.py

Launch API

Run api.py to launch the API service


Test the API

...

via commands like this

curl --header "Content-Type: application/json" --request POST --data '{"text": "How to install Hyperledger fabric?"}' http://127.0.0.1/query

...