Memlayer Release Notes - v0.1.8
"Ollama Stability Update"
This patch release focuses on significantly improving the stability of the Ollama wrapper, specifically addressing issues with JSON parsing and support for local models that output internal thought processes.
Key Improvements
Support for "Thinking" Models (<think> tags)
Many modern local models output an internal monologue wrapped in <think>...</think> tags before providing the final JSON response. Previously, this caused JSONDecodeError because the parser attempted to read the thought process as data.
- Fix: The Ollama wrapper now identifies and strips
<think>tags via Regex before attempting to parse tool calls or knowledge extraction. - Result: You can now use models with "Chain of Thought" capabilities for memory operations without crashing.
Robust JSON Extraction
Local models are chatty. They often wrap JSON in Markdown code blocks (```json) or add conversational filler ("Here is the data...").
- Fix: Replaced strict
json.loadswith a robust Regex extraction strategy (_clean_and_parse_json). Memlayer now surgically locates the JSON object ({...}) inside the model's raw output, ignoring surrounding noise. - Addressed Errors: Fixes
Expecting value: line 1 column 1andExtra dataerrors that occurred when models "thought out loud."
Bug Fixes
- Trace Event Error: Fixed an
AttributeError: 'TraceEvent' object has no attribute 'event_type'inexamples/05_providers/ollama_example.py. The script now correctly usesevent.name. - Default Model Updates: Updated docstrings and examples to default to
llama3.2, ensuring examples run smoothly out of the box with standard Ollama setups.
Upgrade Instructions
Update your package to apply these fixes:
pip install --upgrade memlayer