Player Service is a backend application that serves baseball player data. In addition, Player service integrates with Ollama, which allows us to run the tinyllama LLM locally.
- Python3.9+
- sqllite3
- Docker
- Ollama Python SDK
-
Verify system dependencies
- Python
- Verify installation:
python3 --version
- Verify installation:
- Docker
- Download and install from docker.com
- Verify installation, run:
docker --version
- Python
-
Clone this repository or Download the code as zip
- run
git clone https://github.com/Intuit-A4A/player-service-python.git
- run
OPTIONAL Create & activate virtual env
$ python3 -m venv env # use `python -m venv env` on Windows
$ source env/bin/activate # use `env\Scripts\activate` on Windows
- Install application dependencies
- Move into the project's root directory, run:
cd player-service-app
. - From the project's root directory, run:
pip install -r requirements.txt
- Move into the project's root directory, run:
-
Start the Player service
python3 app.py
-
Verify the Player service is running
- Open your browser and visit
http://localhost:8000/v1/players
- If the application is running successfully, you will see player data appear in the browser
- Open your browser and visit
Player service integrates with Ollama 🦙, which allows us to run LLMs locally. This app runs tinyllama model.
-
Pull and run Ollama docker image and download
tinyllama
model- Pull Ollama docker image
docker pull ollama/ollama
-
Run Ollama docker image on port 11434 as a background process
docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
-
Download and run
tinyllama
modeldocker exec -it ollama ollama run tinyllama
-
Test Ollama API server
curl -v --location 'http://localhost:11434/api/generate' --header 'Content-Type: application/json' --data '{"model": "tinyllama","prompt": "why is the sky blue?", "stream": false}'
-
Ensure Player Service is running
python3 app.py
-
Open your browser and visit
http://localhost:8000/v1/chat/list-models
- If the application is running successfully, you will see a json response that include information about tinyllama