Commit Graph

10 Commits

Author SHA1 Message Date
voidborne-d 9ee18699fd refactor: improve _load() efficiency and _save() error handling
- Populate lists directly in _load() to avoid redundant _save() call
- Add try/except OSError in _save() for graceful degradation
- Expand _load() exception handling with AttributeError, TypeError

Addresses code review feedback from gemini-code-assist.
2026-04-17 19:06:59 +00:00
voidborne-d 1e2164ec78 fix: add JSON file persistence to FinancialSituationMemory
FinancialSituationMemory stored all learned lessons in RAM-only Python
lists with no persistence layer.  Every process restart or new
TradingAgentsGraph() instance wiped all memory, making
reflect_and_remember() useless in practice — especially in server/API
deployments where a new graph is created per request.

Changes:

1. memory.py — add optional JSON file persistence:
   - New config key `memory_persist_dir`: when set to a directory path,
     each memory instance writes `<dir>/<name>.json` on every mutation
     (add_situations / clear) and loads it on construction.
   - When unset or None (the default), behaviour is identical to before
     (RAM-only) — fully backward compatible.
   - Atomic-ish writes via .tmp → rename to avoid corruption on crash.
   - Graceful handling of corrupt / missing / partial JSON files.
   - Tilde expansion (`~/...`) and automatic parent directory creation.

2. default_config.py — add `memory_persist_dir: None` to DEFAULT_CONFIG.

3. main.py — enable persistence in the example and improve
   reflect_and_remember documentation comment.

4. tests/test_memory_persistence.py — 21 regression tests covering:
   - RAM-only backward compatibility (5 tests)
   - Persistence round-trip, incremental add, clear, BM25 rebuild,
     JSON schema, Unicode (7 tests)
   - Edge cases: corrupt JSON, missing keys, mismatched lengths,
     nested directory creation, tilde expansion (5 tests)
   - Multiple instances sharing same directory (1 test)
   - Default config key existence (2 tests)
   - Source audit: TradingAgentsGraph passes config to all 5 memories (1 test)

Closes #563
2026-04-17 19:06:59 +00:00
Yijia-Xiao fa4d01c23a
fix: process all chunk messages for tool call logging, harden memory score normalization (#534, #531) 2026-04-13 07:21:33 +00:00
Yijia Xiao d4dadb82fc
feat: add multi-provider LLM support with thinking configurations
Models added:
- OpenAI: GPT-5.2, GPT-5.1, GPT-5, GPT-5 Mini, GPT-5 Nano, GPT-4.1
- Anthropic: Claude Opus 4.5/4.1, Claude Sonnet 4.5/4, Claude Haiku 4.5
- Google: Gemini 3 Pro/Flash, Gemini 2.5 Flash/Flash Lite
- xAI: Grok 4, Grok 4.1 Fast (Reasoning/Non-Reasoning)

Configs updated:
- Add unified thinking_level for Gemini (maps to thinking_level for Gemini 3,
  thinking_budget for Gemini 2.5; handles Pro's lack of "minimal" support)
- Add OpenAI reasoning_effort configuration
- Add NormalizedChatGoogleGenerativeAI for consistent response handling

Fixes:
- Fix Bull/Bear researcher display truncation
- Replace ChromaDB with BM25 for memory retrieval
2026-02-03 22:27:20 +00:00
Max Wong 43aa9c5d09
Local Ollama (#53)
- Fix typo 'Start' 'End'
- Add llama3.1 selection
- Use 'quick_think_llm' model instead of hard-coding GPT
2025-06-26 00:27:01 -04:00
Yijia Xiao 26c5ba5a78
Revert "Docker support and Ollama support (#47)" (#57)
This reverts commit 78ea029a0b.
2025-06-26 00:07:58 -04:00
Geeta Chauhan 78ea029a0b
Docker support and Ollama support (#47)
- Added support for running CLI and Ollama server via Docker
- Introduced tests for local embeddings model and standalone Docker setup
- Enabled conditional Ollama server launch via LLM_PROVIDER
2025-06-25 23:57:05 -04:00
Edward Sun da84ef43aa main works, cli bugs 2025-06-15 22:20:59 -07:00
maxer137 99789f9cd1 Add support for other backends, such as OpenRouter and olama
This aims to offer alternative OpenAI capable api's.
This offers people to experiment with running the application locally
2025-06-11 14:19:25 +02:00
Yijia-Xiao cc97cb6d5d chore(release): v0.1.0 – initial public release of TradingAgents 2025-06-05 04:27:57 -07:00