
thinkgpt
Python library giving LLMs memory, self-refinement and reasoning helpers for developers
thinkgpt is an open-source agent framework for ai models and llm tooling. It is available on CLI and Self-hosted.
- Pricing
- Open source
- Platforms
- CLI, Self-hosted
- GitHub stars
- 1.6K
- Last commit
- Language
- Python
- License
- Apache-2.0
Similar agents
About thinkgpt
ThinkGPT is a Python library that wraps large language models with building blocks for longer memory and multi-step reasoning. Developers can store text in a searchable memory, retrieve the most relevant entries within a token budget, and feed them back into a prompt, which helps when a model's context window is too small for the material at hand.
Beyond memory, the library offers helpers to critique and rewrite model output, summarize long documents either in one pass or chunk by chunk, abstract general rules from a list of observations, and turn yes/no or multiple-choice decisions into simple method calls. Storage is handled through DocArray, and the API is designed to fit into ordinary Python code.
It suits developers building agents or scripts that need an LLM to remember past interactions, compress knowledge, or make conditional choices without writing prompt plumbing from scratch. The examples folder includes replay-style agents inspired by the Generative Agents and Self-Refine papers.
What it does
- Long-term memory store
- Save text to a memory the model can query later and retrieve by relevance.
- Token-limited retrieval
- Fetch stored entries up to a set count or maximum token size to fit a context window.
- Self-refinement
- Rewrite generated content by feeding back critiques and an instruction hint.
- Summarization modes
- Summarize content in a single call or split large documents into chunks.
- Rule abstraction
- Derive higher-level general rules from a set of specific observations.
- Natural language conditions
- Let the model answer boolean conditions or choose among listed options.
Good for
- Give a chatbot persistent memory of earlier conversations
- Compress long documentation so it fits inside a model's context
- Automatically fix code errors by feeding back interpreter messages
- Build agents that replay and refine their own stored observations
- Add LLM-driven branching decisions to an existing Python codebase
Pricing
Open source
Open source under Apache-2.0; uses your own LLM API access.
thinkgpt FAQ
How do I install ThinkGPT?
Install it with pip directly from a Git repository URL, as shown in the README.
Which models does thinkgpt work with?
The examples use OpenAI's gpt-3.5-turbo model through the ThinkGPT class.
How does memory retrieval limit results?
You can cap results with a limit parameter or a max_tokens parameter to fit a target context size.
Is thinkgpt free?
Yes. thinkgpt is open source, so you can use and self-host it for free.
What are the best alternatives to thinkgpt?
The closest alternatives to thinkgpt are DemoGPT, hindsight, llm_agents, llama-cpp-agent and agentic-context-engine.
Where this comes from
- Description: written from the project's README.



