GoodMem
ReferenceClient SDKsGo

Memories API

Memories API documentation for Go SDK

The default url is http://localhost:8080

MethodHTTP requestDescription
BatchCreateMemoryPost /v1/memories:batchCreateCreate multiple memories in a batch
BatchDeleteMemoryPost /v1/memories:batchDeleteDelete memories in batch
BatchGetMemoryPost /v1/memories:batchGetGet multiple memories by ID
CreateMemoryPost /v1/memoriesCreate a new memory
DeleteMemoryDelete /v1/memories/{id}Delete a memory
GetMemoryGet /v1/memories/{id}Get a memory by ID
GetMemoryContentGet /v1/memories/{id}/contentDownload memory content
GetMemoryPageImageContentGet /v1/memories/{id}/pages/{pageIndex}/imageDownload memory page image content
ListMemoriesGet /v1/spaces/{spaceId}/memoriesList memories in a space
ListMemoryPageImagesGet /v1/memories/{id}/pagesList memory page images
RetrieveMemoryGet /v1/memories:retrieveStream semantic memory retrieval
RetrieveMemoryAdvancedPost /v1/memories:retrieveAdvanced semantic memory retrieval with JSON

BatchCreateMemory

BatchMemoryResponse BatchCreateMemory(ctx).JsonBatchMemoryCreationRequest(jsonBatchMemoryCreationRequest).Execute()

Create multiple memories in a batch

Example

package main

import (
	"context"
	"fmt"
	"os"
	goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)

func main() {
	jsonBatchMemoryCreationRequest := *goodmem_client.NewJsonBatchMemoryCreationRequest([]goodmem_client.JsonMemoryCreationRequest{*goodmem_client.NewJsonMemoryCreationRequest("550e8400-e29b-41d4-a716-446655440000", interface{}(123), interface{}(123), "text/plain")}) // JsonBatchMemoryCreationRequest | Batch memory creation details. For application/json requests, each item must provide exactly one of originalContent or originalContentB64. For multipart/form-data, provide a requests part and one file part per request.

	configuration := goodmem_client.NewConfiguration()
	apiClient := goodmem_client.NewAPIClient(configuration)
	resp, r, err := apiClient.MemoriesAPI.BatchCreateMemory(context.Background()).JsonBatchMemoryCreationRequest(jsonBatchMemoryCreationRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MemoriesAPI.BatchCreateMemory``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `BatchCreateMemory`: BatchMemoryResponse
	fmt.Fprintf(os.Stdout, "Response from `MemoriesAPI.BatchCreateMemory`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiBatchCreateMemoryRequest struct via the builder pattern

NameTypeDescriptionNotes
jsonBatchMemoryCreationRequestJsonBatchMemoryCreationRequestBatch memory creation details. For application/json requests, each item must provide exactly one of originalContent or originalContentB64. For multipart/form-data, provide a requests part and one file part per request.

Return type

BatchMemoryResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, multipart/form-data
  • Accept: application/json

↑ Back to Go SDK

BatchDeleteMemory

BatchMemoryResponse BatchDeleteMemory(ctx).BatchMemoryDeletionRequest(batchMemoryDeletionRequest).Execute()

Delete memories in batch

Example

package main

import (
	"context"
	"fmt"
	"os"
	goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)

func main() {
	batchMemoryDeletionRequest := *goodmem_client.NewBatchMemoryDeletionRequest([]goodmem_client.BatchDeleteMemorySelectorRequest{*goodmem_client.NewBatchDeleteMemorySelectorRequest()}) // BatchMemoryDeletionRequest | Batch memory deletion details

	configuration := goodmem_client.NewConfiguration()
	apiClient := goodmem_client.NewAPIClient(configuration)
	resp, r, err := apiClient.MemoriesAPI.BatchDeleteMemory(context.Background()).BatchMemoryDeletionRequest(batchMemoryDeletionRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MemoriesAPI.BatchDeleteMemory``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `BatchDeleteMemory`: BatchMemoryResponse
	fmt.Fprintf(os.Stdout, "Response from `MemoriesAPI.BatchDeleteMemory`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiBatchDeleteMemoryRequest struct via the builder pattern

NameTypeDescriptionNotes
batchMemoryDeletionRequestBatchMemoryDeletionRequestBatch memory deletion details

Return type

BatchMemoryResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

↑ Back to Go SDK

BatchGetMemory

BatchMemoryResponse BatchGetMemory(ctx).BatchMemoryRetrievalRequest(batchMemoryRetrievalRequest).Execute()

Get multiple memories by ID

Example

package main

import (
	"context"
	"fmt"
	"os"
	goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)

func main() {
	batchMemoryRetrievalRequest := *goodmem_client.NewBatchMemoryRetrievalRequest([]string{"MemoryIds_example"}) // BatchMemoryRetrievalRequest | Batch memory retrieval details

	configuration := goodmem_client.NewConfiguration()
	apiClient := goodmem_client.NewAPIClient(configuration)
	resp, r, err := apiClient.MemoriesAPI.BatchGetMemory(context.Background()).BatchMemoryRetrievalRequest(batchMemoryRetrievalRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MemoriesAPI.BatchGetMemory``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `BatchGetMemory`: BatchMemoryResponse
	fmt.Fprintf(os.Stdout, "Response from `MemoriesAPI.BatchGetMemory`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiBatchGetMemoryRequest struct via the builder pattern

NameTypeDescriptionNotes
batchMemoryRetrievalRequestBatchMemoryRetrievalRequestBatch memory retrieval details

Return type

BatchMemoryResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

↑ Back to Go SDK

CreateMemory

Memory CreateMemory(ctx).JsonMemoryCreationRequest(jsonMemoryCreationRequest).Execute()

Create a new memory

Example

package main

import (
	"context"
	"fmt"
	"os"
	goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)

func main() {
	jsonMemoryCreationRequest := *goodmem_client.NewJsonMemoryCreationRequest("550e8400-e29b-41d4-a716-446655440000", interface{}(123), interface{}(123), "text/plain") // JsonMemoryCreationRequest | Memory creation details. For application/json requests, provide exactly one of originalContent or originalContentB64. For multipart/form-data, provide a JSON request part plus a file part.

	configuration := goodmem_client.NewConfiguration()
	apiClient := goodmem_client.NewAPIClient(configuration)
	resp, r, err := apiClient.MemoriesAPI.CreateMemory(context.Background()).JsonMemoryCreationRequest(jsonMemoryCreationRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MemoriesAPI.CreateMemory``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `CreateMemory`: Memory
	fmt.Fprintf(os.Stdout, "Response from `MemoriesAPI.CreateMemory`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiCreateMemoryRequest struct via the builder pattern

NameTypeDescriptionNotes
jsonMemoryCreationRequestJsonMemoryCreationRequestMemory creation details. For application/json requests, provide exactly one of originalContent or originalContentB64. For multipart/form-data, provide a JSON request part plus a file part.

Return type

Memory

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, multipart/form-data
  • Accept: application/json

↑ Back to Go SDK

DeleteMemory

DeleteMemory(ctx, id).Execute()

Delete a memory

Example

package main

import (
	"context"
	"fmt"
	"os"
	goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)

func main() {
	id := "550e8400-e29b-41d4-a716-446655440000" // string | The unique identifier of the memory to delete

	configuration := goodmem_client.NewConfiguration()
	apiClient := goodmem_client.NewAPIClient(configuration)
	r, err := apiClient.MemoriesAPI.DeleteMemory(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MemoriesAPI.DeleteMemory``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
idstringThe unique identifier of the memory to delete

Other Parameters

Other parameters are passed through a pointer to a apiDeleteMemoryRequest struct via the builder pattern

NameTypeDescriptionNotes

Return type

(empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

↑ Back to Go SDK

GetMemory

Memory GetMemory(ctx, id).IncludeContent(includeContent).IncludeProcessingHistory(includeProcessingHistory).Execute()

Get a memory by ID

Example

package main

import (
	"context"
	"fmt"
	"os"
	goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)

func main() {
	id := "550e8400-e29b-41d4-a716-446655440000" // string | The unique identifier of the memory to retrieve
	includeContent := false // bool | Whether to include the original content in the response (defaults to false). The snake_case alias include_content is also accepted. (optional) (default to false)
	includeProcessingHistory := false // bool | Whether to include background job processing history in the response (defaults to false). The snake_case alias include_processing_history is also accepted. (optional) (default to false)

	configuration := goodmem_client.NewConfiguration()
	apiClient := goodmem_client.NewAPIClient(configuration)
	resp, r, err := apiClient.MemoriesAPI.GetMemory(context.Background(), id).IncludeContent(includeContent).IncludeProcessingHistory(includeProcessingHistory).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MemoriesAPI.GetMemory``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetMemory`: Memory
	fmt.Fprintf(os.Stdout, "Response from `MemoriesAPI.GetMemory`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
idstringThe unique identifier of the memory to retrieve

Other Parameters

Other parameters are passed through a pointer to a apiGetMemoryRequest struct via the builder pattern

NameTypeDescriptionNotes

includeContent | bool | Whether to include the original content in the response (defaults to false). The snake_case alias include_content is also accepted. | [default to false] includeProcessingHistory | bool | Whether to include background job processing history in the response (defaults to false). The snake_case alias include_processing_history is also accepted. | [default to false]

Return type

Memory

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

↑ Back to Go SDK

GetMemoryContent

*os.File GetMemoryContent(ctx, id).Execute()

Download memory content

Example

package main

import (
	"context"
	"fmt"
	"os"
	goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)

func main() {
	id := "550e8400-e29b-41d4-a716-446655440000" // string | The unique identifier of the memory to download

	configuration := goodmem_client.NewConfiguration()
	apiClient := goodmem_client.NewAPIClient(configuration)
	resp, r, err := apiClient.MemoriesAPI.GetMemoryContent(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MemoriesAPI.GetMemoryContent``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetMemoryContent`: *os.File
	fmt.Fprintf(os.Stdout, "Response from `MemoriesAPI.GetMemoryContent`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
idstringThe unique identifier of the memory to download

Other Parameters

Other parameters are passed through a pointer to a apiGetMemoryContentRequest struct via the builder pattern

NameTypeDescriptionNotes

Return type

*os.File

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/octet-stream

↑ Back to Go SDK

GetMemoryPageImageContent

*os.File GetMemoryPageImageContent(ctx, id, pageIndex).Dpi(dpi).ContentType(contentType).Execute()

Download memory page image content

Example

package main

import (
	"context"
	"fmt"
	"os"
	goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)

func main() {
	id := "550e8400-e29b-41d4-a716-446655440000" // string | Memory UUID
	pageIndex := int32(0) // int32 | 0-based page index
	dpi := int32(150) // int32 | Optional rendition filter. If omitted, the unique page-image rendition for the page is returned; if multiple renditions exist, specify dpi and/or contentType. (optional)
	contentType := "image/png" // string | Optional rendition filter. MIME type of the desired page image, such as image/png. The snake_case alias content_type is also accepted. (optional)

	configuration := goodmem_client.NewConfiguration()
	apiClient := goodmem_client.NewAPIClient(configuration)
	resp, r, err := apiClient.MemoriesAPI.GetMemoryPageImageContent(context.Background(), id, pageIndex).Dpi(dpi).ContentType(contentType).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MemoriesAPI.GetMemoryPageImageContent``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetMemoryPageImageContent`: *os.File
	fmt.Fprintf(os.Stdout, "Response from `MemoriesAPI.GetMemoryPageImageContent`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
idstringMemory UUID
pageIndexint320-based page index

Other Parameters

Other parameters are passed through a pointer to a apiGetMemoryPageImageContentRequest struct via the builder pattern

NameTypeDescriptionNotes

dpi | int32 | Optional rendition filter. If omitted, the unique page-image rendition for the page is returned; if multiple renditions exist, specify dpi and/or contentType. | contentType | string | Optional rendition filter. MIME type of the desired page image, such as image/png. The snake_case alias content_type is also accepted. |

Return type

*os.File

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/octet-stream

↑ Back to Go SDK

ListMemories

MemoryListResponse ListMemories(ctx, spaceId).IncludeContent(includeContent).IncludeProcessingHistory(includeProcessingHistory).StatusFilter(statusFilter).Filter(filter).MaxResults(maxResults).NextToken(nextToken).SortBy(sortBy).SortOrder(sortOrder).Execute()

List memories in a space

Example

package main

import (
	"context"
	"fmt"
	"os"
	goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)

func main() {
	spaceId := "550e8400-e29b-41d4-a716-446655440000" // string | The unique identifier of the space containing the memories
	includeContent := false // bool | Whether to include the original content in the response (defaults to false). The snake_case alias include_content is also accepted. (optional) (default to false)
	includeProcessingHistory := false // bool | Whether to include background job processing history in the response (defaults to false). The snake_case alias include_processing_history is also accepted. (optional) (default to false)
	statusFilter := "COMPLETED" // string | Filter memories by processing status (PENDING, PROCESSING, COMPLETED, FAILED). The snake_case alias status_filter is also accepted. (optional)
	filter := "val('$.source') = 'email'" // string | Optional metadata filter expression for list results (optional)
	maxResults := int32(100) // int32 | Maximum number of results per page (defaults to 50, clamped to [1, 500]). The snake_case alias max_results is also accepted. (optional) (default to 50)
	nextToken := "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..." // string | Opaque pagination token for the next page. URL-safe Base64 without padding; do not parse or construct it. The snake_case alias next_token is also accepted. (optional)
	sortBy := "created_at" // string | Field to sort by (e.g., 'created_at'). The snake_case alias sort_by is also accepted. (optional)
	sortOrder := "DESCENDING" // string | Sort direction (ASCENDING or DESCENDING). The snake_case alias sort_order is also accepted. (optional)

	configuration := goodmem_client.NewConfiguration()
	apiClient := goodmem_client.NewAPIClient(configuration)
	resp, r, err := apiClient.MemoriesAPI.ListMemories(context.Background(), spaceId).IncludeContent(includeContent).IncludeProcessingHistory(includeProcessingHistory).StatusFilter(statusFilter).Filter(filter).MaxResults(maxResults).NextToken(nextToken).SortBy(sortBy).SortOrder(sortOrder).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MemoriesAPI.ListMemories``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `ListMemories`: MemoryListResponse
	fmt.Fprintf(os.Stdout, "Response from `MemoriesAPI.ListMemories`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
spaceIdstringThe unique identifier of the space containing the memories

Other Parameters

Other parameters are passed through a pointer to a apiListMemoriesRequest struct via the builder pattern

NameTypeDescriptionNotes

includeContent | bool | Whether to include the original content in the response (defaults to false). The snake_case alias include_content is also accepted. | [default to false] includeProcessingHistory | bool | Whether to include background job processing history in the response (defaults to false). The snake_case alias include_processing_history is also accepted. | [default to false] statusFilter | string | Filter memories by processing status (PENDING, PROCESSING, COMPLETED, FAILED). The snake_case alias status_filter is also accepted. | filter | string | Optional metadata filter expression for list results | maxResults | int32 | Maximum number of results per page (defaults to 50, clamped to [1, 500]). The snake_case alias max_results is also accepted. | [default to 50] nextToken | string | Opaque pagination token for the next page. URL-safe Base64 without padding; do not parse or construct it. The snake_case alias next_token is also accepted. | sortBy | string | Field to sort by (e.g., 'created_at'). The snake_case alias sort_by is also accepted. | sortOrder | string | Sort direction (ASCENDING or DESCENDING). The snake_case alias sort_order is also accepted. |

Return type

MemoryListResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

↑ Back to Go SDK

ListMemoryPageImages

ListMemoryPageImagesResponse ListMemoryPageImages(ctx, id).StartPageIndex(startPageIndex).EndPageIndex(endPageIndex).Dpi(dpi).ContentType(contentType).MaxResults(maxResults).NextToken(nextToken).Execute()

List memory page images

Example

package main

import (
	"context"
	"fmt"
	"os"
	goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)

func main() {
	id := "550e8400-e29b-41d4-a716-446655440000" // string | Memory UUID
	startPageIndex := int32(0) // int32 | Optional lower bound for returned page indices, inclusive. The snake_case alias start_page_index is also accepted. (optional)
	endPageIndex := int32(10) // int32 | Optional upper bound for returned page indices, inclusive. The snake_case alias end_page_index is also accepted. (optional)
	dpi := int32(150) // int32 | Optional rendition filter for page-image DPI. (optional)
	contentType := "image/png" // string | Optional rendition filter for page-image MIME type, such as image/png. The snake_case alias content_type is also accepted. (optional)
	maxResults := int32(50) // int32 | Maximum number of results per page. The snake_case alias max_results is also accepted. (optional)
	nextToken := "eyJzdGFydCI6NTAsIm1lbW9yeUlkIjoiLi4uIn0" // string | Opaque pagination token for the next page. The snake_case alias next_token is also accepted. Do not parse or construct it. (optional)

	configuration := goodmem_client.NewConfiguration()
	apiClient := goodmem_client.NewAPIClient(configuration)
	resp, r, err := apiClient.MemoriesAPI.ListMemoryPageImages(context.Background(), id).StartPageIndex(startPageIndex).EndPageIndex(endPageIndex).Dpi(dpi).ContentType(contentType).MaxResults(maxResults).NextToken(nextToken).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MemoriesAPI.ListMemoryPageImages``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `ListMemoryPageImages`: ListMemoryPageImagesResponse
	fmt.Fprintf(os.Stdout, "Response from `MemoriesAPI.ListMemoryPageImages`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
idstringMemory UUID

Other Parameters

Other parameters are passed through a pointer to a apiListMemoryPageImagesRequest struct via the builder pattern

NameTypeDescriptionNotes

startPageIndex | int32 | Optional lower bound for returned page indices, inclusive. The snake_case alias start_page_index is also accepted. | endPageIndex | int32 | Optional upper bound for returned page indices, inclusive. The snake_case alias end_page_index is also accepted. | dpi | int32 | Optional rendition filter for page-image DPI. | contentType | string | Optional rendition filter for page-image MIME type, such as image/png. The snake_case alias content_type is also accepted. | maxResults | int32 | Maximum number of results per page. The snake_case alias max_results is also accepted. | nextToken | string | Opaque pagination token for the next page. The snake_case alias next_token is also accepted. Do not parse or construct it. |

Return type

ListMemoryPageImagesResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

↑ Back to Go SDK

RetrieveMemory

📡 Stream Semantic Memory Retrieval

Use the StreamingClient for streaming memory retrieval:

Working Example with Streaming Client

package main

import (
    "context"
    "fmt"
    "log"

    goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)

func main() {
    // Configure client
    configuration := goodmem_client.NewConfiguration()
    configuration.Host = "http://localhost:8080"
    configuration.DefaultHeader["X-API-Key"] = "your-api-key"

    apiClient := goodmem_client.NewAPIClient(configuration)
    streamingClient := goodmem_client.NewStreamingClient(apiClient)

    // Helper values
    requestedSize := int32(10)
    fetchMemory := true
    fetchMemoryContent := false
    llmID := "550e8400-e29b-41d4-a716-446655440001"
    rerankerID := "550e8400-e29b-41d4-a716-446655440000"
    relevanceThreshold := 0.5
    llmTemp := 0.3
    maxResults := int32(10)
    chronologicalResort := true

    // Stream with ChatPostProcessor
    ctx := context.Background()
    stream, err := streamingClient.RetrieveMemoryStreamChat(
        ctx,
        "your search query",
        []string{"space-uuid"},
        &requestedSize,
        &fetchMemory,
        &fetchMemoryContent,
        goodmem_client.FormatNDJSON,  // or FormatSSE
        &llmID,
        &rerankerID,
        &relevanceThreshold,
        &llmTemp,
        &maxResults,
        &chronologicalResort,
    )
    if err != nil {
        log.Fatalf("Error: %v", err)
    }

    // Process events
    for event := range stream {
        if event.AbstractReply != nil {
            fmt.Printf("Abstract: %s\n", event.AbstractReply.Text)
        } else if event.RetrievedItem != nil && event.RetrievedItem.Memory != nil {
            fmt.Printf("Memory: %v\n", event.RetrievedItem.Memory)
        }
    }
}

Parameters

Same parameters as the standard method, with additional ChatPostProcessor parameters:

  • ppLlmID: UUID of LLM for abstract generation
  • ppRerankerID: UUID of reranker for result reranking
  • ppRelevanceThreshold: Minimum relevance score
  • ppLlmTemp: LLM temperature for generation
  • ppMaxResults: Maximum results to return
  • ppChronologicalResort: Whether to resort by creation time
  • format: Streaming format (FormatNDJSON or FormatSSE)

Return type

MemoryStreamChannel - Channel of streaming events

Authorization

ApiKeyAuth

RetrieveMemoryAdvanced

📡 Advanced Stream Semantic Memory Retrieval

Use the StreamingClient for advanced streaming memory retrieval with custom post-processor configuration:

Working Example with Streaming Client

package main

import (
    "context"
    "fmt"
    "log"

    goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)

func main() {
    // Configure client
    configuration := goodmem_client.NewConfiguration()
    configuration.Host = "http://localhost:8080"
    configuration.DefaultHeader["X-API-Key"] = "your-api-key"

    apiClient := goodmem_client.NewAPIClient(configuration)
    streamingClient := goodmem_client.NewStreamingClient(apiClient)

    // Helper values
    requestedSize := int32(10)
    fetchMemory := true
    fetchMemoryContent := false

    // Create advanced request with custom post-processor
    request := &goodmem_client.AdvancedMemoryStreamRequest{
        Message:   "your search query",
        SpaceIDs:  []string{"space-uuid"},
        RequestedSize: &requestedSize,
        FetchMemory: &fetchMemory,
        FetchMemoryContent: &fetchMemoryContent,
        Format: goodmem_client.FormatNDJSON,  // or FormatSSE
        PostProcessorName: "com.goodmem.retrieval.postprocess.ChatPostProcessorFactory",
        PostProcessorConfig: map[string]interface{}{
            "llm_id":              "550e8400-e29b-41d4-a716-446655440001",
            "reranker_id":         "550e8400-e29b-41d4-a716-446655440000",
            "relevance_threshold": 0.5,
            "llm_temp":            0.3,
            "max_results":         10,
            "chronological_resort": true,
        },
    }

    // Execute advanced streaming
    ctx := context.Background()
    stream, err := streamingClient.RetrieveMemoryStreamAdvanced(ctx, request)
    if err != nil {
        log.Fatalf("Error: %v", err)
    }

    // Process events
    for event := range stream {
        if event.AbstractReply != nil {
            fmt.Printf("Abstract: %s\n", event.AbstractReply.Text)
        } else if event.RetrievedItem != nil {
            fmt.Printf("Retrieved item: %v\n", event.RetrievedItem)
        }
    }
}

Parameters

Use AdvancedMemoryStreamRequest with:

  • Message: Query message
  • SpaceIDs: List of space UUIDs
  • RequestedSize: Maximum memories to retrieve
  • FetchMemory: Whether to fetch memory definitions
  • FetchMemoryContent: Whether to fetch original content
  • Format: Streaming format (FormatNDJSON or FormatSSE)
  • PostProcessorName: Name of custom post-processor
  • PostProcessorConfig: Configuration map for the post-processor

Return type

MemoryStreamChannel - Channel of streaming events

Authorization

ApiKeyAuth