( ctx context.Context, query string, workspaceID string, limit int, )
| 1976 | } |
| 1977 | |
| 1978 | func (h *HostAPIHandler) recallMemoryFromProvider( |
| 1979 | ctx context.Context, |
| 1980 | query string, |
| 1981 | workspaceID string, |
| 1982 | limit int, |
| 1983 | ) (memcontract.Packaged, bool, error) { |
| 1984 | if h.memoryProviders == nil { |
| 1985 | return memcontract.Packaged{}, false, nil |
| 1986 | } |
| 1987 | registration, err := h.memoryProviders.Select(ctx, workspaceID, "") |
| 1988 | if err != nil { |
| 1989 | if errors.Is(err, ErrMemoryProviderNotFound) { |
| 1990 | return memcontract.Packaged{}, false, nil |
| 1991 | } |
| 1992 | return memcontract.Packaged{}, true, err |
| 1993 | } |
| 1994 | recalled, err := registration.Provider.Recall(ctx, memcontract.RecallRequest{ |
| 1995 | Query: memcontract.Query{ |
| 1996 | WorkspaceID: workspaceID, |
| 1997 | QueryText: query, |
| 1998 | }, |
| 1999 | Options: memcontract.RecallOptions{TopK: limit}, |
| 2000 | }) |
| 2001 | if err != nil { |
| 2002 | if errors.Is(err, memcontract.ErrNotImplemented) { |
| 2003 | return memcontract.Packaged{}, false, nil |
| 2004 | } |
| 2005 | return memcontract.Packaged{}, true, err |
| 2006 | } |
| 2007 | return recalled.Packaged, true, nil |
| 2008 | } |
| 2009 | |
| 2010 | func (h *HostAPIHandler) recallMemoryFromStore( |
| 2011 | ctx context.Context, |
no test coverage detected