* feat: add update_mode='append' for retain to concatenate content to existing documents When retaining with update_mode='append' and a document_id that already exists, the new content is appended to the existing document text and the full document is reprocessed. Delta retain automatically skips unchanged chunks, so only the new content triggers LLM extraction. - Add update_mode field to MemoryItem (API), RetainContentDict (internal), MCP tools - Validate that update_mode='append' requires a document_id - Fetch existing document content and prepend before processing in orchestrator - Update Python, TypeScript, Go generated clients and top-level client wrappers - Add tests for append, multiple appends, no-existing-doc, validation, and default replace * fix: add update_mode field to Rust CLI and client MemoryItem initializers * chore: regenerate docs skill references for update_mode
545 lines
15 KiB
Go
545 lines
15 KiB
Go
/*
|
|
Hindsight HTTP API
|
|
|
|
HTTP API for Hindsight
|
|
|
|
API version: 0.4.22
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package hindsight
|
|
|
|
import (
|
|
"encoding/json"
|
|
"bytes"
|
|
"fmt"
|
|
)
|
|
|
|
// checks if the MemoryItem type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &MemoryItem{}
|
|
|
|
// MemoryItem Single memory item for retain.
|
|
type MemoryItem struct {
|
|
Content string `json:"content"`
|
|
Timestamp NullableTimestamp `json:"timestamp,omitempty"`
|
|
Context NullableString `json:"context,omitempty"`
|
|
Metadata map[string]string `json:"metadata,omitempty"`
|
|
DocumentId NullableString `json:"document_id,omitempty"`
|
|
Entities []EntityInput `json:"entities,omitempty"`
|
|
Tags []string `json:"tags,omitempty"`
|
|
ObservationScopes NullableObservationScopes `json:"observation_scopes,omitempty"`
|
|
Strategy NullableString `json:"strategy,omitempty"`
|
|
UpdateMode NullableString `json:"update_mode,omitempty"`
|
|
}
|
|
|
|
type _MemoryItem MemoryItem
|
|
|
|
// NewMemoryItem instantiates a new MemoryItem object
|
|
// This constructor will assign default values to properties that have it defined,
|
|
// and makes sure properties required by API are set, but the set of arguments
|
|
// will change when the set of required properties is changed
|
|
func NewMemoryItem(content string) *MemoryItem {
|
|
this := MemoryItem{}
|
|
this.Content = content
|
|
return &this
|
|
}
|
|
|
|
// NewMemoryItemWithDefaults instantiates a new MemoryItem object
|
|
// This constructor will only assign default values to properties that have it defined,
|
|
// but it doesn't guarantee that properties required by API are set
|
|
func NewMemoryItemWithDefaults() *MemoryItem {
|
|
this := MemoryItem{}
|
|
return &this
|
|
}
|
|
|
|
// GetContent returns the Content field value
|
|
func (o *MemoryItem) GetContent() string {
|
|
if o == nil {
|
|
var ret string
|
|
return ret
|
|
}
|
|
|
|
return o.Content
|
|
}
|
|
|
|
// GetContentOk returns a tuple with the Content field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *MemoryItem) GetContentOk() (*string, bool) {
|
|
if o == nil {
|
|
return nil, false
|
|
}
|
|
return &o.Content, true
|
|
}
|
|
|
|
// SetContent sets field value
|
|
func (o *MemoryItem) SetContent(v string) {
|
|
o.Content = v
|
|
}
|
|
|
|
// GetTimestamp returns the Timestamp field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *MemoryItem) GetTimestamp() Timestamp {
|
|
if o == nil || IsNil(o.Timestamp.Get()) {
|
|
var ret Timestamp
|
|
return ret
|
|
}
|
|
return *o.Timestamp.Get()
|
|
}
|
|
|
|
// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|
func (o *MemoryItem) GetTimestampOk() (*Timestamp, bool) {
|
|
if o == nil {
|
|
return nil, false
|
|
}
|
|
return o.Timestamp.Get(), o.Timestamp.IsSet()
|
|
}
|
|
|
|
// HasTimestamp returns a boolean if a field has been set.
|
|
func (o *MemoryItem) HasTimestamp() bool {
|
|
if o != nil && o.Timestamp.IsSet() {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetTimestamp gets a reference to the given NullableTimestamp and assigns it to the Timestamp field.
|
|
func (o *MemoryItem) SetTimestamp(v Timestamp) {
|
|
o.Timestamp.Set(&v)
|
|
}
|
|
// SetTimestampNil sets the value for Timestamp to be an explicit nil
|
|
func (o *MemoryItem) SetTimestampNil() {
|
|
o.Timestamp.Set(nil)
|
|
}
|
|
|
|
// UnsetTimestamp ensures that no value is present for Timestamp, not even an explicit nil
|
|
func (o *MemoryItem) UnsetTimestamp() {
|
|
o.Timestamp.Unset()
|
|
}
|
|
|
|
// GetContext returns the Context field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *MemoryItem) GetContext() string {
|
|
if o == nil || IsNil(o.Context.Get()) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Context.Get()
|
|
}
|
|
|
|
// GetContextOk returns a tuple with the Context field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|
func (o *MemoryItem) GetContextOk() (*string, bool) {
|
|
if o == nil {
|
|
return nil, false
|
|
}
|
|
return o.Context.Get(), o.Context.IsSet()
|
|
}
|
|
|
|
// HasContext returns a boolean if a field has been set.
|
|
func (o *MemoryItem) HasContext() bool {
|
|
if o != nil && o.Context.IsSet() {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetContext gets a reference to the given NullableString and assigns it to the Context field.
|
|
func (o *MemoryItem) SetContext(v string) {
|
|
o.Context.Set(&v)
|
|
}
|
|
// SetContextNil sets the value for Context to be an explicit nil
|
|
func (o *MemoryItem) SetContextNil() {
|
|
o.Context.Set(nil)
|
|
}
|
|
|
|
// UnsetContext ensures that no value is present for Context, not even an explicit nil
|
|
func (o *MemoryItem) UnsetContext() {
|
|
o.Context.Unset()
|
|
}
|
|
|
|
// GetMetadata returns the Metadata field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *MemoryItem) GetMetadata() map[string]string {
|
|
if o == nil {
|
|
var ret map[string]string
|
|
return ret
|
|
}
|
|
return o.Metadata
|
|
}
|
|
|
|
// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|
func (o *MemoryItem) GetMetadataOk() (map[string]string, bool) {
|
|
if o == nil || IsNil(o.Metadata) {
|
|
return map[string]string{}, false
|
|
}
|
|
return o.Metadata, true
|
|
}
|
|
|
|
// HasMetadata returns a boolean if a field has been set.
|
|
func (o *MemoryItem) HasMetadata() bool {
|
|
if o != nil && !IsNil(o.Metadata) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetMetadata gets a reference to the given map[string]string and assigns it to the Metadata field.
|
|
func (o *MemoryItem) SetMetadata(v map[string]string) {
|
|
o.Metadata = v
|
|
}
|
|
|
|
// GetDocumentId returns the DocumentId field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *MemoryItem) GetDocumentId() string {
|
|
if o == nil || IsNil(o.DocumentId.Get()) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.DocumentId.Get()
|
|
}
|
|
|
|
// GetDocumentIdOk returns a tuple with the DocumentId field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|
func (o *MemoryItem) GetDocumentIdOk() (*string, bool) {
|
|
if o == nil {
|
|
return nil, false
|
|
}
|
|
return o.DocumentId.Get(), o.DocumentId.IsSet()
|
|
}
|
|
|
|
// HasDocumentId returns a boolean if a field has been set.
|
|
func (o *MemoryItem) HasDocumentId() bool {
|
|
if o != nil && o.DocumentId.IsSet() {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetDocumentId gets a reference to the given NullableString and assigns it to the DocumentId field.
|
|
func (o *MemoryItem) SetDocumentId(v string) {
|
|
o.DocumentId.Set(&v)
|
|
}
|
|
// SetDocumentIdNil sets the value for DocumentId to be an explicit nil
|
|
func (o *MemoryItem) SetDocumentIdNil() {
|
|
o.DocumentId.Set(nil)
|
|
}
|
|
|
|
// UnsetDocumentId ensures that no value is present for DocumentId, not even an explicit nil
|
|
func (o *MemoryItem) UnsetDocumentId() {
|
|
o.DocumentId.Unset()
|
|
}
|
|
|
|
// GetEntities returns the Entities field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *MemoryItem) GetEntities() []EntityInput {
|
|
if o == nil {
|
|
var ret []EntityInput
|
|
return ret
|
|
}
|
|
return o.Entities
|
|
}
|
|
|
|
// GetEntitiesOk returns a tuple with the Entities field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|
func (o *MemoryItem) GetEntitiesOk() ([]EntityInput, bool) {
|
|
if o == nil || IsNil(o.Entities) {
|
|
return nil, false
|
|
}
|
|
return o.Entities, true
|
|
}
|
|
|
|
// HasEntities returns a boolean if a field has been set.
|
|
func (o *MemoryItem) HasEntities() bool {
|
|
if o != nil && !IsNil(o.Entities) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetEntities gets a reference to the given []EntityInput and assigns it to the Entities field.
|
|
func (o *MemoryItem) SetEntities(v []EntityInput) {
|
|
o.Entities = v
|
|
}
|
|
|
|
// GetTags returns the Tags field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *MemoryItem) GetTags() []string {
|
|
if o == nil {
|
|
var ret []string
|
|
return ret
|
|
}
|
|
return o.Tags
|
|
}
|
|
|
|
// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|
func (o *MemoryItem) GetTagsOk() ([]string, bool) {
|
|
if o == nil || IsNil(o.Tags) {
|
|
return nil, false
|
|
}
|
|
return o.Tags, true
|
|
}
|
|
|
|
// HasTags returns a boolean if a field has been set.
|
|
func (o *MemoryItem) HasTags() bool {
|
|
if o != nil && !IsNil(o.Tags) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetTags gets a reference to the given []string and assigns it to the Tags field.
|
|
func (o *MemoryItem) SetTags(v []string) {
|
|
o.Tags = v
|
|
}
|
|
|
|
// GetObservationScopes returns the ObservationScopes field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *MemoryItem) GetObservationScopes() ObservationScopes {
|
|
if o == nil || IsNil(o.ObservationScopes.Get()) {
|
|
var ret ObservationScopes
|
|
return ret
|
|
}
|
|
return *o.ObservationScopes.Get()
|
|
}
|
|
|
|
// GetObservationScopesOk returns a tuple with the ObservationScopes field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|
func (o *MemoryItem) GetObservationScopesOk() (*ObservationScopes, bool) {
|
|
if o == nil {
|
|
return nil, false
|
|
}
|
|
return o.ObservationScopes.Get(), o.ObservationScopes.IsSet()
|
|
}
|
|
|
|
// HasObservationScopes returns a boolean if a field has been set.
|
|
func (o *MemoryItem) HasObservationScopes() bool {
|
|
if o != nil && o.ObservationScopes.IsSet() {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetObservationScopes gets a reference to the given NullableObservationScopes and assigns it to the ObservationScopes field.
|
|
func (o *MemoryItem) SetObservationScopes(v ObservationScopes) {
|
|
o.ObservationScopes.Set(&v)
|
|
}
|
|
// SetObservationScopesNil sets the value for ObservationScopes to be an explicit nil
|
|
func (o *MemoryItem) SetObservationScopesNil() {
|
|
o.ObservationScopes.Set(nil)
|
|
}
|
|
|
|
// UnsetObservationScopes ensures that no value is present for ObservationScopes, not even an explicit nil
|
|
func (o *MemoryItem) UnsetObservationScopes() {
|
|
o.ObservationScopes.Unset()
|
|
}
|
|
|
|
// GetStrategy returns the Strategy field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *MemoryItem) GetStrategy() string {
|
|
if o == nil || IsNil(o.Strategy.Get()) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Strategy.Get()
|
|
}
|
|
|
|
// GetStrategyOk returns a tuple with the Strategy field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|
func (o *MemoryItem) GetStrategyOk() (*string, bool) {
|
|
if o == nil {
|
|
return nil, false
|
|
}
|
|
return o.Strategy.Get(), o.Strategy.IsSet()
|
|
}
|
|
|
|
// HasStrategy returns a boolean if a field has been set.
|
|
func (o *MemoryItem) HasStrategy() bool {
|
|
if o != nil && o.Strategy.IsSet() {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetStrategy gets a reference to the given NullableString and assigns it to the Strategy field.
|
|
func (o *MemoryItem) SetStrategy(v string) {
|
|
o.Strategy.Set(&v)
|
|
}
|
|
// SetStrategyNil sets the value for Strategy to be an explicit nil
|
|
func (o *MemoryItem) SetStrategyNil() {
|
|
o.Strategy.Set(nil)
|
|
}
|
|
|
|
// UnsetStrategy ensures that no value is present for Strategy, not even an explicit nil
|
|
func (o *MemoryItem) UnsetStrategy() {
|
|
o.Strategy.Unset()
|
|
}
|
|
|
|
// GetUpdateMode returns the UpdateMode field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *MemoryItem) GetUpdateMode() string {
|
|
if o == nil || IsNil(o.UpdateMode.Get()) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.UpdateMode.Get()
|
|
}
|
|
|
|
// GetUpdateModeOk returns a tuple with the UpdateMode field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|
func (o *MemoryItem) GetUpdateModeOk() (*string, bool) {
|
|
if o == nil {
|
|
return nil, false
|
|
}
|
|
return o.UpdateMode.Get(), o.UpdateMode.IsSet()
|
|
}
|
|
|
|
// HasUpdateMode returns a boolean if a field has been set.
|
|
func (o *MemoryItem) HasUpdateMode() bool {
|
|
if o != nil && o.UpdateMode.IsSet() {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetUpdateMode gets a reference to the given NullableString and assigns it to the UpdateMode field.
|
|
func (o *MemoryItem) SetUpdateMode(v string) {
|
|
o.UpdateMode.Set(&v)
|
|
}
|
|
// SetUpdateModeNil sets the value for UpdateMode to be an explicit nil
|
|
func (o *MemoryItem) SetUpdateModeNil() {
|
|
o.UpdateMode.Set(nil)
|
|
}
|
|
|
|
// UnsetUpdateMode ensures that no value is present for UpdateMode, not even an explicit nil
|
|
func (o *MemoryItem) UnsetUpdateMode() {
|
|
o.UpdateMode.Unset()
|
|
}
|
|
|
|
func (o MemoryItem) MarshalJSON() ([]byte, error) {
|
|
toSerialize,err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o MemoryItem) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
toSerialize["content"] = o.Content
|
|
if o.Timestamp.IsSet() {
|
|
toSerialize["timestamp"] = o.Timestamp.Get()
|
|
}
|
|
if o.Context.IsSet() {
|
|
toSerialize["context"] = o.Context.Get()
|
|
}
|
|
if o.Metadata != nil {
|
|
toSerialize["metadata"] = o.Metadata
|
|
}
|
|
if o.DocumentId.IsSet() {
|
|
toSerialize["document_id"] = o.DocumentId.Get()
|
|
}
|
|
if o.Entities != nil {
|
|
toSerialize["entities"] = o.Entities
|
|
}
|
|
if o.Tags != nil {
|
|
toSerialize["tags"] = o.Tags
|
|
}
|
|
if o.ObservationScopes.IsSet() {
|
|
toSerialize["observation_scopes"] = o.ObservationScopes.Get()
|
|
}
|
|
if o.Strategy.IsSet() {
|
|
toSerialize["strategy"] = o.Strategy.Get()
|
|
}
|
|
if o.UpdateMode.IsSet() {
|
|
toSerialize["update_mode"] = o.UpdateMode.Get()
|
|
}
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *MemoryItem) UnmarshalJSON(data []byte) (err error) {
|
|
// This validates that all required properties are included in the JSON object
|
|
// by unmarshalling the object into a generic map with string keys and checking
|
|
// that every required field exists as a key in the generic map.
|
|
requiredProperties := []string{
|
|
"content",
|
|
}
|
|
|
|
allProperties := make(map[string]interface{})
|
|
|
|
err = json.Unmarshal(data, &allProperties)
|
|
|
|
if err != nil {
|
|
return err;
|
|
}
|
|
|
|
for _, requiredProperty := range(requiredProperties) {
|
|
if _, exists := allProperties[requiredProperty]; !exists {
|
|
return fmt.Errorf("no value given for required property %v", requiredProperty)
|
|
}
|
|
}
|
|
|
|
varMemoryItem := _MemoryItem{}
|
|
|
|
decoder := json.NewDecoder(bytes.NewReader(data))
|
|
decoder.DisallowUnknownFields()
|
|
err = decoder.Decode(&varMemoryItem)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = MemoryItem(varMemoryItem)
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableMemoryItem struct {
|
|
value *MemoryItem
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableMemoryItem) Get() *MemoryItem {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableMemoryItem) Set(val *MemoryItem) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableMemoryItem) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableMemoryItem) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableMemoryItem(val *MemoryItem) *NullableMemoryItem {
|
|
return &NullableMemoryItem{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableMemoryItem) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableMemoryItem) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|
|
|
|
|