Cortexa
Cortexa is a fast, local-first AI assistant for Python. It lets you use a real large language model (LLM) directly from Python with a clean, minimal API.
- ✅ Runs locally (no API keys required)
- ✅ Uses Ollama as the AI engine
- ✅ Streams responses (fast, ChatGPT-style typing)
- ✅ Concise, readable terminal output
- ✅ Simple
import cortexausage
What Cortexa Is (and Is Not)
Cortexa is:
- A Python library that talks to a local AI model
- Free and offline after setup
- Ideal for learning, projects, and experimentation
Cortexa is not:
- A hosted cloud service
- A replacement for installing an AI runtime
Cortexa uses Ollama to run models locally. Ollama is required.
Requirements
- Python 3.8+
- Ollama installed (one-time)
Download Ollama from: https://ollama.com
Installation
1. Install Ollama
After installing Ollama, restart your computer.
Pull a model:
ollama pull llama3
Make sure Ollama is running:
ollama serve
(Or just open the Ollama app.)
2. Install Cortexa
Once published to PyPI:
pip install cortexa
For local development:
pip install requests
Basic Usage
import cortexa
ai = cortexa.Cortexa()
ai.chat("Explain recursion simply")
ai.chat("Write a Python function to reverse a list")
Responses stream live in the terminal.
Features
- Streaming output (fast, responsive)
- Concise answers by default
- Terminal-friendly formatting
- Conversation memory (limited for speed)
- Offline & private
Configuration
ai = cortexa.Cortexa(
model="llama3", # Any Ollama model
max_history=4, # Context window size
width=80 # Terminal wrap width
)
Smaller models = faster responses.
Troubleshooting
Ollama already running error
This is normal:
Only one usage of each socket address is permitted
It means Ollama is already running.
Slow responses
- Use a smaller model
- Reduce
max_history - Make sure no other heavy apps are running
Project Structure
cortexa/
│
├── cortexa/
│ ├── __init__.py
│ ├── core.py
│ ├── llm.py
│ ├── memory.py
│ └── prompts.py
│
└── test.py
License
MIT License
Disclaimer
Cortexa runs AI models locally using Ollama. Model quality, speed, and hardware usage depend on your system and chosen model.
Roadmap (Planned)
- CLI interface (
cortexa chat) - Hybrid local / API mode
- Tool usage (files, calculator)
- Persistent memory
Author
Samarth Ankit Chugh
Metadata
Release files for cortexa 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cortexa-1.0.1.tar.gz | 4.8 kB | Without provenance | Details for cortexa-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cortexa-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for cortexa-1.0.1-py3-none-any.whl |
Total release size: 10.1 kB
Release files / cortexa-1.0.1.tar.gz
| Download URL | cortexa-1.0.1.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f148de97f22128210f07428efa68ea23c5929dbfec5dd629e55cee2d3d662ca9
|
|
BLAKE2b-256 checksum How to use checksums |
880c79fbec690af840c4897967d8645c9ffadd04b129b9a314a02624846fb882
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.13
|
Release files / cortexa-1.0.1-py3-none-any.whl
| Download URL | cortexa-1.0.1-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2265ff5da2228f114401997b6c566af9cc84152207f1d7c24d5ecf93648b5deb
|
|
BLAKE2b-256 checksum How to use checksums |
d91dcd215fb66e0f40bddb76e0dd1ae4e13b1330431b0a9d8d039b1d0079c0b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.13
|
Security for cortexa 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.