c47b9474f4
- Added `text_manager.py` to handle the creation of text libraries via FastAPI. - Introduced database connection management in `conexion.py` using PostgreSQL credentials from environment variables. - Created abstract base class `EmbedderABC` in `Base_Embedder.py` for embedding models. - Developed `OpenAIEmbedder` class to generate embeddings using OpenAI's API. - Implemented `OpenAIEmbedderModel` and repository pattern for managing OpenAI embedders in `Openai_embedder_mmr.py`. - Established `Biblioteca` class for managing text libraries and their associated notes in `biblioteca.py`. - Created SQLAlchemy models and mappers for `Biblioteca` and `Nota` in `biblioteca_mmr.py` and `notas_biblioteca_mmr.py`. - Added functionality for dynamic table generation for notes associated with libraries. - Included comprehensive methods for adding, retrieving, and managing notes and libraries in their respective repositories.
144 lines
2.8 KiB
Plaintext
144 lines
2.8 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"id": "5206b9c6",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from src.ConexionSql.Postgres_conexion import PostgresConexion\n",
|
|
"from src.Credenciales.postgres_credencial_mmr import PostgresCredencialRepo\n",
|
|
"\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"id": "63a0b954",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from entrypoint.init_db import db_credencial\n",
|
|
"conexion_admin = PostgresConexion(db_credencial)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"id": "0575f424",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"\n",
|
|
"repo_cred = PostgresCredencialRepo(conexion_admin)\n",
|
|
"\n",
|
|
"\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"id": "a5266309",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"'PGCR20250510-02f3cf9610127084237'"
|
|
]
|
|
},
|
|
"execution_count": 4,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"repo_cred.add(db_credencial)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"id": "670c79b7",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Production_Fitz_db\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"modelo_cred = repo_cred.get_by_id(\"PGCR20250510-02f3cf9610127084237\")\n",
|
|
"\n",
|
|
"print(modelo_cred.titulo)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 6,
|
|
"id": "6cf421c7",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Estado de conexión: exito\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"# Conectar con la base de datos utilizando el modelo recuperado\n",
|
|
"conexion_db = PostgresConexion(modelo_cred)\n",
|
|
"# Verificar estado de conexión\n",
|
|
"estado = \"exito\" if conexion_db.probar_conexion() else \"fallo\"\n",
|
|
"\n",
|
|
"print(f\"Estado de conexión: {estado}\")\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 7,
|
|
"id": "feba1446",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"7Souw9SFD5P5RYpRWuTVvFkY7zlxATcN\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"print(modelo_cred.password)"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": ".venv",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.11.11"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|