chore: scaffold companion project with deps and config
This commit is contained in:
11
.gitignore
vendored
Normal file
11
.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.egg-info/
|
||||
.pytest_cache/
|
||||
.mypy_cache/
|
||||
.venv/
|
||||
venv/
|
||||
.companion/
|
||||
dist/
|
||||
build/
|
||||
0
companion/__init__.py
Normal file
0
companion/__init__.py
Normal file
149
config.json
Normal file
149
config.json
Normal file
@@ -0,0 +1,149 @@
|
||||
{
|
||||
"companion": {
|
||||
"name": "SAN",
|
||||
"persona": {
|
||||
"role": "companion",
|
||||
"tone": "reflective",
|
||||
"style": "questioning",
|
||||
"boundaries": [
|
||||
"does_not_impersonate_user",
|
||||
"no_future_predictions",
|
||||
"no_medical_or_legal_advice"
|
||||
]
|
||||
},
|
||||
"memory": {
|
||||
"session_turns": 20,
|
||||
"persistent_store": "~/.companion/memory.db",
|
||||
"summarize_after": 10
|
||||
},
|
||||
"chat": {
|
||||
"streaming": true,
|
||||
"max_response_tokens": 2048,
|
||||
"default_temperature": 0.7,
|
||||
"allow_temperature_override": true
|
||||
}
|
||||
},
|
||||
"vault": {
|
||||
"path": "./sample-data/Default",
|
||||
"indexing": {
|
||||
"auto_sync": true,
|
||||
"auto_sync_interval_minutes": 1440,
|
||||
"watch_fs_events": true,
|
||||
"file_patterns": ["*.md"],
|
||||
"deny_dirs": [".obsidian", ".trash", "zzz-Archive", ".git", ".logseq"],
|
||||
"deny_patterns": ["*.tmp", "*.bak", "*conflict*", ".*"]
|
||||
},
|
||||
"chunking_rules": {
|
||||
"default": {
|
||||
"strategy": "sliding_window",
|
||||
"chunk_size": 500,
|
||||
"chunk_overlap": 100
|
||||
},
|
||||
"Journal/**": {
|
||||
"strategy": "section",
|
||||
"section_tags": ["#DayInShort", "#mentalhealth", "#physicalhealth", "#work", "#finance", "#Relations"],
|
||||
"chunk_size": 300,
|
||||
"chunk_overlap": 50
|
||||
},
|
||||
"zzz-Archive/**": {
|
||||
"strategy": "sliding_window",
|
||||
"chunk_size": 800,
|
||||
"chunk_overlap": 150
|
||||
}
|
||||
}
|
||||
},
|
||||
"rag": {
|
||||
"embedding": {
|
||||
"provider": "ollama",
|
||||
"model": "mxbai-embed-large",
|
||||
"base_url": "http://localhost:11434",
|
||||
"dimensions": 1024,
|
||||
"batch_size": 32
|
||||
},
|
||||
"vector_store": {
|
||||
"type": "lancedb",
|
||||
"path": "./.companion/vectors.lance"
|
||||
},
|
||||
"search": {
|
||||
"default_top_k": 8,
|
||||
"max_top_k": 20,
|
||||
"similarity_threshold": 0.75,
|
||||
"hybrid_search": {
|
||||
"enabled": true,
|
||||
"keyword_weight": 0.3,
|
||||
"semantic_weight": 0.7
|
||||
},
|
||||
"filters": {
|
||||
"date_range_enabled": true,
|
||||
"tag_filter_enabled": true,
|
||||
"directory_filter_enabled": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"inference": {
|
||||
"backend": "llama.cpp",
|
||||
"model_path": "~/.companion/models/companion-7b-q4.gguf",
|
||||
"context_length": 8192,
|
||||
"gpu_layers": 35,
|
||||
"batch_size": 512,
|
||||
"threads": 8
|
||||
},
|
||||
"fine_tuning": {
|
||||
"base_model": "unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit",
|
||||
"output_dir": "~/.companion/training",
|
||||
"lora_rank": 16,
|
||||
"lora_alpha": 32,
|
||||
"learning_rate": 0.0002,
|
||||
"batch_size": 4,
|
||||
"gradient_accumulation_steps": 4,
|
||||
"num_epochs": 3,
|
||||
"warmup_steps": 100,
|
||||
"save_steps": 500,
|
||||
"eval_steps": 250,
|
||||
"training_data_path": "~/.companion/training_data/",
|
||||
"validation_split": 0.1
|
||||
},
|
||||
"retrain_schedule": {
|
||||
"auto_reminder": true,
|
||||
"default_interval_days": 90,
|
||||
"reminder_channels": ["chat_stream", "log"]
|
||||
}
|
||||
},
|
||||
"api": {
|
||||
"host": "127.0.0.1",
|
||||
"port": 7373,
|
||||
"cors_origins": ["http://localhost:5173"],
|
||||
"auth": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"ui": {
|
||||
"web": {
|
||||
"enabled": true,
|
||||
"theme": "obsidian",
|
||||
"features": {
|
||||
"streaming": true,
|
||||
"citations": true,
|
||||
"source_preview": true
|
||||
}
|
||||
},
|
||||
"cli": {
|
||||
"enabled": true,
|
||||
"rich_output": true
|
||||
}
|
||||
},
|
||||
"logging": {
|
||||
"level": "INFO",
|
||||
"file": "./.companion/logs/companion.log",
|
||||
"max_size_mb": 100,
|
||||
"backup_count": 5
|
||||
},
|
||||
"security": {
|
||||
"local_only": true,
|
||||
"vault_path_traversal_check": true,
|
||||
"sensitive_content_detection": true,
|
||||
"sensitive_patterns": ["#mentalhealth", "#physicalhealth", "#finance", "#Relations"],
|
||||
"require_confirmation_for_external_apis": true
|
||||
}
|
||||
}
|
||||
27
pyproject.toml
Normal file
27
pyproject.toml
Normal file
@@ -0,0 +1,27 @@
|
||||
[project]
|
||||
name = "companion"
|
||||
version = "0.1.0"
|
||||
description = "Personal companion AI with local RAG"
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
"pydantic>=2.0",
|
||||
"lancedb>=0.9.0",
|
||||
"pyarrow>=15.0.0",
|
||||
"requests>=2.31.0",
|
||||
"watchdog>=4.0.0",
|
||||
"typer>=0.12.0",
|
||||
"rich>=13.0.0",
|
||||
"numpy>=1.26.0",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
"pytest>=8.0.0",
|
||||
"pytest-asyncio>=0.23.0",
|
||||
"httpx>=0.27.0",
|
||||
"respx>=0.21.0",
|
||||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
Reference in New Issue
Block a user