parishad 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. parishad-0.1.0/.github/workflows/publish.yml +70 -0
  2. parishad-0.1.0/CHANGELOG.md +22 -0
  3. parishad-0.1.0/CODE_OF_CONDUCT.md +33 -0
  4. parishad-0.1.0/CONTRIBUTING.md +62 -0
  5. parishad-0.1.0/LICENSE +21 -0
  6. parishad-0.1.0/PKG-INFO +256 -0
  7. parishad-0.1.0/README.md +171 -0
  8. parishad-0.1.0/SECURITY.md +23 -0
  9. parishad-0.1.0/docs/assets/logo.jpeg +0 -0
  10. parishad-0.1.0/docs/assets/logo.svg +2 -0
  11. parishad-0.1.0/pyproject.toml +122 -0
  12. parishad-0.1.0/src/parishad/__init__.py +70 -0
  13. parishad-0.1.0/src/parishad/__main__.py +10 -0
  14. parishad-0.1.0/src/parishad/checker/__init__.py +25 -0
  15. parishad-0.1.0/src/parishad/checker/deterministic.py +644 -0
  16. parishad-0.1.0/src/parishad/checker/ensemble.py +496 -0
  17. parishad-0.1.0/src/parishad/checker/retrieval.py +546 -0
  18. parishad-0.1.0/src/parishad/cli/__init__.py +6 -0
  19. parishad-0.1.0/src/parishad/cli/code.py +3254 -0
  20. parishad-0.1.0/src/parishad/cli/main.py +1158 -0
  21. parishad-0.1.0/src/parishad/cli/prarambh.py +99 -0
  22. parishad-0.1.0/src/parishad/cli/sthapana.py +368 -0
  23. parishad-0.1.0/src/parishad/config/modes.py +139 -0
  24. parishad-0.1.0/src/parishad/config/pipeline.core.yaml +128 -0
  25. parishad-0.1.0/src/parishad/config/pipeline.extended.yaml +172 -0
  26. parishad-0.1.0/src/parishad/config/pipeline.fast.yaml +89 -0
  27. parishad-0.1.0/src/parishad/config/user_config.py +115 -0
  28. parishad-0.1.0/src/parishad/data/catalog.py +118 -0
  29. parishad-0.1.0/src/parishad/data/models.json +108 -0
  30. parishad-0.1.0/src/parishad/memory/__init__.py +79 -0
  31. parishad-0.1.0/src/parishad/models/__init__.py +181 -0
  32. parishad-0.1.0/src/parishad/models/backends/__init__.py +247 -0
  33. parishad-0.1.0/src/parishad/models/backends/base.py +211 -0
  34. parishad-0.1.0/src/parishad/models/backends/huggingface.py +318 -0
  35. parishad-0.1.0/src/parishad/models/backends/llama_cpp.py +239 -0
  36. parishad-0.1.0/src/parishad/models/backends/mlx_lm.py +141 -0
  37. parishad-0.1.0/src/parishad/models/backends/ollama.py +253 -0
  38. parishad-0.1.0/src/parishad/models/backends/openai_api.py +193 -0
  39. parishad-0.1.0/src/parishad/models/backends/transformers_hf.py +198 -0
  40. parishad-0.1.0/src/parishad/models/costs.py +385 -0
  41. parishad-0.1.0/src/parishad/models/downloader.py +1557 -0
  42. parishad-0.1.0/src/parishad/models/optimizations.py +871 -0
  43. parishad-0.1.0/src/parishad/models/profiles.py +610 -0
  44. parishad-0.1.0/src/parishad/models/reliability.py +876 -0
  45. parishad-0.1.0/src/parishad/models/runner.py +651 -0
  46. parishad-0.1.0/src/parishad/models/tokenization.py +287 -0
  47. parishad-0.1.0/src/parishad/orchestrator/__init__.py +24 -0
  48. parishad-0.1.0/src/parishad/orchestrator/config_loader.py +210 -0
  49. parishad-0.1.0/src/parishad/orchestrator/engine.py +1113 -0
  50. parishad-0.1.0/src/parishad/orchestrator/exceptions.py +14 -0
  51. parishad-0.1.0/src/parishad/roles/__init__.py +71 -0
  52. parishad-0.1.0/src/parishad/roles/base.py +712 -0
  53. parishad-0.1.0/src/parishad/roles/dandadhyaksha.py +163 -0
  54. parishad-0.1.0/src/parishad/roles/darbari.py +246 -0
  55. parishad-0.1.0/src/parishad/roles/majumdar.py +274 -0
  56. parishad-0.1.0/src/parishad/roles/pantapradhan.py +150 -0
  57. parishad-0.1.0/src/parishad/roles/prerak.py +357 -0
  58. parishad-0.1.0/src/parishad/roles/raja.py +345 -0
  59. parishad-0.1.0/src/parishad/roles/sacheev.py +203 -0
  60. parishad-0.1.0/src/parishad/roles/sainik.py +427 -0
  61. parishad-0.1.0/src/parishad/roles/sar_senapati.py +164 -0
  62. parishad-0.1.0/src/parishad/roles/vidushak.py +69 -0
  63. parishad-0.1.0/src/parishad/tools/__init__.py +7 -0
  64. parishad-0.1.0/src/parishad/tools/base.py +57 -0
  65. parishad-0.1.0/src/parishad/tools/fs.py +110 -0
  66. parishad-0.1.0/src/parishad/tools/perception.py +96 -0
  67. parishad-0.1.0/src/parishad/tools/retrieval.py +74 -0
  68. parishad-0.1.0/src/parishad/tools/shell.py +103 -0
  69. parishad-0.1.0/src/parishad/utils/__init__.py +7 -0
  70. parishad-0.1.0/src/parishad/utils/hardware.py +122 -0
  71. parishad-0.1.0/src/parishad/utils/logging.py +79 -0
  72. parishad-0.1.0/src/parishad/utils/scanner.py +164 -0
  73. parishad-0.1.0/src/parishad/utils/text.py +61 -0
  74. parishad-0.1.0/src/parishad/utils/tracing.py +133 -0
@@ -0,0 +1,70 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - "pyproject.toml"
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: write
13
+
14
+ jobs:
15
+ release:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: 0
21
+
22
+ - name: Set up Python
23
+ uses: actions/setup-python@v5
24
+ with:
25
+ python-version: "3.11"
26
+
27
+ - name: Install dependencies
28
+ run: |
29
+ python -m pip install --upgrade pip
30
+ pip install build toml
31
+
32
+ - name: Check version and tag
33
+ id: check_version
34
+ run: |
35
+ # Extract version from pyproject.toml
36
+ VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
37
+ echo "Detected version: $VERSION"
38
+
39
+ # Check if tag exists
40
+ if git rev-parse "v$VERSION" >/dev/null 2>&1; then
41
+ echo "Tag v$VERSION already exists. Skipping release."
42
+ echo "new_release=false" >> $GITHUB_OUTPUT
43
+ else
44
+ echo "New version detected!"
45
+ echo "new_release=true" >> $GITHUB_OUTPUT
46
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
47
+ fi
48
+
49
+ - name: Create Tag
50
+ if: steps.check_version.outputs.new_release == 'true'
51
+ env:
52
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53
+ run: |
54
+ VERSION=${{ steps.check_version.outputs.version }}
55
+ git config user.name "github-actions[bot]"
56
+ git config user.email "github-actions[bot]@users.noreply.github.com"
57
+ git tag -a "v$VERSION" -m "Release v$VERSION"
58
+ git push origin "v$VERSION"
59
+
60
+ - name: Build package
61
+ if: steps.check_version.outputs.new_release == 'true'
62
+ run: python -m build
63
+
64
+ - name: Publish to PyPI
65
+ if: steps.check_version.outputs.new_release == 'true'
66
+ uses: pypa/gh-action-pypi-publish@release/v1
67
+ with:
68
+ # Use trusted publishing (OpenID Connect) if configured,
69
+ # or fallback to PYPI_API_TOKEN secret
70
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,22 @@
1
+ # Changelog
2
+
3
+ All notable changes to the **Parishad** project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - Initial Release
9
+
10
+ ### Added
11
+ - **Core Architecture**: Structured Council of LLMs (Darbari, Majumdar, Sainik, Prerak, Raja).
12
+ - **Interactive TUI**: Real-time terminal dashboard with visual role tracking.
13
+ - **Unified CLI**: Single `parishad` command handles setup, permissions, and execution.
14
+ - **Slash Commands**: `/sabha`, `/scan`, `/roles`, `/history`, `/clear`.
15
+ - **Context Awareness**: Support for `@path/to/file` context injection in queries.
16
+ - **Vision**: `PerceptionTool` for analyzing images with local VLMs.
17
+ - **Local-First Backends**: Support for Ollama, Llama.cpp, MLX, and Transformers.
18
+ - **Documentation**: Professional README, contributing guidelines, and security policy.
19
+
20
+ ### Infrastructure
21
+ - **Cost Tracking**: Configurable token budgets per query.
22
+ - **Adaptive Routing**: Auto-selects model size (Small/Mid/Big) based on task complexity.
@@ -0,0 +1,33 @@
1
+ # Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as contributors and leaders pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ **Examples of behavior that contributes to a positive environment include:**
10
+
11
+ * Using welcoming and inclusive language
12
+ * Being respectful of differing viewpoints and experiences
13
+ * Gracefully accepting constructive criticism
14
+ * Focusing on what is best for the community
15
+ * Showing empathy towards other community members
16
+
17
+ **Examples of unacceptable behavior by participants include:**
18
+
19
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
+ * Trolling, insulting/derogatory comments, and personal or political attacks
21
+ * Public or private harassment
22
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Enforcement
26
+
27
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
28
+
29
+ ## Attribution
30
+
31
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
32
+
33
+ [homepage]: https://www.contributor-covenant.org
@@ -0,0 +1,62 @@
1
+ # Contributing to Parishad
2
+
3
+ Thank you for your interest in contributing to **Parishad**! We welcome contributions from the community to make this "Council of LLMs" even better.
4
+
5
+ ## 🚀 Getting Started
6
+
7
+ 1. **Fork the Repository**: Click the "Fork" button on the top right of the GitHub page.
8
+ 2. **Clone your Fork**:
9
+ ```bash
10
+ git clone https://github.com/YOUR_USERNAME/parishad.git
11
+ cd parishad
12
+ ```
13
+ 3. **Set up Development Environment**:
14
+ ```bash
15
+ # Create virtual environment
16
+ python3 -m venv venv
17
+ source venv/bin/activate
18
+
19
+ # Install development dependencies
20
+ pip install -e ".[dev]"
21
+ ```
22
+
23
+ ## 🛠️ Development Workflow
24
+
25
+ ### Code Style
26
+ We follow strict code quality standards "Claude Code" style.
27
+ - **Formatter**: `black` (line length 100)
28
+ - **Linter**: `ruff`
29
+ - **Type Checking**: `mypy`
30
+
31
+ Before submitting a PR, run:
32
+ ```bash
33
+ # Format code
34
+ black .
35
+
36
+ # Linting
37
+ ruff check .
38
+
39
+ # Type checking
40
+ mypy src
41
+ ```
42
+
43
+ ### Running Tests
44
+ Ensure all tests pass before submitting:
45
+ ```bash
46
+ pytest
47
+ ```
48
+
49
+ ## 📝 Pull Request Guidelines
50
+
51
+ 1. **Descriptive Title**: Use a clear title (e.g., `feat: Add new 'Sacheev' advisor role`).
52
+ 2. **Description**: Explain *what* changed and *why*.
53
+ 3. **Link Issues**: If this fixes an issue, link it (e.g., `Fixes #123`).
54
+ 4. **Tests**: Include new tests for new features.
55
+
56
+ ## 🐛 Reporting Issues
57
+
58
+ - Check existing issues before creating a new one.
59
+ - Use the **Bug Report** or **Feature Request** templates.
60
+ - Include reproduction steps and environment details (OS, Python version).
61
+
62
+ Thank you for helping us build the ultimate local LLM council! 🏛️
parishad-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Parishad Council
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,256 @@
1
+ Metadata-Version: 2.4
2
+ Name: parishad
3
+ Version: 0.1.0
4
+ Summary: A cost-aware, local-first council of heterogeneous LLMs for reliable reasoning, coding, and factual correctness
5
+ Project-URL: Homepage, https://github.com/parishad-council/parishad
6
+ Project-URL: Documentation, https://github.com/parishad-council/parishad#readme
7
+ Project-URL: Repository, https://github.com/parishad-council/parishad
8
+ Project-URL: Issues, https://github.com/parishad-council/parishad/issues
9
+ Author: Parishad Team
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: code-generation,council,llm,local-llm,multi-agent,reasoning
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: click>=8.0.0
24
+ Requires-Dist: httpx>=0.25.0
25
+ Requires-Dist: jsonschema>=4.0.0
26
+ Requires-Dist: numpy<2.0
27
+ Requires-Dist: openai>=1.0.0
28
+ Requires-Dist: pydantic-settings>=2.0.0
29
+ Requires-Dist: pydantic>=2.0.0
30
+ Requires-Dist: pyyaml>=6.0
31
+ Requires-Dist: rich>=13.0.0
32
+ Requires-Dist: tiktoken>=0.5.0
33
+ Provides-Extra: all
34
+ Requires-Dist: accelerate>=0.25.0; extra == 'all'
35
+ Requires-Dist: black>=23.0.0; extra == 'all'
36
+ Requires-Dist: chromadb>=0.5.0; extra == 'all'
37
+ Requires-Dist: datasets>=2.14.0; extra == 'all'
38
+ Requires-Dist: faiss-cpu>=1.7.0; extra == 'all'
39
+ Requires-Dist: llama-cpp-python>=0.2.0; extra == 'all'
40
+ Requires-Dist: mypy>=1.0.0; extra == 'all'
41
+ Requires-Dist: pandas>=2.0.0; extra == 'all'
42
+ Requires-Dist: pre-commit>=3.0.0; extra == 'all'
43
+ Requires-Dist: pypdf>=3.0.0; extra == 'all'
44
+ Requires-Dist: ruff>=0.1.0; extra == 'all'
45
+ Requires-Dist: sentence-transformers>=2.2.0; extra == 'all'
46
+ Requires-Dist: torch>=2.0.0; extra == 'all'
47
+ Requires-Dist: tqdm>=4.66.0; extra == 'all'
48
+ Requires-Dist: transformers>=4.35.0; extra == 'all'
49
+ Provides-Extra: benchmark
50
+ Requires-Dist: datasets>=2.14.0; extra == 'benchmark'
51
+ Requires-Dist: pandas>=2.0.0; extra == 'benchmark'
52
+ Requires-Dist: tqdm>=4.66.0; extra == 'benchmark'
53
+ Provides-Extra: cuda
54
+ Requires-Dist: accelerate>=0.25.0; extra == 'cuda'
55
+ Requires-Dist: auto-gptq>=0.6.0; extra == 'cuda'
56
+ Requires-Dist: autoawq>=0.1.0; extra == 'cuda'
57
+ Requires-Dist: bitsandbytes>=0.41.0; extra == 'cuda'
58
+ Requires-Dist: optimum>=1.16.0; extra == 'cuda'
59
+ Requires-Dist: protobuf>=4.0.0; extra == 'cuda'
60
+ Requires-Dist: torch>=2.0.0; extra == 'cuda'
61
+ Requires-Dist: transformers>=4.35.0; extra == 'cuda'
62
+ Provides-Extra: dev
63
+ Requires-Dist: black>=23.0.0; extra == 'dev'
64
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
65
+ Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
66
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
67
+ Provides-Extra: distributed
68
+ Requires-Dist: grpcio-tools>=1.50.0; extra == 'distributed'
69
+ Requires-Dist: grpcio>=1.50.0; extra == 'distributed'
70
+ Provides-Extra: local
71
+ Requires-Dist: accelerate>=0.25.0; extra == 'local'
72
+ Requires-Dist: llama-cpp-python>=0.2.0; extra == 'local'
73
+ Requires-Dist: torch>=2.0.0; extra == 'local'
74
+ Requires-Dist: transformers>=4.35.0; extra == 'local'
75
+ Provides-Extra: mlx
76
+ Requires-Dist: mlx-lm>=0.1.0; extra == 'mlx'
77
+ Provides-Extra: perception
78
+ Requires-Dist: markitdown>=0.0.1; extra == 'perception'
79
+ Provides-Extra: retrieval
80
+ Requires-Dist: chromadb>=0.5.0; extra == 'retrieval'
81
+ Requires-Dist: faiss-cpu>=1.7.0; extra == 'retrieval'
82
+ Requires-Dist: pypdf>=3.0.0; extra == 'retrieval'
83
+ Requires-Dist: sentence-transformers>=2.2.0; extra == 'retrieval'
84
+ Description-Content-Type: text/markdown
85
+
86
+ <div align="center">
87
+
88
+ ![Parishad Gradient Logo](docs/assets/logo.svg)
89
+
90
+ **A cost-aware, local-first council of heterogeneous LLMs for reliable reasoning, coding, and factual correctness.**
91
+
92
+ [![PyPI Version](https://img.shields.io/pypi/v/parishad?style=flat-square&color=orange)](https://pypi.org/project/parishad/)
93
+ [![Python Version](https://img.shields.io/pypi/pyversions/parishad?style=flat-square&color=blue)](https://pypi.org/project/parishad/)
94
+ [![License](https://img.shields.io/github/license/parishad-council/parishad?style=flat-square)](LICENSE)
95
+ [![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)
96
+ [![Type Checked](https://img.shields.io/badge/mypy-checked-blue.svg?style=flat-square)](http://mypy-lang.org/)
97
+
98
+ </div>
99
+
100
+ ---
101
+
102
+ ## 📖 Overview
103
+
104
+ **Parishad** (Hindi: *Council*) orchestrates multiple local language models into a structured reasoning pipeline. Instead of relying on a single massive model, Parishad coordinates specialized, smaller models (2B-34B parameters) into functional roles based on traditional Indian administrative titles.
105
+
106
+ This approach achieves **higher reliability** and **lower latency** on consumer hardware (Mac Silicon, NVIDIA GPUs) by assigning tasks to the most appropriate model slot (Small/Medium/Big) tailored to your compute budget.
107
+
108
+ ## ✨ Key Features
109
+
110
+ - **🏛️ Heterogeneous Model Council**: Seamlessly orchestrate varying model sizes (e.g., Phi-3 for syntax, Llama-3 for reasoning, Mixtral for judgment).
111
+ - **🖥️ Beautiful TUI Dashboard**: Real-time interactive terminal interface with visual role tracking, progress bars, and emoji indicators.
112
+ - **👁️ Vision Capabilities**: Integrated `PerceptionTool` allows the council to "see" and analyze images via local VLMs.
113
+ - **💰 Cost-Aware Execution**: Define token budgets per query; the council adapts its strategy to stay within limits.
114
+ - **🛡️ Structured Verification**: The `Prerak` (Checker) role actively challenges hallucinations using deterministic tools and cross-examination.
115
+ - **🔌 Local-First Backends**: Native support for **Ollama**, **Llama.cpp**, **MLX**, and **Transformers**.
116
+
117
+ ## 🏛️ The Three Sabhas (Council Configurations)
118
+
119
+ Parishad offers three distinct council sizes to balance speed, cost, and depth:
120
+
121
+ ### 1. Laghu Sabha (Fast Council)
122
+ * **Roles**: 5 (Darbari, Majumdar, Sainik, Prerak, Raja)
123
+ * **Use Case**: Quick queries, simple code generation, factual checks.
124
+ * **Models**: Optimized for Small/Mid models.
125
+
126
+ ### 2. Madhya Sabha (Core Council)
127
+ * **Roles**: 8 (Adds **Sar Senapati** [Coordinator], **Sacheev** [Secretary], **Dandadhyaksha** [Magistrate])
128
+ * **Use Case**: Balanced reasoning for standard development tasks.
129
+ * **Models**: Uses Mid/Big models for deeper analysis.
130
+
131
+ ### 3. Maha Sabha (Extended Council)
132
+ * **Roles**: 10 (Adds **Pantapradhan** [Prime Minister], **Vidushak** [Lateral Thinker])
133
+ * **Use Case**: Complex system design, creative problem solving, and strategic planning.
134
+ * **Models**: Full spectrum orchestration (Small + Mid + Big).
135
+
136
+ ## 🏗️ Architecture
137
+
138
+ Parishad organizes models into a directed graph of roles:
139
+
140
+ ```text
141
+ ┌───────────┐ ┌───────────┐ ┌───────────┐
142
+ │ DARBARI │ ──► │ MAJUMDAR │ ──► │ SAINIK │
143
+ │ (Refiner) │ │ (Planner) │ │ (Worker) │
144
+ └───────────┘ └───────────┘ └───────────┘
145
+
146
+
147
+ ┌───────────┐ ┌───────────┐ ┌───────────┐
148
+ │ RAJA │ ◄── │ PRERAK │ ◄── │ SYSTEM & │
149
+ │ (Judge) │ │ (Checker) │ │ TOOLS │
150
+ └───────────┘ └───────────┘ └───────────┘
151
+ ```
152
+
153
+ - **Darbari**: Normalizes vague user queries into structured task specifications.
154
+ - **Majumdar**: Decomposes complex tasks into stepwise execution plans.
155
+ - **Sainik**: Executes steps, writing code or generating content using tools.
156
+ - **Prerak**: Validates output against facts, schema, or safety policies.
157
+ - **Raja**: Synthesizes the final answer and assigns a confidence score.
158
+
159
+ ## 📦 Installation
160
+
161
+ ### Standard Install
162
+ ```bash
163
+ pip install parishad
164
+ ```
165
+
166
+ ### Optimized Install Options
167
+ Choose the backend that matches your hardware:
168
+
169
+ ```bash
170
+ # Apple Silicon (M1/M2/M3) - Recommended
171
+ pip install "parishad[mlx]"
172
+
173
+ # NVIDIA GPU / Local Parsing
174
+ pip install "parishad[local,cuda]"
175
+
176
+ # With Retrieval (RAG) capabilities
177
+ pip install "parishad[retrieval]"
178
+
179
+ # For Developers (Linting, Testing)
180
+ pip install "parishad[dev]"
181
+ ```
182
+
183
+ ## 🚀 Quick Start
184
+
185
+ ### 1. Launch & Setup
186
+ Run the main command to initialize the council. This automatically handles permissions, scans for models (Ollama/HF), and launches the TUI.
187
+
188
+ ```bash
189
+ parishad
190
+ ```
191
+
192
+ **Pro Tip:** Use `/sabha` to switch between council sizes (e.g., `laghu` for speed, `maha` for deep reasoning) and `/scan` to find new local models.
193
+
194
+ ### 2. CLI Direct Execution
195
+ Run a specific task without entering the interactive shell.
196
+
197
+ ```bash
198
+ parishad run --sabha madhyam "Analyze the 'data.csv' file and plot trends"
199
+ ```
200
+
201
+ ### 3. Python API
202
+ Integrate Parishad into your own applications.
203
+
204
+ ```python
205
+ from parishad import Parishad
206
+
207
+ # Initialize the council
208
+ council = Parishad(config="core")
209
+
210
+ # Execute a complex query
211
+ result = council.run("Design a scalable REST API architecture for a bookstore.")
212
+
213
+ print(f"Final Answer: {result.final_answer}")
214
+ print(f"Confidence: {result.confidence_score}/10")
215
+ # Full execution trace available in result.trace
216
+ ```
217
+
218
+ ## 🎮 Interactive Features
219
+
220
+ Unlock the full power of the council with these TUI capabilities:
221
+
222
+ ### ⚡ Slash Commands
223
+ Control the session without leaving the chat interface:
224
+ - **`/sabha [mode]`**: Switch council configuration instantly (e.g., `/sabha laghu` for speed, `/sabha maha` for power).
225
+ - **`/scan`**: Re-scan your system for newly downloaded models.
226
+ - **`/roles`**: View currently active roles, their models, and slot assignments.
227
+ - **`/history`**: View past queries and load previous traces.
228
+ - **`/clear`**: Reset the conversation context.
229
+
230
+ ### 📎 Context Awareness (@ Mentions)
231
+ Parishad allows you to "chat with your files". Directly reference local files in your query:
232
+ - **`@path/to/file.py`**: Reads the file and adds it to the context.
233
+ - **`@src/`**: Scans the directory structure.
234
+
235
+ Example:
236
+ > *"Analyze @src/main.py and refactor the ErrorHandler class."*
237
+
238
+
239
+ ## 🤝 Contributing
240
+
241
+ Contributions are welcome! Please follow these steps:
242
+
243
+ 1. Fork the repository.
244
+ 2. Install dev dependencies: `pip install -e ".[dev]"`
245
+ 3. Ensure code style compliance: `black . && ruff check .`
246
+ 4. Submit a Pull Request.
247
+
248
+ ## 📄 License
249
+
250
+ This project is licensed under the [MIT License](LICENSE).
251
+
252
+ ---
253
+
254
+ <div align="center">
255
+ <sub>Built with ❤️ by <a href="https://github.com/ommo007">Om Mohite</a> & <a href="https://github.com/Ashiiish-88">Ashish Prajapati</a>. Trusted by developers for local agentic workflows.</sub>
256
+ </div>
@@ -0,0 +1,171 @@
1
+ <div align="center">
2
+
3
+ ![Parishad Gradient Logo](docs/assets/logo.svg)
4
+
5
+ **A cost-aware, local-first council of heterogeneous LLMs for reliable reasoning, coding, and factual correctness.**
6
+
7
+ [![PyPI Version](https://img.shields.io/pypi/v/parishad?style=flat-square&color=orange)](https://pypi.org/project/parishad/)
8
+ [![Python Version](https://img.shields.io/pypi/pyversions/parishad?style=flat-square&color=blue)](https://pypi.org/project/parishad/)
9
+ [![License](https://img.shields.io/github/license/parishad-council/parishad?style=flat-square)](LICENSE)
10
+ [![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)
11
+ [![Type Checked](https://img.shields.io/badge/mypy-checked-blue.svg?style=flat-square)](http://mypy-lang.org/)
12
+
13
+ </div>
14
+
15
+ ---
16
+
17
+ ## 📖 Overview
18
+
19
+ **Parishad** (Hindi: *Council*) orchestrates multiple local language models into a structured reasoning pipeline. Instead of relying on a single massive model, Parishad coordinates specialized, smaller models (2B-34B parameters) into functional roles based on traditional Indian administrative titles.
20
+
21
+ This approach achieves **higher reliability** and **lower latency** on consumer hardware (Mac Silicon, NVIDIA GPUs) by assigning tasks to the most appropriate model slot (Small/Medium/Big) tailored to your compute budget.
22
+
23
+ ## ✨ Key Features
24
+
25
+ - **🏛️ Heterogeneous Model Council**: Seamlessly orchestrate varying model sizes (e.g., Phi-3 for syntax, Llama-3 for reasoning, Mixtral for judgment).
26
+ - **🖥️ Beautiful TUI Dashboard**: Real-time interactive terminal interface with visual role tracking, progress bars, and emoji indicators.
27
+ - **👁️ Vision Capabilities**: Integrated `PerceptionTool` allows the council to "see" and analyze images via local VLMs.
28
+ - **💰 Cost-Aware Execution**: Define token budgets per query; the council adapts its strategy to stay within limits.
29
+ - **🛡️ Structured Verification**: The `Prerak` (Checker) role actively challenges hallucinations using deterministic tools and cross-examination.
30
+ - **🔌 Local-First Backends**: Native support for **Ollama**, **Llama.cpp**, **MLX**, and **Transformers**.
31
+
32
+ ## 🏛️ The Three Sabhas (Council Configurations)
33
+
34
+ Parishad offers three distinct council sizes to balance speed, cost, and depth:
35
+
36
+ ### 1. Laghu Sabha (Fast Council)
37
+ * **Roles**: 5 (Darbari, Majumdar, Sainik, Prerak, Raja)
38
+ * **Use Case**: Quick queries, simple code generation, factual checks.
39
+ * **Models**: Optimized for Small/Mid models.
40
+
41
+ ### 2. Madhya Sabha (Core Council)
42
+ * **Roles**: 8 (Adds **Sar Senapati** [Coordinator], **Sacheev** [Secretary], **Dandadhyaksha** [Magistrate])
43
+ * **Use Case**: Balanced reasoning for standard development tasks.
44
+ * **Models**: Uses Mid/Big models for deeper analysis.
45
+
46
+ ### 3. Maha Sabha (Extended Council)
47
+ * **Roles**: 10 (Adds **Pantapradhan** [Prime Minister], **Vidushak** [Lateral Thinker])
48
+ * **Use Case**: Complex system design, creative problem solving, and strategic planning.
49
+ * **Models**: Full spectrum orchestration (Small + Mid + Big).
50
+
51
+ ## 🏗️ Architecture
52
+
53
+ Parishad organizes models into a directed graph of roles:
54
+
55
+ ```text
56
+ ┌───────────┐ ┌───────────┐ ┌───────────┐
57
+ │ DARBARI │ ──► │ MAJUMDAR │ ──► │ SAINIK │
58
+ │ (Refiner) │ │ (Planner) │ │ (Worker) │
59
+ └───────────┘ └───────────┘ └───────────┘
60
+
61
+
62
+ ┌───────────┐ ┌───────────┐ ┌───────────┐
63
+ │ RAJA │ ◄── │ PRERAK │ ◄── │ SYSTEM & │
64
+ │ (Judge) │ │ (Checker) │ │ TOOLS │
65
+ └───────────┘ └───────────┘ └───────────┘
66
+ ```
67
+
68
+ - **Darbari**: Normalizes vague user queries into structured task specifications.
69
+ - **Majumdar**: Decomposes complex tasks into stepwise execution plans.
70
+ - **Sainik**: Executes steps, writing code or generating content using tools.
71
+ - **Prerak**: Validates output against facts, schema, or safety policies.
72
+ - **Raja**: Synthesizes the final answer and assigns a confidence score.
73
+
74
+ ## 📦 Installation
75
+
76
+ ### Standard Install
77
+ ```bash
78
+ pip install parishad
79
+ ```
80
+
81
+ ### Optimized Install Options
82
+ Choose the backend that matches your hardware:
83
+
84
+ ```bash
85
+ # Apple Silicon (M1/M2/M3) - Recommended
86
+ pip install "parishad[mlx]"
87
+
88
+ # NVIDIA GPU / Local Parsing
89
+ pip install "parishad[local,cuda]"
90
+
91
+ # With Retrieval (RAG) capabilities
92
+ pip install "parishad[retrieval]"
93
+
94
+ # For Developers (Linting, Testing)
95
+ pip install "parishad[dev]"
96
+ ```
97
+
98
+ ## 🚀 Quick Start
99
+
100
+ ### 1. Launch & Setup
101
+ Run the main command to initialize the council. This automatically handles permissions, scans for models (Ollama/HF), and launches the TUI.
102
+
103
+ ```bash
104
+ parishad
105
+ ```
106
+
107
+ **Pro Tip:** Use `/sabha` to switch between council sizes (e.g., `laghu` for speed, `maha` for deep reasoning) and `/scan` to find new local models.
108
+
109
+ ### 2. CLI Direct Execution
110
+ Run a specific task without entering the interactive shell.
111
+
112
+ ```bash
113
+ parishad run --sabha madhyam "Analyze the 'data.csv' file and plot trends"
114
+ ```
115
+
116
+ ### 3. Python API
117
+ Integrate Parishad into your own applications.
118
+
119
+ ```python
120
+ from parishad import Parishad
121
+
122
+ # Initialize the council
123
+ council = Parishad(config="core")
124
+
125
+ # Execute a complex query
126
+ result = council.run("Design a scalable REST API architecture for a bookstore.")
127
+
128
+ print(f"Final Answer: {result.final_answer}")
129
+ print(f"Confidence: {result.confidence_score}/10")
130
+ # Full execution trace available in result.trace
131
+ ```
132
+
133
+ ## 🎮 Interactive Features
134
+
135
+ Unlock the full power of the council with these TUI capabilities:
136
+
137
+ ### ⚡ Slash Commands
138
+ Control the session without leaving the chat interface:
139
+ - **`/sabha [mode]`**: Switch council configuration instantly (e.g., `/sabha laghu` for speed, `/sabha maha` for power).
140
+ - **`/scan`**: Re-scan your system for newly downloaded models.
141
+ - **`/roles`**: View currently active roles, their models, and slot assignments.
142
+ - **`/history`**: View past queries and load previous traces.
143
+ - **`/clear`**: Reset the conversation context.
144
+
145
+ ### 📎 Context Awareness (@ Mentions)
146
+ Parishad allows you to "chat with your files". Directly reference local files in your query:
147
+ - **`@path/to/file.py`**: Reads the file and adds it to the context.
148
+ - **`@src/`**: Scans the directory structure.
149
+
150
+ Example:
151
+ > *"Analyze @src/main.py and refactor the ErrorHandler class."*
152
+
153
+
154
+ ## 🤝 Contributing
155
+
156
+ Contributions are welcome! Please follow these steps:
157
+
158
+ 1. Fork the repository.
159
+ 2. Install dev dependencies: `pip install -e ".[dev]"`
160
+ 3. Ensure code style compliance: `black . && ruff check .`
161
+ 4. Submit a Pull Request.
162
+
163
+ ## 📄 License
164
+
165
+ This project is licensed under the [MIT License](LICENSE).
166
+
167
+ ---
168
+
169
+ <div align="center">
170
+ <sub>Built with ❤️ by <a href="https://github.com/ommo007">Om Mohite</a> & <a href="https://github.com/Ashiiish-88">Ashish Prajapati</a>. Trusted by developers for local agentic workflows.</sub>
171
+ </div>
@@ -0,0 +1,23 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ Only the latest major version of **Parishad** is officially supported with security updates.
6
+
7
+ | Version | Supported |
8
+ | ------- | ------------------ |
9
+ | 0.1.x | :white_check_mark: |
10
+
11
+ ## Reporting a Vulnerability
12
+
13
+ We take security seriously. If you discover a security vulnerability in Parishad, please do **NOT** open a public issue.
14
+
15
+ Instead, please report it via email to:
16
+ **security@parishad-council.org** (Example)
17
+
18
+ Please include:
19
+ * A description of the vulnerability.
20
+ * Steps to reproduce the issue.
21
+ * Affected versions.
22
+
23
+ We will review your report and respond within 48 hours. Validated security patches will be prioritized for immediate release.
Binary file