feat: Implement text manager API and database connection
- 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.
This commit is contained in:
+51
-12
@@ -5,15 +5,7 @@
|
||||
"execution_count": 1,
|
||||
"id": "26aa8e2b",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"✅ Credencial: Credencial_enmanuel\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from src.ApiKeys.openai_apikey import OpenAICredencial\n",
|
||||
"from src.ApiKeys.openai_apikey_mmr import OpenAICredencialRepo # Ajusta si está en otro módulo\n",
|
||||
@@ -24,14 +16,61 @@
|
||||
"conexion_admin = PostgresConexion(db_credencial)\n",
|
||||
"\n",
|
||||
"# 3. Guardar la credencial en la base de datos\n",
|
||||
"repo = OpenAICredencialRepo(conexion_admin)\n",
|
||||
"credencial_openai = repo.get_by_id(1)\n",
|
||||
"repo = OpenAICredencialRepo(conexion_admin)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "4c232ecd",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'OPAK20250510-ac2cea8af3110632314'"
|
||||
]
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# apikey_gpt = OpenAICredencial(titulo=\"Credencial_enmanuel_gpt\")\n",
|
||||
"# repo.add(apikey_gpt)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "32552452",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"✅ Credencial: Credencial_enmanuel_gpt\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"credencial_openai = repo.get_by_id('OPAK20250510-ac2cea8af3110632314')\n",
|
||||
"print(f\"✅ Credencial: {credencial_openai.titulo}\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": null,
|
||||
"id": "7464fa65",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "e5b665a6",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
|
||||
Reference in New Issue
Block a user