chatcortex 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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Siddharth Saraswat
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,155 @@
1
+ Metadata-Version: 2.4
2
+ Name: chatcortex
3
+ Version: 0.1.0
4
+ Summary: A privacy-first, local document chatbot engine
5
+ Author: Siddharth Saraswat
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/siddharth1012/chatCortex
8
+ Requires-Python: >=3.9
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Dynamic: license-file
12
+
13
+ # ChatCortex
14
+
15
+ ChatCortex is a **privacy-first, local document chatbot engine** designed to be embedded into any application.
16
+ It enables teams to build document-aware conversational systems **without relying on cloud services**, while keeping all data within their own infrastructure.
17
+
18
+ ChatCortex is **library-first**, **API-agnostic**, and designed for production and enterprise use cases.
19
+
20
+ ---
21
+
22
+ ## Overview
23
+
24
+ Most document-based chat systems are tightly coupled to user interfaces, depend on external cloud services, or are difficult to integrate into existing platforms.
25
+
26
+ ChatCortex focuses exclusively on the **core infrastructure layer**, allowing developers to integrate document chat capabilities into their own systems with minimal overhead.
27
+
28
+ ---
29
+
30
+ ## Core Principles
31
+
32
+ - **Privacy-first**: All ingestion, retrieval, and inference occur locally
33
+ - **Library-first design**: Use directly as a Python SDK or wrap with custom APIs
34
+ - **Frontend-agnostic**: Compatible with any UI or client application
35
+ - **Backend-oriented**: Built as infrastructure, not a demo application
36
+ - **Simple and stable API**: Small public surface area intended for long-term stability
37
+
38
+ ---
39
+
40
+ ## Use Cases
41
+
42
+ ChatCortex can be used to build:
43
+
44
+ - Internal enterprise document chatbots
45
+ - Knowledge base assistants
46
+ - Policy, HR, and legal document Q&A systems
47
+ - On-premise or air-gapped AI assistants
48
+ - Custom chat APIs for proprietary frontends
49
+
50
+ ---
51
+
52
+ ## Quick Start
53
+
54
+ ```bash
55
+ pip install chatcortex
56
+
57
+ from chatcortex import ChatCortexEngine
58
+
59
+ engine = ChatCortexEngine()
60
+
61
+ # Ingest documents (v0.1 supports .txt files)
62
+ engine.ingest("./docs")
63
+
64
+ # Ask a question
65
+ response = engine.chat("What is covered in these documents?")
66
+ print(response)
67
+ ```
68
+ ---
69
+
70
+ ## Public API (v0.1)
71
+
72
+ ```
73
+ ChatCortexEngine(
74
+ config: ChatCortexConfig | None = None
75
+ )
76
+
77
+ engine.ingest(source: str)
78
+ engine.chat(message: str, session_id: Optional[str] = None) -> str
79
+ engine.reset_session(session_id: str)
80
+ ```
81
+ ---
82
+
83
+ ## Configuration
84
+
85
+ ```
86
+ from chatcortex.config import ChatCortexConfig
87
+ from chatcortex import ChatCortexEngine
88
+
89
+ config = ChatCortexConfig(
90
+ chunk_size=500,
91
+ chunk_overlap=100
92
+ )
93
+
94
+ engine = ChatCortexEngine(config)
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Design Philosophy
100
+
101
+ ChatCortex enforces a clear separation of responsibilities:
102
+
103
+ | Layer | Responsibility |
104
+ | ----------- | ------------------------------------------------- |
105
+ | Core Engine | Document ingestion, retrieval, session management |
106
+ | API Layer | Optional adapters (REST, gRPC, etc.) |
107
+ | Frontend | Fully owned by the integrator |
108
+
109
+
110
+ You are free to:
111
+
112
+ Use ChatCortex directly as a Python library
113
+
114
+ Wrap it with your own API layer
115
+
116
+ Integrate it into existing systems
117
+
118
+ Ignore any optional adapters
119
+
120
+ ---
121
+
122
+ ## Roadmap
123
+ v0.1 -> Core engine -> Local document ingestion -> Session handling
124
+
125
+ ## Planned
126
+
127
+ PDF ingestion -> Embeddings and vector database support (FAISS, Chroma) -> Streaming responses -> External connectors (S3, SharePoint) -> Optional FastAPI service wrapper
128
+
129
+ ---
130
+
131
+ ## Development Setup
132
+ ```
133
+ git clone https://github.com/yourusername/chatcortex
134
+ cd chatcortex
135
+ python -m venv .venv
136
+ source .venv/bin/activate
137
+ pip install -e .
138
+ ```
139
+
140
+ ---
141
+
142
+ ## License
143
+
144
+ MIT License
145
+
146
+ You are free to use, modify, and integrate ChatCortex into commercial and internal products.
147
+
148
+ ---
149
+
150
+ ## Project Goals
151
+
152
+ ChatCortex is built as infrastructure, not a demo application.
153
+
154
+ It is intended for teams that require a reusable, local-first document chatbot engine
155
+ without repeatedly rebuilding the same backend components.
@@ -0,0 +1,143 @@
1
+ # ChatCortex
2
+
3
+ ChatCortex is a **privacy-first, local document chatbot engine** designed to be embedded into any application.
4
+ It enables teams to build document-aware conversational systems **without relying on cloud services**, while keeping all data within their own infrastructure.
5
+
6
+ ChatCortex is **library-first**, **API-agnostic**, and designed for production and enterprise use cases.
7
+
8
+ ---
9
+
10
+ ## Overview
11
+
12
+ Most document-based chat systems are tightly coupled to user interfaces, depend on external cloud services, or are difficult to integrate into existing platforms.
13
+
14
+ ChatCortex focuses exclusively on the **core infrastructure layer**, allowing developers to integrate document chat capabilities into their own systems with minimal overhead.
15
+
16
+ ---
17
+
18
+ ## Core Principles
19
+
20
+ - **Privacy-first**: All ingestion, retrieval, and inference occur locally
21
+ - **Library-first design**: Use directly as a Python SDK or wrap with custom APIs
22
+ - **Frontend-agnostic**: Compatible with any UI or client application
23
+ - **Backend-oriented**: Built as infrastructure, not a demo application
24
+ - **Simple and stable API**: Small public surface area intended for long-term stability
25
+
26
+ ---
27
+
28
+ ## Use Cases
29
+
30
+ ChatCortex can be used to build:
31
+
32
+ - Internal enterprise document chatbots
33
+ - Knowledge base assistants
34
+ - Policy, HR, and legal document Q&A systems
35
+ - On-premise or air-gapped AI assistants
36
+ - Custom chat APIs for proprietary frontends
37
+
38
+ ---
39
+
40
+ ## Quick Start
41
+
42
+ ```bash
43
+ pip install chatcortex
44
+
45
+ from chatcortex import ChatCortexEngine
46
+
47
+ engine = ChatCortexEngine()
48
+
49
+ # Ingest documents (v0.1 supports .txt files)
50
+ engine.ingest("./docs")
51
+
52
+ # Ask a question
53
+ response = engine.chat("What is covered in these documents?")
54
+ print(response)
55
+ ```
56
+ ---
57
+
58
+ ## Public API (v0.1)
59
+
60
+ ```
61
+ ChatCortexEngine(
62
+ config: ChatCortexConfig | None = None
63
+ )
64
+
65
+ engine.ingest(source: str)
66
+ engine.chat(message: str, session_id: Optional[str] = None) -> str
67
+ engine.reset_session(session_id: str)
68
+ ```
69
+ ---
70
+
71
+ ## Configuration
72
+
73
+ ```
74
+ from chatcortex.config import ChatCortexConfig
75
+ from chatcortex import ChatCortexEngine
76
+
77
+ config = ChatCortexConfig(
78
+ chunk_size=500,
79
+ chunk_overlap=100
80
+ )
81
+
82
+ engine = ChatCortexEngine(config)
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Design Philosophy
88
+
89
+ ChatCortex enforces a clear separation of responsibilities:
90
+
91
+ | Layer | Responsibility |
92
+ | ----------- | ------------------------------------------------- |
93
+ | Core Engine | Document ingestion, retrieval, session management |
94
+ | API Layer | Optional adapters (REST, gRPC, etc.) |
95
+ | Frontend | Fully owned by the integrator |
96
+
97
+
98
+ You are free to:
99
+
100
+ Use ChatCortex directly as a Python library
101
+
102
+ Wrap it with your own API layer
103
+
104
+ Integrate it into existing systems
105
+
106
+ Ignore any optional adapters
107
+
108
+ ---
109
+
110
+ ## Roadmap
111
+ v0.1 -> Core engine -> Local document ingestion -> Session handling
112
+
113
+ ## Planned
114
+
115
+ PDF ingestion -> Embeddings and vector database support (FAISS, Chroma) -> Streaming responses -> External connectors (S3, SharePoint) -> Optional FastAPI service wrapper
116
+
117
+ ---
118
+
119
+ ## Development Setup
120
+ ```
121
+ git clone https://github.com/yourusername/chatcortex
122
+ cd chatcortex
123
+ python -m venv .venv
124
+ source .venv/bin/activate
125
+ pip install -e .
126
+ ```
127
+
128
+ ---
129
+
130
+ ## License
131
+
132
+ MIT License
133
+
134
+ You are free to use, modify, and integrate ChatCortex into commercial and internal products.
135
+
136
+ ---
137
+
138
+ ## Project Goals
139
+
140
+ ChatCortex is built as infrastructure, not a demo application.
141
+
142
+ It is intended for teams that require a reusable, local-first document chatbot engine
143
+ without repeatedly rebuilding the same backend components.
@@ -0,0 +1,5 @@
1
+ from .engine import ChatCortexEngine
2
+
3
+ __all__ = ["ChatCortexEngine"]
4
+
5
+ __version__ = "0.1.0"
@@ -0,0 +1,13 @@
1
+ #Configuration handling
2
+
3
+ from dataclasses import dataclass
4
+ from typing import Optional
5
+
6
+ @dataclass
7
+ class ChatCortexConfig:
8
+ embedding_model: str = "all-MiniLM-L6-v2"
9
+ vector_db: str = "faiss"
10
+ chunk_size: int = 500
11
+ chunk_overlap: int = 100
12
+ llm_model: str = "local"
13
+ persist_path: Optional[str] = None
@@ -0,0 +1,48 @@
1
+ #Core Engine (Public API)
2
+
3
+ from typing import Dict, Optional
4
+
5
+ from .config import ChatCortexConfig
6
+ from .ingestion import DocumentIngestor
7
+ from .retriever import Retriever
8
+ from .session import ChatSession
9
+ from .exceptions import SessionError
10
+
11
+
12
+ class ChatCortexEngine:
13
+ def __init__(self, config: ChatCortexConfig | None = None):
14
+ self.config = config or ChatCortexConfig()
15
+ self.ingestor = DocumentIngestor()
16
+ self.retriever = Retriever()
17
+ self.sessions: Dict[str, ChatSession] = {}
18
+
19
+ def ingest(self, source: str):
20
+ documents = self.ingestor.load_from_path(source)
21
+ self.retriever.index(documents)
22
+
23
+ def chat(self, message: str, session_id: Optional[str] = None) -> str:
24
+ session = self._get_or_create_session(session_id)
25
+ session.add_user_message(message)
26
+
27
+ context = self.retriever.retrieve(message)
28
+ response = self._generate_response(message, context)
29
+
30
+ session.add_assistant_message(response)
31
+ return response, session.session_id
32
+
33
+ def reset_session(self, session_id: str):
34
+ if session_id not in self.sessions:
35
+ raise SessionError("Session not found")
36
+ self.sessions[session_id].clear()
37
+
38
+ def _get_or_create_session(self, session_id: Optional[str]) -> ChatSession:
39
+ if session_id and session_id in self.sessions:
40
+ return self.sessions[session_id]
41
+
42
+ session = ChatSession(session_id)
43
+ self.sessions[session.session_id] = session
44
+ return session
45
+
46
+ def _generate_response(self, message: str, context: list[str]) -> str:
47
+ # v0.1 initial setup
48
+ return f"Answer Based on {len(context)} document(s)."
@@ -0,0 +1,17 @@
1
+ #Custom exceptions
2
+
3
+ class ChatCortexError(Exception):
4
+ """Base exception for ChatCortex"""
5
+
6
+ class ConfigurationError(ChatCortexError):
7
+ """Raised when configuration is invalid"""
8
+
9
+ class IngestionError(ChatCortexError):
10
+ """Raised when document ingestion fails"""
11
+
12
+ class RetrievalError(ChatCortexError):
13
+ """Raised when retrieval fails"""
14
+
15
+ class SessionError(ChatCortexError):
16
+ """Raised for session-related issues"""
17
+
@@ -0,0 +1,26 @@
1
+ #Document ingestion
2
+
3
+ from pathlib import Path
4
+ from typing import List
5
+
6
+ from .exceptions import IngestionError
7
+
8
+
9
+ class DocumentIngestor:
10
+ def load_from_path(self, path: str) -> List[str]:
11
+ p = Path(path)
12
+
13
+ if not p.exists():
14
+ raise IngestionError(f"Path does exist: {path}")
15
+
16
+ documents: List[str] = []
17
+
18
+ if p.is_file() and p.suffix == ".txt":
19
+ documents.append(p.read_text(encoding="utf-8"))
20
+ elif p.is_dir():
21
+ for file in p.rglob("*.txt"):
22
+ documents.append(file.read_text(encoding="utf-8"))
23
+ else:
24
+ raise IngestionError("Only .txt files are supported in v0.1")
25
+
26
+ return documents
@@ -0,0 +1,15 @@
1
+ #Vector retrieval
2
+
3
+ from typing import List
4
+
5
+
6
+ class Retriever:
7
+ def __init__(self):
8
+ self._documents: List[str] = []
9
+
10
+ def index(self, documents: List[str]):
11
+ self._documents.extend(documents)
12
+
13
+ def retrieve(self, query: str, k: int = 3) -> List[str]:
14
+ # v0.1: Simple retrievel
15
+ return self._documents[:k]
@@ -0,0 +1,19 @@
1
+ #Chat session and memoy
2
+
3
+ from typing import List, Dict
4
+ from uuid import uuid4
5
+
6
+
7
+ class ChatSession:
8
+ def __init__(self, session_id: str | None = None):
9
+ self.session_id = session_id or str(uuid4())
10
+ self.history: List[Dict[str, str]] = []
11
+
12
+ def add_user_message(self, message: str):
13
+ self.history.append({"role": "user", "content": message})
14
+
15
+ def add_assistant_message(self, message: str):
16
+ self.history.append({"role": "assistant", "content": message})
17
+
18
+ def clear(self):
19
+ self.history.clear()
@@ -0,0 +1,155 @@
1
+ Metadata-Version: 2.4
2
+ Name: chatcortex
3
+ Version: 0.1.0
4
+ Summary: A privacy-first, local document chatbot engine
5
+ Author: Siddharth Saraswat
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/siddharth1012/chatCortex
8
+ Requires-Python: >=3.9
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Dynamic: license-file
12
+
13
+ # ChatCortex
14
+
15
+ ChatCortex is a **privacy-first, local document chatbot engine** designed to be embedded into any application.
16
+ It enables teams to build document-aware conversational systems **without relying on cloud services**, while keeping all data within their own infrastructure.
17
+
18
+ ChatCortex is **library-first**, **API-agnostic**, and designed for production and enterprise use cases.
19
+
20
+ ---
21
+
22
+ ## Overview
23
+
24
+ Most document-based chat systems are tightly coupled to user interfaces, depend on external cloud services, or are difficult to integrate into existing platforms.
25
+
26
+ ChatCortex focuses exclusively on the **core infrastructure layer**, allowing developers to integrate document chat capabilities into their own systems with minimal overhead.
27
+
28
+ ---
29
+
30
+ ## Core Principles
31
+
32
+ - **Privacy-first**: All ingestion, retrieval, and inference occur locally
33
+ - **Library-first design**: Use directly as a Python SDK or wrap with custom APIs
34
+ - **Frontend-agnostic**: Compatible with any UI or client application
35
+ - **Backend-oriented**: Built as infrastructure, not a demo application
36
+ - **Simple and stable API**: Small public surface area intended for long-term stability
37
+
38
+ ---
39
+
40
+ ## Use Cases
41
+
42
+ ChatCortex can be used to build:
43
+
44
+ - Internal enterprise document chatbots
45
+ - Knowledge base assistants
46
+ - Policy, HR, and legal document Q&A systems
47
+ - On-premise or air-gapped AI assistants
48
+ - Custom chat APIs for proprietary frontends
49
+
50
+ ---
51
+
52
+ ## Quick Start
53
+
54
+ ```bash
55
+ pip install chatcortex
56
+
57
+ from chatcortex import ChatCortexEngine
58
+
59
+ engine = ChatCortexEngine()
60
+
61
+ # Ingest documents (v0.1 supports .txt files)
62
+ engine.ingest("./docs")
63
+
64
+ # Ask a question
65
+ response = engine.chat("What is covered in these documents?")
66
+ print(response)
67
+ ```
68
+ ---
69
+
70
+ ## Public API (v0.1)
71
+
72
+ ```
73
+ ChatCortexEngine(
74
+ config: ChatCortexConfig | None = None
75
+ )
76
+
77
+ engine.ingest(source: str)
78
+ engine.chat(message: str, session_id: Optional[str] = None) -> str
79
+ engine.reset_session(session_id: str)
80
+ ```
81
+ ---
82
+
83
+ ## Configuration
84
+
85
+ ```
86
+ from chatcortex.config import ChatCortexConfig
87
+ from chatcortex import ChatCortexEngine
88
+
89
+ config = ChatCortexConfig(
90
+ chunk_size=500,
91
+ chunk_overlap=100
92
+ )
93
+
94
+ engine = ChatCortexEngine(config)
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Design Philosophy
100
+
101
+ ChatCortex enforces a clear separation of responsibilities:
102
+
103
+ | Layer | Responsibility |
104
+ | ----------- | ------------------------------------------------- |
105
+ | Core Engine | Document ingestion, retrieval, session management |
106
+ | API Layer | Optional adapters (REST, gRPC, etc.) |
107
+ | Frontend | Fully owned by the integrator |
108
+
109
+
110
+ You are free to:
111
+
112
+ Use ChatCortex directly as a Python library
113
+
114
+ Wrap it with your own API layer
115
+
116
+ Integrate it into existing systems
117
+
118
+ Ignore any optional adapters
119
+
120
+ ---
121
+
122
+ ## Roadmap
123
+ v0.1 -> Core engine -> Local document ingestion -> Session handling
124
+
125
+ ## Planned
126
+
127
+ PDF ingestion -> Embeddings and vector database support (FAISS, Chroma) -> Streaming responses -> External connectors (S3, SharePoint) -> Optional FastAPI service wrapper
128
+
129
+ ---
130
+
131
+ ## Development Setup
132
+ ```
133
+ git clone https://github.com/yourusername/chatcortex
134
+ cd chatcortex
135
+ python -m venv .venv
136
+ source .venv/bin/activate
137
+ pip install -e .
138
+ ```
139
+
140
+ ---
141
+
142
+ ## License
143
+
144
+ MIT License
145
+
146
+ You are free to use, modify, and integrate ChatCortex into commercial and internal products.
147
+
148
+ ---
149
+
150
+ ## Project Goals
151
+
152
+ ChatCortex is built as infrastructure, not a demo application.
153
+
154
+ It is intended for teams that require a reusable, local-first document chatbot engine
155
+ without repeatedly rebuilding the same backend components.
@@ -0,0 +1,15 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ chatcortex/__init__.py
5
+ chatcortex/config.py
6
+ chatcortex/engine.py
7
+ chatcortex/exceptions.py
8
+ chatcortex/ingestion.py
9
+ chatcortex/retriever.py
10
+ chatcortex/session.py
11
+ chatcortex.egg-info/PKG-INFO
12
+ chatcortex.egg-info/SOURCES.txt
13
+ chatcortex.egg-info/dependency_links.txt
14
+ chatcortex.egg-info/top_level.txt
15
+ tests/test_engine.py
@@ -0,0 +1 @@
1
+ chatcortex
@@ -0,0 +1,17 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "chatcortex"
7
+ version = "0.1.0"
8
+ description = "A privacy-first, local document chatbot engine"
9
+ authors = [{ name = "Siddharth Saraswat" }]
10
+ readme = "README.md"
11
+ requires-python = ">=3.9"
12
+ license = { text = "MIT" }
13
+
14
+ dependencies = []
15
+
16
+ [project.urls]
17
+ Homepage = "https://github.com/siddharth1012/chatCortex"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes