(
self,
memory_path: str = None,
)
| 161 | return res |
| 162 | |
| 163 | def load_local( |
| 164 | self, |
| 165 | memory_path: str = None, |
| 166 | ) -> None: |
| 167 | |
| 168 | if memory_path is None: |
| 169 | memory_path = self.memory_path |
| 170 | |
| 171 | """Load the memory from the local file.""" |
| 172 | for symbol in self.symbols: |
| 173 | |
| 174 | try: |
| 175 | path = os.path.join(memory_path, symbol, "market_intelligence") |
| 176 | os.makedirs(path, exist_ok=True) |
| 177 | vecstore = FAISS(memory_path=path, embedding_dim=self.embedding_dim) |
| 178 | vecstore.load_local(memory_path=path, embedding_dim=self.embedding_dim) |
| 179 | |
| 180 | # print length of index |
| 181 | print(f"symbols: {symbol}, memory_path: {path}, vecstore length: {vecstore.index.ntotal}") |
| 182 | |
| 183 | self.market_intelligence_memorys[symbol].load_local( |
| 184 | memory_path=path, |
| 185 | vectorstore=vecstore, |
| 186 | ) |
| 187 | except Exception as e: |
| 188 | print(f"Failed to load market_intelligence_memorys: {e}") |
| 189 | |
| 190 | try: |
| 191 | path = os.path.join(memory_path, symbol, "low_level_reflection") |
| 192 | os.makedirs(path, exist_ok=True) |
| 193 | vecstore = FAISS(memory_path=path, embedding_dim=self.embedding_dim) |
| 194 | vecstore.load_local(memory_path=path, embedding_dim=self.embedding_dim) |
| 195 | |
| 196 | # print length of index |
| 197 | print(f"symbols: {symbol}, memory_path: {path}, vecstore length: {vecstore.index.ntotal}") |
| 198 | |
| 199 | self.low_level_reflection_memorys[symbol].load_local( |
| 200 | memory_path=path, |
| 201 | vectorstore=vecstore, |
| 202 | ) |
| 203 | except Exception as e: |
| 204 | print(f"Failed to load low_level_reflection_memorys: {e}") |
| 205 | |
| 206 | try: |
| 207 | path = os.path.join(memory_path, symbol, "high_level_reflection") |
| 208 | os.makedirs(path, exist_ok=True) |
| 209 | vecstore = FAISS(memory_path=path, embedding_dim=self.embedding_dim) |
| 210 | vecstore.load_local(memory_path=path, embedding_dim=self.embedding_dim) |
| 211 | |
| 212 | # print length of index |
| 213 | print(f"symbols: {symbol}, memory_path: {path}, vecstore length: {vecstore.index.ntotal}") |
| 214 | |
| 215 | self.high_level_reflection_memorys[symbol].load_local( |
| 216 | memory_path=path, |
| 217 | vectorstore=vecstore, |
| 218 | ) |
| 219 | except Exception as e: |
| 220 | print(f"Failed to load high_level_reflection_memorys: {e}") |
nothing calls this directly
no test coverage detected