-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update ragger implementation to package
- Loading branch information
1 parent
85cfebb
commit 1fee7db
Showing
2 changed files
with
11 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,43 +69,6 @@ install-brew: | |
|
||
{%- if cookiecutter.open_source != 'y' %} | ||
|
||
setup-ragger: | ||
@if [ -d src/ragger ]; then \ | ||
echo "RAG functionality already added to the project. Skipping."; \ | ||
exit 1; \ | ||
fi | ||
@if [ ! -d .venv ]; then \ | ||
echo "The project hasn't been installed yet. Please run 'make install' first."; \ | ||
exit 1; \ | ||
fi | ||
@echo "Adding RAG functionality to the project..." | ||
@cd src && git clone [email protected]:alexandrainst/ragger.git && rm -rf ragger/.git && cd - | ||
@mv src/ragger/src/scripts/run_demo.py src/scripts/ | ||
@mv src/ragger/src/scripts/run_cli.py src/scripts/ | ||
@cp -R src/ragger/config/* config/ | ||
@if [ ! -f data/processed/document_store.jsonl ]; then \ | ||
mv src/ragger/data/processed/document_store.jsonl data/processed/; \ | ||
fi | ||
@{{'poetry add' if cookiecutter.dependency_manager != 'pip' else '. .venv/bin/activate && pip install'}} -e src/ragger | ||
@{{'poetry run ' if cookiecutter.dependency_manager != 'pip' else '. .venv/bin/activate && '}}python src/scripts/fix_dot_env_file.py --include-openai | ||
|
||
add-rag: ## Add RAG functionality to the project | ||
@$(MAKE) --quiet setup-ragger | ||
@git add . | ||
@echo "Added RAG functionality to the project, but haven't committed the changes yet. Please commit them manually." | ||
|
||
update-rag: ## Update the RAG submodule - this requires `make add-rag` to have been run | ||
@if [ -d src/ragger ]; then \ | ||
rm -rf src/ragger; \ | ||
$(MAKE) --quiet setup-ragger; \ | ||
git add .; \ | ||
echo "Updated RAG functionality, but haven't committed the changes yet (if any). Please commit them manually."; \ | ||
else \ | ||
echo "RAG code not found. Please run 'make add-rag' first."; \ | ||
fi | ||
{%- endif %} | ||
{%- if cookiecutter.dependency_manager != 'pip' %} | ||
|
||
install-pipx: | ||
@if [ "$(shell which pipx)" = "" ]; then \ | ||
uname=$$(uname); \ | ||
|
@@ -136,18 +99,10 @@ install-dependencies: | |
{%- endif %} | ||
|
||
setup-environment-variables: | ||
@if [ -d src/ragger ]; then \ | ||
{{'poetry run ' if cookiecutter.dependency_manager != 'pip' else '. .venv/bin/activate && '}}python src/scripts/fix_dot_env_file.py --include-openai; \ | ||
else \ | ||
{{'poetry run ' if cookiecutter.dependency_manager != 'pip' else '. .venv/bin/activate && '}}python src/scripts/fix_dot_env_file.py; \ | ||
fi | ||
{{'poetry run ' if cookiecutter.dependency_manager != 'pip' else '. .venv/bin/activate && '}}python src/scripts/fix_dot_env_file.py; \ | ||
|
||
setup-environment-variables-non-interactive: | ||
@if [ -d src/ragger ]; then \ | ||
{{'poetry run ' if cookiecutter.dependency_manager != 'pip' else '. .venv/bin/activate && '}}python src/scripts/fix_dot_env_file.py --include-openai --non-interactive; \ | ||
else \ | ||
{{'poetry run ' if cookiecutter.dependency_manager != 'pip' else '. .venv/bin/activate && '}}python src/scripts/fix_dot_env_file.py --non-interactive; \ | ||
fi | ||
{{'poetry run ' if cookiecutter.dependency_manager != 'pip' else '. .venv/bin/activate && '}}python src/scripts/fix_dot_env_file.py --non-interactive; \ | ||
|
||
setup-git: | ||
@git config --global init.defaultBranch main | ||
|
@@ -222,3 +177,10 @@ type-check: ## Type-check the project | |
{%- else -%} | ||
. .venv/bin/activate && mypy . --install-types --non-interactive --ignore-missing-imports --show-error-codes --check-untyped-defs | ||
{%- endif %} | ||
|
||
add-rag: ## Install the Ragger package, for RAG projects | ||
{% if cookiecutter.dependency_manager != 'pip' -%} | ||
@poetry add git+ssh://[email protected]/alexandrainst/ragger.git --extras all | ||
{%- else -%} | ||
. .venv/bin/activate && pip install ragger[all]@git+ssh://[email protected]/alexandrainst/ragger.git | ||
{%- endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters