whyhow-ai / knowledge-table

Knowledge Table is an open-source package designed to simplify extracting and exploring structured data from unstructured documents.
MIT License
196 stars 24 forks source link

[FEATURE] Seperate concerns in backend for modularity #16

Closed tomsmoker closed 5 days ago

tomsmoker commented 1 week ago

What

Expand backend file structure to be more modular, and seperate based on FastAPI principles.

Why

Make the application more testable and extensible to third party integrations.

Implementation guidance

Update file structure and all imports as follows:

backend/
├── Dockerfile
├── pyproject.toml
├── src/
│   └── knowledge_table_api/
│       ├── __init__.py
│       ├── main.py
│       ├── core/
│       │   ├── __init__.py
│       │   ├── config.py
│       │   └── dependencies.py
│       ├── api/
│       │   ├── __init__.py
│       │   └── v1/
│       │       ├── __init__.py
│       │       └── endpoints/
│       │           ├── __init__.py
│       │           ├── document.py
│       │           ├── graph.py
│       │           └── query.py
│       ├── models/
│       │   ├── __init__.py
│       │   ├── document.py
│       │   ├── graph.py
│       │   ├── llm_response.py
│       │   └── query.py
│       ├── schemas/
│       │   ├── __init__.py
│       │   ├── document.py
│       │   ├── graph.py
│       │   └── query.py
│       ├── services/
│       │   ├── __init__.py
│       │   ├── document_service.py
│       │   ├── graph_service.py
│       │   ├── llm/
│       │   │   ├── __init__.py
│       │   │   ├── base.py
│       │   │   ├── openai_service.py
│       │   │   ├── factory.py
│       │   │   ├── prompts.py
│       │   │   └── {other_providers}.py
│       │   ├── vector_db/
│       │   │   ├── __init__.py
│       │   │   ├── base.py
│       │   │   ├── milvus_service.py
│       │   │   └── factory.py
│       │   ├── query_service.py
│       └── utils/
│           ├── __init__.py
│           └── json_encoder.py
└── tests/
    ├── __init__.py
    ├── test_main.py
    ├── test_services.py
    └── ...