A configurable, typed AI framework with swappable LLM, classifier, handlers, and optional memory
Project description
A configurable, typed AI framework with swappable LLM, classifier, handlers, and memory for Natural Language to Action apps
Quick Install
Using uv (Recommended)
# 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
# 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
# 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
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
LLMClientinterface - 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 file for details.
Contributing
Contributions are welcome! Please report any issues, bugs, improvements, or features on GitHub.
Support
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file struktx_ai-0.0.4b4.tar.gz.
File metadata
- Download URL: struktx_ai-0.0.4b4.tar.gz
- Upload date:
- Size: 111.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fc1ee6d71f9d7457cf52ef27f3c13fefc0d669b313d1cc593f21205dd01574b
|
|
| MD5 |
8a7db3c06291602ee5d0c0bd4aa74815
|
|
| BLAKE2b-256 |
18aaf64634b105b5360c9066fd50f28a955b2b9525a38f5284f8ad6a99a95ee5
|
File details
Details for the file struktx_ai-0.0.4b4-py3-none-any.whl.
File metadata
- Download URL: struktx_ai-0.0.4b4-py3-none-any.whl
- Upload date:
- Size: 140.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e71e35f6ddd6896c1a78b3c525723f30059b29e78bf7ea22d3a74ee9c10b98cb
|
|
| MD5 |
594b1226571ef15a2ef44e06990d89a2
|
|
| BLAKE2b-256 |
8df7034bb21957822ada6f7e20e25ab38372e409b0fbcc2731f474435b66b5c9
|