https://github.com/snowheapllc/struktx
A configurable, typed AI framework with swappable LLM, classifier, handlers, and optional memory for NLP to Action flows
https://github.com/snowheapllc/struktx
ai framework langchain llm openai python
Last synced: 6 months ago
JSON representation
A configurable, typed AI framework with swappable LLM, classifier, handlers, and optional memory for NLP to Action flows
- Host: GitHub
- URL: https://github.com/snowheapllc/struktx
- Owner: snowheapllc
- License: mit
- Created: 2025-08-17T23:55:21.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2025-09-19T20:54:11.000Z (6 months ago)
- Last Synced: 2025-09-29T18:13:34.345Z (6 months ago)
- Topics: ai, framework, langchain, llm, openai, python
- Language: Python
- Homepage: https://struktx.snowheap.ai
- Size: 6.77 MB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A configurable, typed AI framework with swappable LLM, classifier, handlers, and memory for Natural Language to Action apps
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)
## Quick Install
### Using uv (Recommended)
```bash
# Install with core dependencies only
uv pip install struktx-ai
# Install with LLM support (LangChain)
uv pip install struktx-ai[llm]
# Install with vector store support
uv pip install struktx-ai[vector]
# Install with all optional dependencies
uv pip install struktx-ai[all]
# Install for development
uv pip install struktx-ai[dev]
```
### Using pip
```bash
# Install with core dependencies only
pip install struktx-ai
# Install with LLM support (LangChain)
pip install struktx-ai[llm]
# Install with vector store support
pip install struktx-ai[vector]
# Install with all optional dependencies
pip install struktx-ai[all]
```
### Source
```bash
# Create virtual env
uv venv
# Activate environment
source .venv/bin/activate
# Sync and install pyproject dependencies
uv sync
# Install finall Strukt package
uv pip install struktx-ai[all]
```
## Quick Start with LangChain
```python
from strukt import create, StruktConfig, HandlersConfig, LLMClientConfig, ClassifierConfig
from strukt.classifiers.llm_classifier import DefaultLLMClassifier
from strukt.prompts import DEFAULT_CLASSIFIER_TEMPLATE
from strukt.examples.time_handler import TimeHandler
from langchain_openai import ChatOpenAI
from strukt.langchain_helpers import LangChainLLMClient
# Create LangChain LLM client
langchain_llm = ChatOpenAI(api_key="your-openai-api-key")
llm = LangChainLLMClient(langchain_llm)
app = create(StruktConfig(
llm=LLMClientConfig(llm),
classifier=ClassifierConfig(
factory=DefaultLLMClassifier(
llm=llm,
prompt_template=DEFAULT_CLASSIFIER_TEMPLATE,
allowed_types=["time_service", "weather", "general"],
max_parts=4,
)
),
handlers=HandlersConfig(
registry={"time_service": TimeHandler(llm)},
default_route="general",
),
))
app.invoke("What is the time in Tokyo?")
```
## What is StruktX?
StruktX is a Python framework for building AI applications with focus on natural language -> actions
- **🔄 Swappable Components**: LLM clients, classifiers, handlers, and memory engines
- **📝 Type Safety**: Full type hints and Pydantic models
- **⚙️ Configurable**: Factory-based configuration system
- **🔌 Extensible**: Easy to add custom components
- **🧠 Memory Support**: Optional conversation memory
- **🔧 Middleware**: Pre/post processing hooks
## Features
- **LLM Integration**: Support for any LLM via the `LLMClient` interface
- **Query Classification**: Route requests to appropriate handlers
- **Structured Outputs**: Pydantic model integration
- **Memory Engines**: Conversation history and context
- **Middleware System**: Pre/post processing hooks
- **LangChain Helpers**: Easy integration with LangChain ecosystem
## Requirements
- Python 3.10+
- Core: `pydantic>=2.0.0`, `python-dotenv>=1.0.0`
- Optional: LangChain packages, vector stores, etc.
## License
MIT License - see [LICENSE](LICENSE) file for details.
## Contributing
Contributions are welcome! Please report any issues, bugs, improvements, or features on GitHub.
## Support
- 📖 [Documentation](https://struktx.snowheap.ai/docs)
- 🐛 [Issue Tracker](https://github.com/snowheapllc/StruktX/issues)
- 💬 [Discussions](https://github.com/snowheapllc/StruktX/discussions)