Add tool information to the embedding index. Args: tool_config: Tool configuration
(self, tool_config: ToolConfig)
| 354 | return tool_configs |
| 355 | |
| 356 | async def _store(self, tool_config: ToolConfig): |
| 357 | """Add tool information to the embedding index. |
| 358 | |
| 359 | Args: |
| 360 | tool_config: Tool configuration |
| 361 | """ |
| 362 | if self._faiss_service is None: |
| 363 | return |
| 364 | |
| 365 | try: |
| 366 | # Create comprehensive text representation |
| 367 | tool_text = f"Tool: {tool_config.name}\nDescription: {tool_config.description}" |
| 368 | |
| 369 | # Add to FAISS index |
| 370 | request = FaissAddRequest( |
| 371 | texts=[tool_text], |
| 372 | metadatas=[{ |
| 373 | "name": tool_config.name, |
| 374 | "description": tool_config.description |
| 375 | }] |
| 376 | ) |
| 377 | |
| 378 | await self._faiss_service.add_documents(request) |
| 379 | |
| 380 | except Exception as e: |
| 381 | logger.warning(f"| ⚠️ Failed to add tool {tool_config.name} to FAISS index: {e}") |
| 382 | |
| 383 | async def build(self, tool_config: ToolConfig) -> ToolConfig: |
| 384 | """Create a tool instance and store it. |
no test coverage detected