Documentation
¶
Index ¶
- func NewRetrieverWithCache(retriever core.Retriever, semanticCache core.SemanticCache, ...) core.Retriever
- type BoltOption
- type BoltSemanticCache
- func (c *BoltSemanticCache) CacheResponse(ctx context.Context, query *core.Query, answer *core.Result) error
- func (c *BoltSemanticCache) CheckCache(ctx context.Context, query *core.Query) (*core.CacheResult, error)
- func (c *BoltSemanticCache) CleanExpired(ctx context.Context) (int, error)
- func (c *BoltSemanticCache) Close() error
- func (c *BoltSemanticCache) Size() (int, error)
- type CacheOption
- type Config
- type EvictPolicy
- type InMemorySemanticCache
- func (c *InMemorySemanticCache) CacheResponse(ctx context.Context, query *core.Query, answer *core.Result) error
- func (c *InMemorySemanticCache) CheckCache(ctx context.Context, query *core.Query) (*core.CacheResult, error)
- func (c *InMemorySemanticCache) CleanExpired(ctx context.Context) (int, error)
- func (c *InMemorySemanticCache) Size() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRetrieverWithCache ¶ added in v1.1.4
Types ¶
type BoltOption ¶ added in v1.1.4
type BoltOption func(*BoltSemanticCache)
func WithBoltDBPath ¶ added in v1.1.4
func WithBoltDBPath(path string) BoltOption
func WithBoltThreshold ¶ added in v1.1.4
func WithBoltThreshold(threshold float32) BoltOption
type BoltSemanticCache ¶ added in v1.1.4
type BoltSemanticCache struct {
// contains filtered or unexported fields
}
func DefaultBoltSemanticCache ¶ added in v1.1.4
func DefaultBoltSemanticCache(embedder core.Embedder) (*BoltSemanticCache, error)
func NewBoltSemanticCache ¶ added in v1.1.4
func NewBoltSemanticCache(embedder core.Embedder, opts ...BoltOption) (*BoltSemanticCache, error)
func (*BoltSemanticCache) CacheResponse ¶ added in v1.1.4
func (*BoltSemanticCache) CheckCache ¶ added in v1.1.4
func (c *BoltSemanticCache) CheckCache(ctx context.Context, query *core.Query) (*core.CacheResult, error)
func (*BoltSemanticCache) CleanExpired ¶ added in v1.1.4
func (c *BoltSemanticCache) CleanExpired(ctx context.Context) (int, error)
func (*BoltSemanticCache) Close ¶ added in v1.1.4
func (c *BoltSemanticCache) Close() error
func (*BoltSemanticCache) Size ¶ added in v1.1.4
func (c *BoltSemanticCache) Size() (int, error)
type CacheOption ¶ added in v1.1.4
type CacheOption func(*Config)
func WithDBPath ¶ added in v1.1.4
func WithDBPath(path string) CacheOption
func WithEvictPolicy ¶ added in v1.1.4
func WithEvictPolicy(p EvictPolicy) CacheOption
func WithMaxSize ¶ added in v1.1.4
func WithMaxSize(n int) CacheOption
func WithTTL ¶ added in v1.1.4
func WithTTL(d time.Duration) CacheOption
func WithThreshold ¶ added in v1.1.4
func WithThreshold(threshold float32) CacheOption
type EvictPolicy ¶ added in v1.1.4
type EvictPolicy string
const ( EvictLRU EvictPolicy = "lru" EvictFIFO EvictPolicy = "fifo" EvictLFU EvictPolicy = "lfu" )
type InMemorySemanticCache ¶
type InMemorySemanticCache struct {
// contains filtered or unexported fields
}
func NewInMemorySemanticCache ¶
func NewInMemorySemanticCache(embedder core.Embedder, opts ...CacheOption) *InMemorySemanticCache
func NewInMemorySemanticCacheWithConfig ¶ added in v1.1.4
func NewInMemorySemanticCacheWithConfig(embedder core.Embedder, cfg *Config) *InMemorySemanticCache
func (*InMemorySemanticCache) CacheResponse ¶ added in v1.1.4
func (*InMemorySemanticCache) CheckCache ¶ added in v1.1.4
func (c *InMemorySemanticCache) CheckCache(ctx context.Context, query *core.Query) (*core.CacheResult, error)
func (*InMemorySemanticCache) CleanExpired ¶ added in v1.1.4
func (c *InMemorySemanticCache) CleanExpired(ctx context.Context) (int, error)
func (*InMemorySemanticCache) Size ¶ added in v1.1.4
func (c *InMemorySemanticCache) Size() int
Click to show internal directories.
Click to hide internal directories.