fix: improve robustness of memory writer, embeddings, and search handler#29
Open
fix: improve robustness of memory writer, embeddings, and search handler#29
Conversation
- Add default model (openai/gpt-4o-mini) to MemoryWriterConfig, making SQRL_STRONG_MODEL env var optional instead of required - Add ConfigurationError exception class for better error handling - Add from_explicit() class method for explicit config creation - Add retry logic with exponential backoff to embedding service - Add _is_retryable_error() helper to identify transient failures - Add configurable retry settings via env vars (SQRL_EMBEDDING_MAX_RETRIES, SQRL_EMBEDDING_RETRY_DELAY, SQRL_EMBEDDING_RETRY_BACKOFF) - Improve SearchMemoriesHandler with proper warning when no search_fn configured, and add metadata to response (search_backend, warning) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…Router) Change default model from openai/gpt-4o-mini to openrouter/deepseek/deepseek-r1-distill-qwen-32b which is: - Free on OpenRouter (no API cost) - 64K context window - Strong reasoning capabilities (state-of-art for dense models) Add RECOMMENDED_MODELS dict documenting best models by use case: - free_best: deepseek-r1-distill-qwen-32b (free, strong reasoning) - free_long_context: deepseek-chat-v2.5 (free, 128K) - budget: deepseek-r1-0528-qwen3-8b ($0.02/$0.10 per M tokens) - json_best: claude-3.5-haiku ($0.80/$4, best structured output) - reasoning: deepseek-r1 ($0.30/$1.20, o1-level reasoning) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses several high-priority engineering issues found during code review:
openai/gpt-4o-mini) soSQRL_STRONG_MODELenv var is optional instead of causing immediate crashChanges
src/sqrl/memory_writer/writer.pyDEFAULT_STRONG_MODEL = "openai/gpt-4o-mini"constantConfigurationErrorexception classSQRL_STRONG_MODELoptional (uses default if not set)from_explicit()class method for programmatic configSQRL_MAX_MEMORIES_PER_EPISODEenv varsrc/sqrl/embeddings.py_is_retryable_error()helper to identify transient failuresSQRL_EMBEDDING_MAX_RETRIES,SQRL_EMBEDDING_RETRY_DELAY,SQRL_EMBEDDING_RETRY_BACKOFFsrc/sqrl/ipc/handlers.pySearchMemoriesHandlernow logs warning (once) when no search_fn configuredsearch_backendandwarningmetadata fieldsTest plan
🤖 Generated with Claude Code