Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.fixAll": "never",
"source.organizeImports": "explicit"
}
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.fixAll": "never",
"source.organizeImports": "explicit"
}
}
},
"wolf.disableHotModeWarning": true
}
4 changes: 2 additions & 2 deletions notebooks/reranking-and-filtering.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "ragbase-YTjELISx-py3.12",
"display_name": "ragbase-BxuiWsRr-py3.12",
"language": "python",
"name": "python3"
},
Expand All @@ -289,7 +289,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
"version": "3.12.5"
}
},
"nbformat": 4,
Expand Down
2,308 changes: 1,293 additions & 1,015 deletions poetry.lock

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
[tool.poetry]
name = "ragbase"
version = "0.1.0"
version = "0.1.1"
description = ""
authors = ["Venelin Valkov <[email protected]>"]
license = "MIT"
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.12,<3.13"
langchain-community = "^0.2.6"
flashrank = "^0.2.8"
qdrant-client = "^1.10.1"
langchain-community = "^0.3.29"
flashrank = "^0.2.10"
qdrant-client = "^1.15.1"
pypdfium2 = "^4.30.0"
fastembed = "^0.3.3"
langchain-experimental = "^0.0.62"
langchain-qdrant = "^0.1.1"
streamlit = "^1.36.0"
python-dotenv = "^1.0.1"
langchain-groq = "^0.1.6"
fastembed = "^0.7.3"
langchain-experimental = "^0.3.4"
langchain-qdrant = "^0.2.1"
streamlit = "^1.49.1"
python-dotenv = "^1.1.1"
langchain-groq = "^0.3.8"


[tool.poetry.group.dev.dependencies]
ruff = "^0.5.1"
jupyterlab = "^4.2.3"
watchdog = "^4.0.1"
ruff = "^0.13.1"
jupyterlab = "^4.4.7"
watchdog = "^6.0.0"

[build-system]
requires = ["poetry-core"]
Expand Down
6 changes: 3 additions & 3 deletions ragbase/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class Model:
REMOTE_LLM = "llama-3.1-70b-versatile"
TEMPERATURE = 0.0
MAX_TOKENS = 8000
USE_LOCAL = False
USE_LOCAL = True

class Retriever:
USE_RERANKER = True
USE_CHAIN_FILTER = False

DEBUG = False
CONVERSATION_MESSAGES_LIMIT = 6
DEBUG = True
CONVERSATION_MESSAGES_LIMIT = 100
14 changes: 12 additions & 2 deletions ragbase/model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from langchain_community.chat_models import ChatOllama
from langchain_community.document_compressors.flashrank_rerank import FlashrankRerank
from langchain_community.document_compressors.flashrank_rerank import \
FlashrankRerank
from langchain_community.embeddings.fastembed import FastEmbedEmbeddings
from langchain_core.language_models import BaseLanguageModel
from langchain_groq import ChatGroq
Expand All @@ -24,7 +25,16 @@ def create_llm() -> BaseLanguageModel:


def create_embeddings() -> FastEmbedEmbeddings:
return FastEmbedEmbeddings(model_name=Config.Model.EMBEDDINGS)
if Config.Model.USE_GPU:
if Config.Model.APPLE_SILICON:
print("Using Apple Silicon")
return FastEmbedEmbeddings(model_name=Config.Model.EMBEDDINGS, device="apple_silicon")
else:
print("Using GPU")
return FastEmbedEmbeddings(model_name=Config.Model.EMBEDDINGS, device="cuda")
else:
print("Using CPU")
return FastEmbedEmbeddings(model_name=Config.Model.EMBEDDINGS, device="cpu")


def create_reranker() -> FlashrankRerank:
Expand Down
20 changes: 10 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
fastembed==0.3.3
flashrank==0.2.8
langchain-community==0.2.6
langchain-experimental==0.0.62
langchain-groq==0.1.6
langchain-qdrant==0.1.1
langchain==0.2.6
python-dotenv==1.0.1
qdrant-client==1.10.1
streamlit==1.36.0
fastembed==0.7.3
flashrank==0.2.10
langchain-community==0.3.29
langchain-experimental==0.3.4
langchain-groq==0.3.8
langchain-qdrant==0.2.1
langchain==0.3.27
python-dotenv==1.1.1
qdrant-client==1.15.1
streamlit==1.49.1
pypdfium2==4.30.0