Skip to content

Python Libraries Documentation

This directory contains documentation for all 33 Python libraries in the src/python/ directory.

Overview

The Python libraries form the foundation of the Bast AI platform, providing core utilities, database integrations, AI/ML services, and NLP capabilities.

Library Categories

Foundation Layer (Level 1)

Package Version Description Tests
base 0.6.5 Core utilities, FileIO, TextUtils, Crypto, Rate Limiter 15

Core Layer (Level 2)

Package Version Description Tests
config 0.6.4 Configuration management with Hydra 1

Infrastructure Layer (Level 3)

Package Version Description Tests
mongo 0.1.16 MongoDB integration 1
milvus 0.1.4 Milvus vector database 1
aws 0.1.5 AWS S3 operations 1
azure_index 0.1.1 Azure Cognitive Search 2
neo4j 0.1.1 Graph database with GraphRAG 1
oracle 0.1.4 Oracle DB and OCI 1
mssql 0.1.2 MS SQL Server 1
openai 0.1.6 OpenAI API integration 3
msgraph 0.1.2 Microsoft Graph API 1

AI/ML Services Layer (Level 4)

Package Version Description Tests
agno 0.5.3 Agent configuration and workflows 11
classifier 0.1.4 Text classification 1
graphrag 0.1.3 Graph-based RAG 3
llm_evaluation 0.1.0 LLM evaluation with RAGAS 3
model_base 0.3.2 Model management 1
langchain 0.1.0 LangChain integration 0
cot 0.1.1 Chain-of-thought generation 2

NLP/Text Processing Layer

Package Version Description Tests
spacy_token_parser 0.1.3 SpaCy-based parsing 14
tokenizer 0.1.3 Tokenization 9
segmenter 0.1.3 Text segmentation 11
timeparser 0.1.1 Date/time parsing 8
oureliza 0.1.1 ELIZA-style conversational agent 1

OWL/Knowledge Management Layer

Package Version Description Tests
build_owl 0.1.4 Build OWL ontologies 3
parse_owl 0.1.2 Parse OWL ontologies 11

Utility Services Layer

Package Version Description Tests
email 0.1.5 Email via MS Graph 1
htmlparser 0.1.2 HTML parsing with BeautifulSoup 1
rest 0.1.1 REST client utilities 1
slack 0.1.8 Slack bot integration 1
dvc 0.5.2 Data version control 1

Runtime & Services Layer

Package Version Description Tests
cat-runtime 0.2.0 CAT runtime with extension loader and hook system -
org-services 0.1.0 Organization services and tenant management -

Template

Package Version Description Tests
template_svc 0.1.0 Microservice template 2

Dependency Graph

bast-ai-base (Foundation)
    │
    └── bast-ai-config (Configuration)
            │
            ├── bast-ai-mongo
            ├── bast-ai-milvus
            ├── bast-ai-aws
            ├── bast-ai-azure-index
            ├── bast-ai-neo4j
            ├── bast-ai-oracle
            ├── bast-ai-mssql
            ├── bast-ai-openai
            └── bast-ai-msgraph
                    │
                    ├── bast-ai-agno
                    ├── bast-ai-classifier
                    ├── bast-ai-graphrag
                    ├── bast-ai-llm-evaluation
                    └── bast-ai-model-base

Test Coverage Summary

Category Test Files Integration Tests
Foundation 15 0
Core 1 0
Infrastructure 12 17
AI/ML Services 21 1
NLP/Text Processing 43 0
OWL/Knowledge 14 5
Utility Services 5 2

Total: 91 unit test files, 35 integration test files

Common Patterns

Module Structure

Each library follows this structure:

src/python/{name}/
├── bast_ai_{name}/          # Module code
│   ├── __init__.py
│   ├── bp/                   # Business Process layer
│   ├── svc/                  # Service layer
│   └── dmo/                  # Domain Model Objects (optional)
├── tests/                    # Unit tests
├── integration/              # Integration tests
├── BUILD                     # Pants build config
├── pyproject.toml           # Poetry config
├── README.md                # Documentation
├── CHANGELOG.md             # Version history
└── VERSION                  # Current version

Naming Conventions

  • Module: bast_ai_{name} (e.g., bast_ai_mongo)
  • Package: bast-ai-{name} (e.g., bast-ai-mongo)
  • Import: from bast_ai_{name} import ...

Base Class Usage

All services inherit from BastObject:

from bast_ai.base import BastObject

class MyService(BastObject):
    def __init__(self):
        BastObject.__init__(self, __name__)