BASH COMMANDS
Activate virtual environment for bash or Windows shell
source ./.venv/Scripts/activate
```shell
./.venv/Scripts/activate
Install pip-tools via cmd line (running module as script) or install it via IDE
pip install pip-tools
Once installed, compile requirements.in
file to requirements.txt
pip-compile --output-file requirements.txt requirements.in
For development, compile also requirements-dev.in
file to requirements-dev.txt
pip-compile --output-file requirements-dev.txt requirements-dev.in requirements.in
Install all packages in requirements.txt
or requirements-dev.txt
(for development) for the first installation
pip install -r requirements.txt
```shell
pip install -r requirements-dev.txt
Upgrade all packages in requirements.txt
or requirements-dev.txt
(for development) after first installation
pip-sync requirements.txt
```shell
pip-sync requirements-dev.txt
Deactivate virtual environment for bash or Windows shell
source ./.venv/Scripts/deactivate
```shell
./.venv/Scripts/deactivate
This project uses Docker and Docker Compose to manage and run the Python models along with other dependent services. Docker Compose allows you to define and run multi-container Docker applications with ease. This will enable smoother development between different components and also for building and deploying the entire system.
To build and run the Docker containers for the models and services, you will need docker
ollama
container from the dedicated docker-compose.yaml
file:docker compose -f docker-compose.yaml up ollama
LLAMA3:8b
model,
the following model needs to be downloaded as follows, before scripts can be run over it:docker exec -it ollama ollama run llama3:8b
ollama run llama3:8b
inside the running container ollama
After it is downloaded, you can now interact with ollama directly out of your python script. Useful for development.
In the docker-compose.yaml
file, the services are defined as follows:
services:
student_helper_backend:
build:
context: .
container_name: student_helper_server
networks:
- student-helper-net
volumes:
- ./app1_data:/app/data
depends_on:
- ollama
ollama:
image: ollama/ollama:latest
container_name: ollama
ports:
- "11434:11434"
networks:
- student-helper-net
volumes:
- /ollama:/root/.ollama
networks:
student-helper-net:
driver: bridge
where the student_helper_server is the build docker container from our setup in .\Dockerfile
.
First, navigate to the project directory.
Use the following command in the CLI to start all services in detached mode. This runs the rebuilds and runs containers locally in the background, allowing you to continue using your terminal:
docker-compose up --build -d
Running the --build
flag rebuilds your local python image, so that the changes you made are considered.
No need to run the flag if you have not changed anything during development (i.e. you want to test the integration into
another service).
Running in detached mode prevents the logs of all containers from flooding your terminal. The -d flag stands for "detached mode."
To view the logs for a specific container, use the docker logs command followed by the container name:
docker logs -f <container-name>
You can find the container names using the docker ps command, which lists all running containers:
docker ps
docker compose down
docker container stop <container name>
docker container rm <container name>
pytest --verbose
Interpreting the result
tests/services/test_evaluators.py::test_summary_evaluate[Low Quality Summary] PASSED [100%]
tests/services/test_evaluators.py
: Classes that are being tested: Evaluator
classestest_summary_evaluate
: Name of the test method and what it tests: It tests the evaluate method of the SummaryEvaluator
class[Low Quality Summary]
: Name of the parameter set inputted in the test method PASSED
, FAILED
, ERROR
evaluation of the parameter set inputted in the test