(ctx context.Context, namespace string, input map[string]any)
| 170 | } |
| 171 | |
| 172 | func (t *LogicMemoryQueryTool) search(ctx context.Context, namespace string, input map[string]any) (string, error) { |
| 173 | memoryType, ok := input["type"].(string) |
| 174 | if !ok || memoryType == "" { |
| 175 | return "", errors.New("type is required for 'search' action") |
| 176 | } |
| 177 | |
| 178 | filters := []logic.Filter{logic.WithType(memoryType)} |
| 179 | |
| 180 | if minConf, ok := input["min_confidence"].(float64); ok { |
| 181 | filters = append(filters, logic.WithMinConfidence(minConf)) |
| 182 | } |
| 183 | |
| 184 | limit := 10 |
| 185 | if l, ok := input["limit"].(float64); ok { |
| 186 | limit = int(l) |
| 187 | } |
| 188 | filters = append(filters, logic.WithTopK(limit)) |
| 189 | |
| 190 | memories, err := t.manager.RetrieveMemories(ctx, namespace, filters...) |
| 191 | if err != nil { |
| 192 | return "", fmt.Errorf("failed to search memories: %w", err) |
| 193 | } |
| 194 | |
| 195 | return t.formatMemoriesAsMarkdown(memories), nil |
| 196 | } |
| 197 | |
| 198 | func (t *LogicMemoryQueryTool) stats(ctx context.Context, namespace string) (string, error) { |
| 199 | stats, err := t.manager.GetStats(ctx, namespace) |
no test coverage detected