Documentation
¶
Overview ¶
Package cortext is a pure-Go (no CGO) binding for the Cortext multimodal memory engine. It loads a prebuilt shared library shipped under native/ for the current GOOS/GOARCH (Zig cross-builds), or a path from CORTEXT_LIBRARY_PATH.
Index ¶
- func LastError() string
- func LibraryPath() string
- func LoadLibrary() error
- func MaterializeModel(dbPath string) (string, error)
- func Ptr[T any](value T) *T
- func Version() string
- type Config
- type EmbeddingResult
- type Handle
- func (h *Handle) Close()
- func (h *Handle) Consolidate() (map[string]any, error)
- func (h *Handle) ConsolidateJSON() ([]byte, error)
- func (h *Handle) EmbedAudio(pcm []float32) ([]float32, error)
- func (h *Handle) EmbedAudioJSON(pcm []float32) ([]byte, error)
- func (h *Handle) EmbedImage(data []byte, width int, height int, channels int) ([]float32, error)
- func (h *Handle) EmbedImageJSON(data []byte, width int, height int, channels int) ([]byte, error)
- func (h *Handle) EmbedText(text string) ([]float32, error)
- func (h *Handle) EmbedTextJSON(text string) ([]byte, error)
- func (h *Handle) Flush() error
- func (h *Handle) ProcessAudio(pcm []float32, sourceID string) (map[string]any, error)
- func (h *Handle) ProcessAudioJSON(pcm []float32, sourceID string) ([]byte, error)
- func (h *Handle) ProcessAudioJSONWithOptions(pcm []float32, sourceID string, options *ProcessOptions) ([]byte, error)
- func (h *Handle) ProcessAudioWithMedia(pcm []float32, sourceID string, media *Media) (map[string]any, error)
- func (h *Handle) ProcessAudioWithMediaAndOptions(pcm []float32, sourceID string, media *Media, options *ProcessOptions) (map[string]any, error)
- func (h *Handle) ProcessAudioWithMediaJSON(pcm []float32, sourceID string, media *Media) ([]byte, error)
- func (h *Handle) ProcessAudioWithMediaJSONWithOptions(pcm []float32, sourceID string, media *Media, options *ProcessOptions) ([]byte, error)
- func (h *Handle) ProcessAudioWithOptions(pcm []float32, sourceID string, options *ProcessOptions) (map[string]any, error)
- func (h *Handle) ProcessImage(data []byte, width int, height int, channels int, sourceID string) (map[string]any, error)
- func (h *Handle) ProcessImageJSON(data []byte, width int, height int, channels int, sourceID string) ([]byte, error)
- func (h *Handle) ProcessImageJSONWithOptions(data []byte, width int, height int, channels int, sourceID string, ...) ([]byte, error)
- func (h *Handle) ProcessImageWithMedia(data []byte, width int, height int, channels int, sourceID string, ...) (map[string]any, error)
- func (h *Handle) ProcessImageWithMediaAndOptions(data []byte, width int, height int, channels int, sourceID string, ...) (map[string]any, error)
- func (h *Handle) ProcessImageWithMediaJSON(data []byte, width int, height int, channels int, sourceID string, ...) ([]byte, error)
- func (h *Handle) ProcessImageWithMediaJSONWithOptions(data []byte, width int, height int, channels int, sourceID string, ...) ([]byte, error)
- func (h *Handle) ProcessImageWithOptions(data []byte, width int, height int, channels int, sourceID string, ...) (map[string]any, error)
- func (h *Handle) ProcessText(text string, sourceID string) (map[string]any, error)
- func (h *Handle) ProcessTextJSON(text string, sourceID string) ([]byte, error)
- func (h *Handle) ProcessTextJSONWithOptions(text string, sourceID string, options *ProcessOptions) ([]byte, error)
- func (h *Handle) ProcessTextWithOptions(text string, sourceID string, options *ProcessOptions) (map[string]any, error)
- func (h *Handle) Reset() error
- type Media
- type ProcessOptions
- type Retention
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LastError ¶
func LastError() string
LastError returns the last error produced by this OS thread's C API calls. Note: goroutine migration between calls can lose thread-local error text; prefer the error returned from each method when available.
func LibraryPath ¶
func LibraryPath() string
LibraryPath returns the absolute path that was successfully loaded, if any.
func LoadLibrary ¶
func LoadLibrary() error
LoadLibrary loads the native Cortext shared library if it is not already loaded. New and Version call this automatically.
func MaterializeModel ¶
MaterializeModel reassembles the checked-in AIST model chunks into a local cache and returns the path to the complete .gguf file.
GitHub rejects single files over 100 MB, so the model is versioned as ordinary Git chunks (same layout as cortext-hermes-plugin). This is local file I/O, never a network download; every chunk and the assembled output are verified.
Cache location (first match wins):
- CORTEXT_MODEL_CACHE_DIR
- sibling of dbPath: <dir(dbPath)>/.cortext-assets (":memory:" → cwd)
- user cache: ~/Library/Caches/augmem/cortext/models (macOS), etc.
Types ¶
type Config ¶
type Config struct {
Focus *float64
Sensitivity *float64
Stability *float64
AffectInterrupt *bool
AffectRetrieval *bool
ReinforcementEnabled *bool
ProceduralEnabled *bool
SequentialEdgesEnabled *bool
SignalFilterAudio *bool
SignalFilterImage *bool
SignalFilterText *bool
}
Config overrides native defaults. Nil fields retain their native defaults.
type EmbeddingResult ¶
type EmbeddingResult struct {
Embedding []float32 `json:"embedding"`
Dimension int `json:"dimension"`
}
EmbeddingResult is the JSON shape returned by embed helpers.
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle is an open Cortext engine instance.
func New ¶
New opens a Cortext instance at dbPath (file path or ":memory:"). cfg may be nil for all native defaults.
If CORTEXT_AIST_MODEL_PATH is unset, New materializes the bundled AIST model from Git-friendly chunks under models/ (hermes-plugin style), or falls back to a sibling full .gguf path, then sets the env var for the create call.
func (*Handle) Close ¶
func (h *Handle) Close()
Close frees the native handle. Safe to call multiple times.
func (*Handle) ConsolidateJSON ¶
func (*Handle) EmbedImage ¶
func (*Handle) EmbedImageJSON ¶
func (*Handle) ProcessAudio ¶
func (*Handle) ProcessAudioJSON ¶
func (*Handle) ProcessAudioJSONWithOptions ¶
func (*Handle) ProcessAudioWithMedia ¶
func (*Handle) ProcessAudioWithMediaAndOptions ¶
func (*Handle) ProcessAudioWithMediaJSON ¶
func (*Handle) ProcessAudioWithMediaJSONWithOptions ¶
func (*Handle) ProcessAudioWithOptions ¶
func (*Handle) ProcessImage ¶
func (*Handle) ProcessImageJSON ¶
func (*Handle) ProcessImageJSONWithOptions ¶
func (*Handle) ProcessImageWithMedia ¶
func (*Handle) ProcessImageWithMediaAndOptions ¶
func (*Handle) ProcessImageWithMediaJSON ¶
func (*Handle) ProcessImageWithMediaJSONWithOptions ¶
func (*Handle) ProcessImageWithOptions ¶
func (*Handle) ProcessText ¶
func (*Handle) ProcessTextJSON ¶
func (*Handle) ProcessTextJSONWithOptions ¶
func (*Handle) ProcessTextWithOptions ¶
type ProcessOptions ¶
type ProcessOptions struct {
OmitEmbedding bool
// Retention is Natural when zero-value / omitted.
Retention Retention
}
ProcessOptions configures JSON process result payloads.