This commit is contained in:
Nighthawk
2025-09-05 03:39:53 -04:00
parent af31ae8757
commit 7e22d69413
3 changed files with 8 additions and 6 deletions
+6 -4
View File
@@ -19,7 +19,6 @@ from .config import settings
from .logger import logger
# This block is for static analysis only (for Pylance).
# It is not executed at runtime, so it won't cause an ImportError.
if TYPE_CHECKING:
from chonkie import SemanticChunker
from chonkie.embeddings import SentenceTransformerEmbeddings
@@ -70,7 +69,11 @@ class MemoryManager:
raise ImportError("Chonkie is configured but not installed correctly. Please run 'uv pip install \"chonkie[st]\"'.")
logger.info("Initializing Chonkie with SemanticChunker...")
embedding_handler = SentenceTransformerEmbeddings(model_name=settings.memory.embedding_model, device="cpu")
# FIXED: Changed keyword from 'model_name' to 'model'
embedding_handler = SentenceTransformerEmbeddings(
model=settings.memory.embedding_model,
device="cpu"
)
self.chunker = SemanticChunker(embedding_model=embedding_handler)
self.embedder = embedding_handler
logger.info("Using 'chonkie' for text chunking.")
@@ -107,9 +110,8 @@ class MemoryManager:
if not text or not text.strip(): return
try:
if settings.memory.chunker == "chonkie" and self.chunker:
# The runtime code knows what self.chunker(text) returns
chonkie_chunks = self.chunker(text)
chunks = [c.text for c in chonkie_chunks if c.text.strip()] # type: ignore (This might break, we're see)
chunks = [c.text for c in chonkie_chunks if c.text.strip()] # type: ignore (This *might* break things)
else:
chunks = self._simple_chunker(text)
+2 -2
View File
@@ -20,7 +20,7 @@ llm:
# The model identifier for the chosen backend.
# Example for OpenRouter: "google/gemma-2-9b-it"
# Example for LM Studio: "gemma-2-9b-it-gguf" (or whatever you have loaded)
story_model: "google/gemma-3n-e4b"
story_model: "gemma-3-12b-it-GGUF"
# The format for sending player actions to the AI.
# "json": (Recommended) More reliable and less ambiguous for modern models.
@@ -62,7 +62,7 @@ audio:
memory:
# The chunking strategy to use for breaking down text for the RAG system.
# Options: "simple" (original method), "chonkie" (advanced library).
chunker: "simple"
chunker: "chonkie"
# The SentenceTransformer model used to create embeddings for the AI's
embedding_model: "google/embeddinggemma-300m"
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB