mirror of
https://github.com/Canner/WrenAI.git
synced 2026-10-24 12:53:05 +08:00
AI Service of Wren AI
Concepts
Please read the documentation here to understand the concepts of Wren AI Service.
Environment Setup
- Python 3.12.0, recommended to use
pyenvto manage the Python versions - install
poetrywith version 1.8.3:curl -sSL https://install.python-poetry.org | python3 - --version 1.8.3 - execute
poetry installto install the dependencies - copy
.env.examplefile to.env, and.env.dev.examplefile to.env.devand fill in the environment variables - [for development] execute
poetry run pre-commit installto install the pre-commit hooks andpoetry run pre-commit run --all-filesto run the pre-commit checks at the first time to check if everything is set up correctly - [for development] to run the tests, execute
make test
Start the service for development
The following commands can quickly start the service for development:
make dev-upto start needed containersmake startto start the service- go to
http://WREN_AI_SERVICE_HOST:WREN_AI_SERVICE_PORT(default is http://localhost:5556) to see the API documentation and try them. - go to
http://WREN_UI_HOST:WREN_UI_PORT(default is http://localhost:3000) to interact interact from the UI
- go to
make dev-downto stop the needed containers
Production Environment Setup
- copy
.env.prod.examplefile to.env.prodand fill in the environment variables make buildto build the docker imagemake upto run the wren-ai-service and other containersmake downto stop the docker container
Pipeline Evaluation(Deprecated, will introduce new way to evaluate the speed in the future)
- install
psql - fill in environment variables:
.env.devin the src folder andconfig.propertiesin the src/eval/wren-engine/etc folder - start the docker service
- evaluation
make eval pipeline=ask args="--help"make eval pipeline=ask_details args="--help"
make eval_visualzationto compare between the evaluation results- to run individual pipeline:
poetry run python -m src.pipelines.ask.[pipeline_name](e.g.poetry run python -m src.pipelines.ask.retrieval_pipeline)
Speed Evaluation(Deprecated, will introduce new way to evaluate the speed in the future)
- to evaluate the speed of the pipeline, you can enable the timer
- add environment variables
ENABLE_TIMER=1in.env.dev - restart wren ai service
- check the logs in the terminal
- add environment variables
- to run the load test
- setup
DATASET_NAMEin.env.dev - adjust test config if needed
- adjust test config in pyproject.toml
tool.locustsection - adjust user count in
tests/locust/config_users.json
- adjust test config in pyproject.toml
- in wren-ai-service folder, run
make dev-upto start the docker containers - in wren-ai-service folder, run
make startto start the ai service - run
make load-test - check reports in /outputs/locust folder, there are 3 files with filename locust_report_{test_timestamp}:
- .json: test report in json format, including info like llm provider, version
- .html: test report in html format, showing tables and charts
- .log: test log
- setup
Demo(Deprecated)
- go to the
demofolder and runpoetry installto install the dependencies - in the
wren-ai-servicefolder, open three terminals- in the first terminal, run
make dev-upto start the docker container - in the second terminal, run
make startto start the wren-ai service - in the third terminal, run
make demoto start the demo service
- in the first terminal, run
- ports of the services:
- wren-engine: ports should be 8080
- wren-ai-service: port should be 5556
- wren-ui: port should be 3000
- qdrant: ports should be 6333, 6334
Adding your preferred LLM or Document Store
Please read the documentation here to check out how you can add your preferred LLM or Document Store.