fleet-memory/hindsight-clients/go/README.md
Nicolò Boschi 6e30980add
feat: use official go generator for Go client (#377)
* ci: add Go client integration tests

Add test-go-client job to CI workflow following the same pattern as
Python, TypeScript, and Rust client tests. The job:
- Sets up Go 1.23 with dependency caching
- Starts the Hindsight API server
- Runs integration tests using the 'integration' build tag
- Displays server logs on failure

The integration tests (hindsight-clients/go/integration_test.go) cover
all core operations: retain, recall, reflect, bank management, and
end-to-end workflows.

* Move Go cookbook content to hindsight-cookbook repo

Removes Go-specific cookbook content that was added in PR #375:
- applications/go-memory-service.md
- recipes/go-quickstart.md
- recipes/go-concurrent-pipeline.md

These have been moved to the hindsight-cookbook repository where
cookbook content should live per project conventions.

* feat(go): add CI test for Go client and patch for ogen null handling

- Add test-go-client job to GitHub Actions CI workflow
- Create post-generation patch script (patch-ogen.sh) to fix ogen's
  handling of null values in optional string fields
- Patch OptString.Decode() to check jx.Next() type before decoding,
  properly handling explicit null in JSON responses

The patch ensures generated code persists across regenerations and
handles the Hindsight API's nullable optional fields correctly.

Fixes: Go client integration tests for retain and bank operations
Note: Some tests still fail for nullable arrays/objects - those
require additional patches for other Opt* types.

* feat: use official go generator for Go client

* feat: use official go generator for Go client

* ci fixes

* chore: sync Go client with latest OpenAPI spec

- Add model_child_operation_status.go (new model)
- Update model_operation_status_response.go with child operations
- Update go.mod/go.sum dependencies
- Update api/openapi.yaml
2026-02-16 14:04:12 +01:00

13 KiB

Go API client for hindsight

HTTP API for Hindsight

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 0.4.11
  • Package version: 1.0.0
  • Generator version: 7.10.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import hindsight "github.com/vectorize-io/hindsight-client-go"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value hindsight.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), hindsight.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value hindsight.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), hindsight.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using hindsight.ContextOperationServerIndices and hindsight.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), hindsight.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), hindsight.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
BanksAPI AddBankBackground Post /v1/default/banks/{bank_id}/background Add/merge memory bank background (deprecated)
BanksAPI ClearObservations Delete /v1/default/banks/{bank_id}/observations Clear all observations
BanksAPI CreateOrUpdateBank Put /v1/default/banks/{bank_id} Create or update memory bank
BanksAPI DeleteBank Delete /v1/default/banks/{bank_id} Delete memory bank
BanksAPI GetAgentStats Get /v1/default/banks/{bank_id}/stats Get statistics for memory bank
BanksAPI GetBankConfig Get /v1/default/banks/{bank_id}/config Get bank configuration
BanksAPI GetBankProfile Get /v1/default/banks/{bank_id}/profile Get memory bank profile
BanksAPI ListBanks Get /v1/default/banks List all memory banks
BanksAPI ResetBankConfig Delete /v1/default/banks/{bank_id}/config Reset bank configuration
BanksAPI TriggerConsolidation Post /v1/default/banks/{bank_id}/consolidate Trigger consolidation
BanksAPI UpdateBank Patch /v1/default/banks/{bank_id} Partial update memory bank
BanksAPI UpdateBankConfig Patch /v1/default/banks/{bank_id}/config Update bank configuration
BanksAPI UpdateBankDisposition Put /v1/default/banks/{bank_id}/profile Update memory bank disposition
DirectivesAPI CreateDirective Post /v1/default/banks/{bank_id}/directives Create directive
DirectivesAPI DeleteDirective Delete /v1/default/banks/{bank_id}/directives/{directive_id} Delete directive
DirectivesAPI GetDirective Get /v1/default/banks/{bank_id}/directives/{directive_id} Get directive
DirectivesAPI ListDirectives Get /v1/default/banks/{bank_id}/directives List directives
DirectivesAPI UpdateDirective Patch /v1/default/banks/{bank_id}/directives/{directive_id} Update directive
DocumentsAPI DeleteDocument Delete /v1/default/banks/{bank_id}/documents/{document_id} Delete a document
DocumentsAPI GetChunk Get /v1/default/chunks/{chunk_id} Get chunk details
DocumentsAPI GetDocument Get /v1/default/banks/{bank_id}/documents/{document_id} Get document details
DocumentsAPI ListDocuments Get /v1/default/banks/{bank_id}/documents List documents
EntitiesAPI GetEntity Get /v1/default/banks/{bank_id}/entities/{entity_id} Get entity details
EntitiesAPI ListEntities Get /v1/default/banks/{bank_id}/entities List entities
EntitiesAPI RegenerateEntityObservations Post /v1/default/banks/{bank_id}/entities/{entity_id}/regenerate Regenerate entity observations (deprecated)
MemoryAPI ClearBankMemories Delete /v1/default/banks/{bank_id}/memories Clear memory bank memories
MemoryAPI GetGraph Get /v1/default/banks/{bank_id}/graph Get memory graph data
MemoryAPI GetMemory Get /v1/default/banks/{bank_id}/memories/{memory_id} Get memory unit
MemoryAPI ListMemories Get /v1/default/banks/{bank_id}/memories/list List memory units
MemoryAPI ListTags Get /v1/default/banks/{bank_id}/tags List tags
MemoryAPI RecallMemories Post /v1/default/banks/{bank_id}/memories/recall Recall memory
MemoryAPI Reflect Post /v1/default/banks/{bank_id}/reflect Reflect and generate answer
MemoryAPI RetainMemories Post /v1/default/banks/{bank_id}/memories Retain memories
MentalModelsAPI CreateMentalModel Post /v1/default/banks/{bank_id}/mental-models Create mental model
MentalModelsAPI DeleteMentalModel Delete /v1/default/banks/{bank_id}/mental-models/{mental_model_id} Delete mental model
MentalModelsAPI GetMentalModel Get /v1/default/banks/{bank_id}/mental-models/{mental_model_id} Get mental model
MentalModelsAPI ListMentalModels Get /v1/default/banks/{bank_id}/mental-models List mental models
MentalModelsAPI RefreshMentalModel Post /v1/default/banks/{bank_id}/mental-models/{mental_model_id}/refresh Refresh mental model
MentalModelsAPI UpdateMentalModel Patch /v1/default/banks/{bank_id}/mental-models/{mental_model_id} Update mental model
MonitoringAPI GetVersion Get /version Get API version and feature flags
MonitoringAPI HealthEndpointHealthGet Get /health Health check endpoint
MonitoringAPI MetricsEndpointMetricsGet Get /metrics Prometheus metrics endpoint
OperationsAPI CancelOperation Delete /v1/default/banks/{bank_id}/operations/{operation_id} Cancel a pending async operation
OperationsAPI GetOperationStatus Get /v1/default/banks/{bank_id}/operations/{operation_id} Get operation status
OperationsAPI ListOperations Get /v1/default/banks/{bank_id}/operations List async operations

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author