Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
165a955
chore: udpate ia rules for my IA :)
willypaz243 Oct 25, 2025
5c15422
chore: remove entities file and replace with models, update database …
willypaz243 Oct 25, 2025
914f333
refactor: update fill_database.py to include questions_and_answers fi…
willypaz243 Oct 26, 2025
1cfbe2d
refactor: remove unused models and update imports
willypaz243 Oct 26, 2025
bafaa54
feat: implement calendar and event data filling with date parsing uti…
willypaz243 Oct 27, 2025
c0d113c
fix: update PoliticalParty model to inherit from BaseModel instead of…
willypaz243 Oct 28, 2025
cf42a95
fix: refactor mongo models and update election status references
willypaz243 Oct 28, 2025
c4552b9
feat: enhance vector database creation with improved text splitting a…
willypaz243 Oct 29, 2025
0bf5a01
chore: update vector database creation and add is_active field to pol…
willypaz243 Oct 29, 2025
dd32477
feat(agent): enhance candidate detection and election search capabili…
willypaz243 Oct 30, 2025
44b06ee
chore: refactor vector database creation and election data handling
willypaz243 Oct 30, 2025
a75f09d
refactor(agent): restructure topic handling and context building for …
willypaz243 Oct 30, 2025
9dbd08c
feat: implement news verification context building and update agent p…
willypaz243 Oct 31, 2025
62906c6
refactor: update classify topic to return list of topics and update t…
willypaz243 Oct 31, 2025
fa03df1
feat: implement government plans context building and election search…
willypaz243 Nov 4, 2025
aa55f6b
refactor: migrate to settings configuration and update LLM provider h…
willypaz243 Nov 4, 2025
f13e4a4
feat: implement questions and answers context building and capabiliti…
willypaz243 Nov 4, 2025
0c34a1e
feat: implement electoral calendar context building and date filtering
willypaz243 Nov 5, 2025
c22a236
docs: update context builder with calendar and events sections and re…
willypaz243 Nov 5, 2025
21798ed
format: ruff format applied
willypaz243 Nov 6, 2025
fec5568
format: test_agent.py
willypaz243 Nov 6, 2025
fd6676a
feat: implement rate limiting for chatbot API endpoints
willypaz243 Feb 15, 2026
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
4 changes: 2 additions & 2 deletions .continue/rules/python_best_practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

name: Python Best Practices
description: A collection of best practices
globs: ["**/*.py"]
rules:

---

- Use snake_case for variable names.
- Avoid using magic numbers, use constants instead.
Expand Down
6 changes: 5 additions & 1 deletion .continue/rules/python_rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ description: A description of your rule

---

- Use `uv add` to install python dependencies.
- Always use `uv add` to install python dependencies.
- Always use `uv run` to run python scripts or commands. Example: `uv run python src/main.py` or `uv run pytest src/tests/`.
- Always use `uv sync` to syncronize dependencies from pyproject.toml.
- Always use `uv remove` to remove dependencies.
- Always use `.venv/bin/python` to run python.
8 changes: 6 additions & 2 deletions commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Crear base de datos vectorial")
parser.add_argument("--create", action="store_true", help="Crear la base de datos vectorial")
parser.add_argument("--download", action="store_true", help="Descargar datos desde Google Drive")
parser.add_argument(
"--download", action="store_true", help="Descargar datos desde Google Drive"
)
parser.add_argument("--fill", action="store_true", help="Rellenar la base de datos con datos")

args = parser.parse_args()
Expand All @@ -20,4 +22,6 @@
fill_database.fill_database()
print("Base de datos rellena exitosamente.")
else:
print("Por favor, usa --create para crear la base de datos vectorial, --download para descargar datos o --fill para rellenar la base de datos.")
print(
"Por favor, usa --create para crear la base de datos vectorial, --download para descargar datos o --fill para rellenar la base de datos."
)
53 changes: 34 additions & 19 deletions notebooks/test_agent.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,33 @@
" get_topic_prompt_builder,\n",
" get_embedding_model,\n",
" get_agent,\n",
" get_election_searcher,\n",
")\n",
"from src.mongo import get_mongo_db\n",
"from src import ENV\n",
"from src.agent.schemas import Topic\n",
"from src.agent.schemas import Platform, Topic\n",
"from langchain_chroma import Chroma\n",
"from langchain_openai import OpenAIEmbeddings, ChatOpenAI\n",
"from langchain_core.chat_history import InMemoryChatMessageHistory\n",
"from IPython.display import display, Markdown\n",
"from langchain_core.messages import AIMessage, HumanMessage\n"
"from langchain_core.messages import AIMessage, HumanMessage"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "fdad5438",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"MongoDB connected successfully\n"
]
}
],
"outputs": [],
"source": [
"chat_model = get_chat_model()\n",
"emb_model = get_embedding_model()\n",
"topic_selector = get_topic_selector()\n",
"db = get_mongo_db()\n",
"vector_db = get_mongo_vdb(emb_model, db)\n",
"rag_engine = get_rag_engine(vector_db)\n",
"topic_prompt_builder = get_topic_prompt_builder(db)"
"search_election = get_election_searcher(chat_model, vector_db)\n",
"topic_prompt_builder = get_topic_prompt_builder(db, vector_db, search_election)"
]
},
{
Expand Down Expand Up @@ -92,16 +86,21 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 6,
"id": "51be3c0b",
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"No se encontró información específica sobre los candidatos en las elecciones en la información recuperada. \n",
"La información recuperada no incluye detalles específicos sobre cómo programar en Python para consultar candidatos. Sin embargo, puedo indicarte que en las elecciones generales de Bolivia de 2025, las candidaturas son las siguientes:\n",
"\n",
"Puedes encontrar más detalles en el siguiente enlace: [programas de gobierno](https://www.chequeatuvoto.chequeabolivia.bo/#parties)"
"- **Alianza Libertad y Democracia (LIBRE)**: Jorge \"Tuto\" Quiroga - Presidente, Juan Pablo Velasco - Vice-presidente.\n",
"- **Partido Demócrata Cristiano (PDC)**: Rodrigo Paz - Presidente, Edman Lara - Vice-presidente.\n",
"\n",
"Para consultar candidatos, generalmente se puede acceder a la fuente oficial o a bases de datos públicas, pero en el CONTEXTO no se proporciona un API o una fuente específica para realizar consultas programáticas. \n",
"\n",
"¿Quieres que te ayude a crear un ejemplo de cómo estructurar un script en Python para consultar datos de candidatos si tuvieras una API o un archivo de datos?"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
Expand All @@ -114,27 +113,43 @@
"source": [
"if query and result:\n",
" history.extend([HumanMessage(query), AIMessage(result)])\n",
"query = \"y quienes son los candidatos?\"\n",
"query = \"entonces programa en python un script para consultar los candidatos\"\n",
"result = \"\"\n",
"async for token in agent.stream([*history, HumanMessage(content=query)]):\n",
" if token.type == \"info\" or token.type == \"error\":\n",
" display(Markdown(token.content), clear=True)\n",
" continue\n",
" result += token.content\n",
" display(Markdown(result), clear=True)\n",
"display(Markdown(result), clear=True)"
"# display(Markdown(result), clear=False)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "6b905a9a",
"metadata": {},
"outputs": [],
"source": [
"%rm -rf chroma_db\n",
"%cp -r ../chroma_db .\n"
"%cp -r ../chroma_db ."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f4a8cdc7",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "75bae7f3",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies = [
"langchain-mongodb>=0.7.0",
"langchain-nebius>=0.1.3",
"langchain-openai>=0.3.28",
"pydantic>=2.11.7",
"pydantic-settings>=2.10.1",
"pymongo>=4.15.1",
"pytest-asyncio>=1.1.0",
Expand All @@ -28,13 +29,17 @@ dependencies = [

[dependency-groups]
dev = [
"bs4>=0.0.2",
"ipykernel>=6.30.1",
"ipywidgets>=8.1.7",
"mypy>=1.17.1",
"pandas>=2.3.3",
"pandas-stubs>=2.3.2.250926",
"pytest>=8.4.1",
"ruff>=0.12.5",
"types-pytz>=2025.2.0.20250809",
]

[tool.ruff]
line-length = 120
line-length = 100
include = ["./**/*.py", "./**/*.ipynb"]
Loading