Universal memory module for LLMs
Project description
๐ง Greeum v0.6.0
๐ฐ๐ท ํ๊ตญ์ด | ๐บ๐ธ English | ๐จ๐ณ ไธญๆ | ๐ฏ๐ต ๆฅๆฌ่ช | ๐ช๐ธ Espaรฑol | ๐ฉ๐ช Deutsch | ๐ซ๐ท Franรงais
๋ค๊ตญ์ด ์ง์ LLM ๋ ๋ฆฝ์ ์ธ ๊ธฐ์ต ๊ด๋ฆฌ ์์คํ
๐ ๊ฐ์
Greeum (๋ฐ์: ๊ทธ๋ฆฌ์)์ ๋ชจ๋ LLM(๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ)์ ์ฐ๊ฒฐํ ์ ์๋ ๋ฒ์ฉ ๊ธฐ์ต ๋ชจ๋๋ก์ ๋ค์๊ณผ ๊ฐ์ ๊ธฐ๋ฅ์ ์ ๊ณตํฉ๋๋ค:
- ์ฌ์ฉ์์ ๋ฐํ, ๋ชฉํ, ๊ฐ์ , ์๋ ๋ฑ ์ฅ๊ธฐ์ ์ธ ๊ธฐ๋ก ์ถ์
- ํ์ฌ ๋งฅ๋ฝ๊ณผ ๊ด๋ จ๋ ๊ธฐ์ต ํ์
- ๋ค๊ตญ์ด ํ๊ฒฝ์์์ ์๊ฐ ํํ ์ธ์ ๋ฐ ์ฒ๋ฆฌ
- "๊ธฐ์ต์ ๊ฐ์ง AI"๋ก์์ ๊ธฐ๋ฅ
์ด๋ฆ "Greeum"์ ํ๊ตญ์ด "๊ทธ๋ฆฌ์"์์ ์๊ฐ์ ๋ฐ์์ผ๋ฉฐ, ๊ธฐ์ต ์์คํ ์ ๋ณธ์ง์ ์๋ฒฝํ๊ฒ ๋ด๊ณ ์์ต๋๋ค.
Greeum์ RAG(Retrieval-Augmented Generation) ์ํคํ ์ฒ์ ๊ธฐ๋ฐํ LLM ๋ ๋ฆฝ์ ๋ฉ๋ชจ๋ฆฌ ์์คํ ์ ๋๋ค. ์ ๋ณด ์ ์ฅ ๋ฐ ๊ฒ์(block_manager.py), ๊ด๋ จ ๊ธฐ์ต ๊ด๋ฆฌ(cache_manager.py), ํ๋กฌํํธ ์ฆ๊ฐ(prompt_wrapper.py) ๋ฑ RAG์ ํต์ฌ ๊ตฌ์ฑ ์์๋ฅผ ๊ตฌํํ์ฌ ๋ ์ ํํ๊ณ ๋งฅ๋ฝ์ ๋ง๋ ์๋ต์ ์์ฑํฉ๋๋ค.
๐ ์ฃผ์ ๊ธฐ๋ฅ
- ๋ธ๋ก์ฒด์ธ ์ ์ฌ ๊ตฌ์กฐ์ ์ฅ๊ธฐ ๊ธฐ์ต(LTM): ๋ถ๋ณ์ฑ์ ๊ฐ์ง ๋ธ๋ก ๋จ์ ๋ฉ๋ชจ๋ฆฌ ์ ์ฅ์
- TTL ๊ธฐ๋ฐ์ ๋จ๊ธฐ ๊ธฐ์ต(STM): ์ผ์์ ์ผ๋ก ์ค์ํ ์ ๋ณด๋ฅผ ํจ์จ์ ์ผ๋ก ๊ด๋ฆฌ
- ์๋ฏธ์ ์ฐ๊ด์ฑ: ํค์๋/ํ๊ทธ/๋ฒกํฐ ๊ธฐ๋ฐ ๊ธฐ์ต ํ์ ์์คํ
- ์จ์ดํฌ์ธํธ ์บ์: ํ์ฌ ๋งฅ๋ฝ๊ณผ ๊ด๋ จ๋ ๊ธฐ์ต์ ์๋์ผ๋ก ๊ฒ์
- ํ๋กฌํํธ ์กฐํฉ๊ธฐ: ๊ด๋ จ ๊ธฐ์ต์ ํฌํจํ LLM ํ๋กฌํํธ ์๋ ์์ฑ
- ์๊ฐ์ ์ถ๋ก ๊ธฐ: ๋ค๊ตญ์ด ํ๊ฒฝ์์ ๊ณ ๊ธ ์๊ฐ ํํ ์ธ์ ์ฒ๋ฆฌ
- ๋ค๊ตญ์ด ์ง์: ํ๊ตญ์ด, ์์ด ๋ฑ ์๋ ์ธ์ด ๊ฐ์ง ๋ฐ ์ฒ๋ฆฌ
- Model Control Protocol: GreeumMCP ๋ณ๋ ํจํค์ง๋ฅผ ํตํด Cursor, Unity, Discord ๋ฑ ์ธ๋ถ ๋๊ตฌ ์ฐ๋ ์ง์
โ๏ธ ์ค์น ๋ฐฉ๋ฒ
-
์ ์ฅ์ ๋ณต์
git clone https://github.com/DryRainEnt/Greeum.git cd Greeum
-
์์กด์ฑ ์ค์น
pip install -r requirements.txt
๐งช ์ฌ์ฉ ๋ฐฉ๋ฒ
CLI ์ธํฐํ์ด์ค
# ์ฅ๊ธฐ ๊ธฐ์ต ์ถ๊ฐ
python cli/memory_cli.py add -c "์๋ก์ด ํ๋ก์ ํธ๋ฅผ ์์ํ๊ณ ์ ๋ง ํฅ๋ฏธ๋ก์์"
# ํค์๋๋ก ๊ธฐ์ต ๊ฒ์
python cli/memory_cli.py search -k "ํ๋ก์ ํธ,ํฅ๋ฏธ๋ก์ด"
# ์๊ฐ ํํ์ผ๋ก ๊ธฐ์ต ๊ฒ์
python cli/memory_cli.py search-time -q "3์ผ ์ ์ ๋ฌด์์ ํ์ง?" -l "ko"
# ๋จ๊ธฐ ๊ธฐ์ต ์ถ๊ฐ
python cli/memory_cli.py stm "์ค๋ ๋ ์จ๊ฐ ์ข๋ค์"
# ๋จ๊ธฐ ๊ธฐ์ต ์กฐํ
python cli/memory_cli.py get-stm
# ํ๋กฌํํธ ์์ฑ
python cli/memory_cli.py prompt -i "ํ๋ก์ ํธ๋ ์ด๋ป๊ฒ ์งํ๋๊ณ ์๋์?"
REST API ์๋ฒ
# API ์๋ฒ ์คํ
python api/memory_api.py
์น ์ธํฐํ์ด์ค: http://localhost:5000
API ์๋ํฌ์ธํธ:
- GET
/api/v1/health- ์ํ ํ์ธ - GET
/api/v1/blocks- ๋ธ๋ก ๋ชฉ๋ก ์กฐํ - POST
/api/v1/blocks- ๋ธ๋ก ์ถ๊ฐ - GET
/api/v1/search?keywords=keyword1,keyword2- ํค์๋ ๊ฒ์ - GET
/api/v1/search/time?query=yesterday&language=en- ์๊ฐ ํํ ๊ฒ์ - GET, POST, DELETE
/api/v1/stm- ๋จ๊ธฐ ๊ธฐ์ต ๊ด๋ฆฌ - POST
/api/v1/prompt- ํ๋กฌํํธ ์์ฑ - GET
/api/v1/verify- ๋ธ๋ก์ฒด์ธ ๋ฌด๊ฒฐ์ฑ ๊ฒ์ฆ
Python ๋ผ์ด๋ธ๋ฌ๋ฆฌ
from greeum import BlockManager, STMManager, CacheManager, PromptWrapper
from greeum.text_utils import process_user_input
from greeum.temporal_reasoner import TemporalReasoner
# ์ฌ์ฉ์ ์
๋ ฅ ์ฒ๋ฆฌ
user_input = "์๋ก์ด ํ๋ก์ ํธ๋ฅผ ์์ํ๊ณ ์ ๋ง ํฅ๋ฏธ๋ก์์"
processed = process_user_input(user_input)
# ๋ธ๋ก ๋งค๋์ ๋ก ๊ธฐ์ต ์ ์ฅ
block_manager = BlockManager()
block = block_manager.add_block(
context=processed["context"],
keywords=processed["keywords"],
tags=processed["tags"],
embedding=processed["embedding"],
importance=processed["importance"]
)
# ์๊ฐ ๊ธฐ๋ฐ ๊ฒ์ (๋ค๊ตญ์ด)
temporal_reasoner = TemporalReasoner(db_manager=block_manager, default_language="auto")
time_query = "3์ผ ์ ์ ๋ฌด์์ ํ์ง?"
time_results = temporal_reasoner.search_by_time_reference(time_query)
# ํ๋กฌํํธ ์์ฑ
cache_manager = CacheManager(block_manager=block_manager)
prompt_wrapper = PromptWrapper(cache_manager=cache_manager)
user_question = "ํ๋ก์ ํธ๋ ์ด๋ป๊ฒ ์งํ๋๊ณ ์๋์?"
prompt = prompt_wrapper.compose_prompt(user_question)
# LLM์ ์ ๋ฌ
# llm_response = call_your_llm(prompt)
๐งฑ ์ํคํ ์ฒ
greeum/
โโโ greeum/ # ํต์ฌ ๋ผ์ด๋ธ๋ฌ๋ฆฌ
โ โโโ block_manager.py # ์ฅ๊ธฐ ๊ธฐ์ต ๊ด๋ฆฌ
โ โโโ stm_manager.py # ๋จ๊ธฐ ๊ธฐ์ต ๊ด๋ฆฌ
โ โโโ cache_manager.py # ์จ์ดํฌ์ธํธ ์บ์
โ โโโ prompt_wrapper.py # ํ๋กฌํํธ ์กฐํฉ
โ โโโ text_utils.py # ํ
์คํธ ์ฒ๋ฆฌ ์ ํธ๋ฆฌํฐ
โ โโโ temporal_reasoner.py # ์๊ฐ ๊ธฐ๋ฐ ์ถ๋ก
โ โโโ embedding_models.py # ์๋ฒ ๋ฉ ๋ชจ๋ธ ํตํฉ
โโโ api/ # REST API ์ธํฐํ์ด์ค
โโโ cli/ # ๋ช
๋ น์ค ๋๊ตฌ
โโโ data/ # ๋ฐ์ดํฐ ์ ์ฅ ๋๋ ํ ๋ฆฌ
โโโ tests/ # ํ
์คํธ ์ค์ํธ
๋ธ๋์น ๊ด๋ฆฌ ๊ท์น
- main: ์์ ์ ์ธ ๋ฆด๋ฆฌ์ฆ ๋ฒ์ ๋ธ๋์น
- dev: ํต์ฌ ํผ์ณ ๊ฐ๋ฐ ๋ธ๋์น (๊ฐ๋ฐ ํ ํ ์คํธ ๊ฒ์ฆ์ด ์๋ฃ๋๋ฉด main์ผ๋ก ๋จธ์ง)
- test-collect: ์ฑ๋ฅ ์งํ ๋ฐ A/B ํ ์คํธ ๋ฐ์ดํฐ ์์ง์ฉ ๋ธ๋์น
๐ ์ฑ๋ฅ ํ ์คํธ
Greeum์ ๋ค์๊ณผ ๊ฐ์ ์์ญ์์ ์ฑ๋ฅ ํ ์คํธ๋ฅผ ์งํํฉ๋๋ค:
T-GEN-001: ์๋ต์ ๊ตฌ์ฒด์ฑ ์ฆ๊ฐ์จ
- Greeum ๋ฉ๋ชจ๋ฆฌ ํ์ฉ ์ ์๋ต ํ์ง ํฅ์๋ ์ธก์
- ํ๊ท 18.6% ํ์ง ํฅ์ ํ์ธ
- ๊ตฌ์ฒด์ ์ ๋ณด ํฌํจ๋ 4.2๊ฐ ์ฆ๊ฐ
T-MEM-002: ๋ฉ๋ชจ๋ฆฌ ๊ฒ์ Latency
- ์จ์ดํฌ์ธํธ ์บ์๋ฅผ ํตํ ๊ฒ์ ์๋ ํฅ์ ์ธก์
- ํ๊ท 5.04๋ฐฐ ์๋ ํฅ์ ํ์ธ
- 1,000๊ฐ ์ด์ ๋ฉ๋ชจ๋ฆฌ ๋ธ๋ก์์ ์ต๋ 8.67๋ฐฐ ์๋ ๊ฐ์
T-API-001: API ํธ์ถ ํจ์จ์ฑ
- ๊ธฐ์ต ๊ธฐ๋ฐ ๋งฅ๋ฝ ์ ๊ณต์ผ๋ก ์ธํ ์ฌ์ง๋ฌธ ๊ฐ์์จ ์ธก์
- ์ฌ์ง๋ฌธ ํ์์ฑ 78.2% ๊ฐ์ ํ์ธ
- API ํธ์ถ ํ์ ๊ฐ์๋ก ๋น์ฉ ์ ๊ฐ ํจ๊ณผ
๐ ๋ฉ๋ชจ๋ฆฌ ๋ธ๋ก ๊ตฌ์กฐ
{
"block_index": 143,
"timestamp": "2025-05-08T01:02:33",
"context": "์๋ก์ด ํ๋ก์ ํธ๋ฅผ ์์ํ๊ณ ์ ๋ง ํฅ๋ฏธ๋ก์์",
"keywords": ["ํ๋ก์ ํธ", "์์", "ํฅ๋ฏธ๋ก์ด"],
"tags": ["๊ธ์ ์ ", "์์", "๋๊ธฐ๋ถ์ฌ"],
"embedding": [0.131, 0.847, ...],
"importance": 0.91,
"hash": "...",
"prev_hash": "..."
}
๐ค ์ง์ ์ธ์ด
Greeum์ ๋ค์ ์ธ์ด์ ์๊ฐ ํํ ์ธ์์ ์ง์ํฉ๋๋ค:
- ๐ฐ๐ท ํ๊ตญ์ด: ํ๊ตญ์ด ์๊ฐ ํํ ๊ธฐ๋ณธ ์ง์ (์ด์ , ์ง๋์ฃผ, 3์ผ ์ ๋ฑ)
- ๐บ๐ธ ์์ด: ์์ด ์๊ฐ ํ์ ์์ ์ง์ (yesterday, 3 days ago ๋ฑ)
- ๐ ์๋ ๊ฐ์ง: ์ธ์ด๋ฅผ ์๋์ผ๋ก ๊ฐ์งํ๊ณ ์ ์ ํ ์ฒ๋ฆฌ
๐ ์๊ฐ์ ์ถ๋ก ์์
# ํ๊ตญ์ด
result = evaluate_temporal_query("3์ผ ์ ์ ๋ญ ํ์ด?", language="ko")
# ๋ฐํ๊ฐ: {detected: True, language: "ko", best_ref: {term: "3์ผ ์ "}}
# ์์ด
result = evaluate_temporal_query("What did I do 3 days ago?", language="en")
# ๋ฐํ๊ฐ: {detected: True, language: "en", best_ref: {term: "3 days ago"}}
# ์๋ ๊ฐ์ง
result = evaluate_temporal_query("What happened yesterday?")
# ๋ฐํ๊ฐ: {detected: True, language: "en", best_ref: {term: "yesterday"}}
๐ง ํ๋ก์ ํธ ํ์ฅ ๊ณํ
- Model Control Protocol: MCP ์ง์์ ๋ํด์๋ GreeumMCP ๋ ํฌ์งํ ๋ฆฌ๋ฅผ ํ์ธํ์ธ์ - Greeum์ Cursor, Unity, Discord ๋ฑ์ ๋๊ตฌ์ ์ฐ๊ฒฐํ ์ ์๋ ๋ณ๋์ ํจํค์ง์ ๋๋ค
- ๋ค๊ตญ์ด ์ง์ ๊ฐํ: ์ผ๋ณธ์ด, ์ค๊ตญ์ด, ์คํ์ธ์ด ๋ฑ ์ถ๊ฐ ์ธ์ด ์ง์
- ์๋ฒ ๋ฉ ๊ฐ์ : ์ค์ ์๋ฒ ๋ฉ ๋ชจ๋ธ ํตํฉ (์: sentence-transformers)
- ํค์๋ ์ถ์ถ ํฅ์: ์ธ์ด๋ณ ํค์๋ ์ถ์ถ ๊ตฌํ
- ํด๋ผ์ฐ๋ ํตํฉ: ๋ฐ์ดํฐ๋ฒ ์ด์ค ๋ฐฑ์๋ ์ถ๊ฐ (SQLite, MongoDB ๋ฑ)
- ๋ถ์ฐ ์ฒ๋ฆฌ: ๋๊ท๋ชจ ๋ฉ๋ชจ๋ฆฌ ๊ด๋ฆฌ๋ฅผ ์ํ ๋ถ์ฐ ์ฒ๋ฆฌ ๊ตฌํ
๐ ์น์ฌ์ดํธ
์น์ฌ์ดํธ ๋ฐฉ๋ฌธ: greeum.app
๐ ๋ผ์ด์ ์ค
MIT License
๐ฅ ๊ธฐ์ฌ
๋ฒ๊ทธ ๋ณด๊ณ , ๊ธฐ๋ฅ ์ ์, ํ ๋ฆฌํ์คํธ ๋ฑ ๋ชจ๋ ๊ธฐ์ฌ๋ฅผ ํ์ํฉ๋๋ค!
๐ฑ ์ฐ๋ฝ์ฒ
์ด๋ฉ์ผ: playtart@play-t.art
๐ v0.6.0 ํ์ด๋ผ์ดํธ (Python 3.12 ์ง์)
| ํญ๋ชฉ | ์ค๋ช |
|---|---|
| Python ํธํ์ฑ | 3.10 / 3.11 / 3.12 ํ ์คํธ ํต๊ณผ(Tox & CI) |
| Working Memory | STMWorkingSet ๋ก ํ์ฑ ์ฌ๋กฏ ๊ด๋ฆฌ |
| ๊ฒ์ ์ฑ๋ฅ | FAISS ๋ฒกํฐ ์ธ๋ฑ์ค + BERT Cross-Encoder ์ฌ๋ญํฌ |
| ํ๋กฌํํธ | ํ ํฐ-Budget ๊ธฐ๋ฐ ๊ธฐ์ต ์ฝ์ , KeyBERT ๊ณ ๊ธ ํค์๋ |
| Evolution | ๋ธ๋ก ์์ฝ/๋ณํฉ, ์์ถฉ ๋ ธํธ API |
๋น ๋ฅธ ์ค์น (Python 3.12 + ๋ชจ๋ ํ์ฅ ์์กด์ฑ)
python3.12 -m venv .venv && source .venv/bin/activate
pip install --upgrade pip
pip install greeum[all] # faiss + transformers + keybert + openai ์ง์
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 greeum-2.0.1.tar.gz.
File metadata
- Download URL: greeum-2.0.1.tar.gz
- Upload date:
- Size: 97.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
896d9356bf53393e18f58c0e59a4032d503a3d5245c2e63e164c1b64c1187259
|
|
| MD5 |
5a0683c9ca5757a6e39f2e53af0bc463
|
|
| BLAKE2b-256 |
5fd31e36a21ec0625988f9bc1abd52036771e1c50befab9ccd9c1a021e324e30
|
File details
Details for the file greeum-2.0.1-py3-none-any.whl.
File metadata
- Download URL: greeum-2.0.1-py3-none-any.whl
- Upload date:
- Size: 101.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c882ba54ab8c565383b4d98198eff8fc7ee03dbe4c97e2b294e886f9bd519c7b
|
|
| MD5 |
59b07b757e3c0237a690429ea8852739
|
|
| BLAKE2b-256 |
75babbc758f1249680035fff16a9298af8df4a5ca310d09bb1b9fcb1e7e023f3
|