fleet-memory/hindsight-clients/go/model_reflect_request.go
Nicolò Boschi 5de793eec7
feat: compound tag filtering via tag_groups (#562)
* feat: add compound tag filtering via tag_groups

Adds tag_groups to RecallRequest and ReflectRequest to express arbitrary
boolean tag predicates: leaf {tags, match}, and/or/not compounds.
Top-level groups are AND-ed. Existing tags/tags_match unchanged.

Examples:
  Step filter AND user scope:
    tag_groups: [{tags: ["step:5","step:8"], match: "any_strict"},
                 {tags: ["user:alice"], match: "all_strict"}]
  Exclusion:
    tag_groups: [{tags: ["user:alice"], match: "all_strict"},
                 {not: {tags: ["archived"], match: "any_strict"}}]

- Recursive SQL builder (build_tag_groups_where_clause) threads through
  all 4 retrieval strategies (semantic/BM25, temporal, graph, MPFP)
- Python-side filter (filter_results_by_tag_groups) for post-traversal
- 22 new unit tests
- OpenAPI spec + all clients regenerated (Rust, Python, TypeScript, Go)

* fix: add tag_groups: None to Rust CLI struct initializers

* fix: add tag_groups: None to Rust client test RecallRequest initializer

* feat: reject tags+tag_groups together, add tag_groups integration tests

- Add model_validator to RecallRequest and ReflectRequest that returns 422
  when both `tags` and `tag_groups` are set (mutually exclusive)
- Add 5 integration tests for tag_groups compound filtering:
  * validation: 422 when both fields are set
  * AND filter: two leaf groups (step scope AND user scope)
  * OR compound: user:alice OR user:bob
  * NOT compound: user:alice AND NOT archived
  * Nested: user:alice AND (step:5 OR step:8)

* ci: trigger CI run
2026-03-13 14:30:11 +01:00

470 lines
13 KiB
Go

/*
Hindsight HTTP API
HTTP API for Hindsight
API version: 0.4.17
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hindsight
import (
"encoding/json"
"bytes"
"fmt"
)
// checks if the ReflectRequest type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &ReflectRequest{}
// ReflectRequest Request model for reflect endpoint.
type ReflectRequest struct {
Query string `json:"query"`
Budget *Budget `json:"budget,omitempty"`
Context NullableString `json:"context,omitempty"`
// Maximum tokens for the response
MaxTokens *int32 `json:"max_tokens,omitempty"`
// Options for including additional data (disabled by default)
Include *ReflectIncludeOptions `json:"include,omitempty"`
ResponseSchema map[string]interface{} `json:"response_schema,omitempty"`
Tags []string `json:"tags,omitempty"`
// How to match tags: 'any' (OR, includes untagged), 'all' (AND, includes untagged), 'any_strict' (OR, excludes untagged), 'all_strict' (AND, excludes untagged).
TagsMatch *string `json:"tags_match,omitempty"`
TagGroups []RecallRequestTagGroupsInner `json:"tag_groups,omitempty"`
}
type _ReflectRequest ReflectRequest
// NewReflectRequest instantiates a new ReflectRequest 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 NewReflectRequest(query string) *ReflectRequest {
this := ReflectRequest{}
this.Query = query
var maxTokens int32 = 4096
this.MaxTokens = &maxTokens
var tagsMatch string = "any"
this.TagsMatch = &tagsMatch
return &this
}
// NewReflectRequestWithDefaults instantiates a new ReflectRequest 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 NewReflectRequestWithDefaults() *ReflectRequest {
this := ReflectRequest{}
var maxTokens int32 = 4096
this.MaxTokens = &maxTokens
var tagsMatch string = "any"
this.TagsMatch = &tagsMatch
return &this
}
// GetQuery returns the Query field value
func (o *ReflectRequest) GetQuery() string {
if o == nil {
var ret string
return ret
}
return o.Query
}
// GetQueryOk returns a tuple with the Query field value
// and a boolean to check if the value has been set.
func (o *ReflectRequest) GetQueryOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Query, true
}
// SetQuery sets field value
func (o *ReflectRequest) SetQuery(v string) {
o.Query = v
}
// GetBudget returns the Budget field value if set, zero value otherwise.
func (o *ReflectRequest) GetBudget() Budget {
if o == nil || IsNil(o.Budget) {
var ret Budget
return ret
}
return *o.Budget
}
// GetBudgetOk returns a tuple with the Budget field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ReflectRequest) GetBudgetOk() (*Budget, bool) {
if o == nil || IsNil(o.Budget) {
return nil, false
}
return o.Budget, true
}
// HasBudget returns a boolean if a field has been set.
func (o *ReflectRequest) HasBudget() bool {
if o != nil && !IsNil(o.Budget) {
return true
}
return false
}
// SetBudget gets a reference to the given Budget and assigns it to the Budget field.
func (o *ReflectRequest) SetBudget(v Budget) {
o.Budget = &v
}
// GetContext returns the Context field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *ReflectRequest) 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 *ReflectRequest) 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 *ReflectRequest) 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 *ReflectRequest) SetContext(v string) {
o.Context.Set(&v)
}
// SetContextNil sets the value for Context to be an explicit nil
func (o *ReflectRequest) SetContextNil() {
o.Context.Set(nil)
}
// UnsetContext ensures that no value is present for Context, not even an explicit nil
func (o *ReflectRequest) UnsetContext() {
o.Context.Unset()
}
// GetMaxTokens returns the MaxTokens field value if set, zero value otherwise.
func (o *ReflectRequest) GetMaxTokens() int32 {
if o == nil || IsNil(o.MaxTokens) {
var ret int32
return ret
}
return *o.MaxTokens
}
// GetMaxTokensOk returns a tuple with the MaxTokens field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ReflectRequest) GetMaxTokensOk() (*int32, bool) {
if o == nil || IsNil(o.MaxTokens) {
return nil, false
}
return o.MaxTokens, true
}
// HasMaxTokens returns a boolean if a field has been set.
func (o *ReflectRequest) HasMaxTokens() bool {
if o != nil && !IsNil(o.MaxTokens) {
return true
}
return false
}
// SetMaxTokens gets a reference to the given int32 and assigns it to the MaxTokens field.
func (o *ReflectRequest) SetMaxTokens(v int32) {
o.MaxTokens = &v
}
// GetInclude returns the Include field value if set, zero value otherwise.
func (o *ReflectRequest) GetInclude() ReflectIncludeOptions {
if o == nil || IsNil(o.Include) {
var ret ReflectIncludeOptions
return ret
}
return *o.Include
}
// GetIncludeOk returns a tuple with the Include field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ReflectRequest) GetIncludeOk() (*ReflectIncludeOptions, bool) {
if o == nil || IsNil(o.Include) {
return nil, false
}
return o.Include, true
}
// HasInclude returns a boolean if a field has been set.
func (o *ReflectRequest) HasInclude() bool {
if o != nil && !IsNil(o.Include) {
return true
}
return false
}
// SetInclude gets a reference to the given ReflectIncludeOptions and assigns it to the Include field.
func (o *ReflectRequest) SetInclude(v ReflectIncludeOptions) {
o.Include = &v
}
// GetResponseSchema returns the ResponseSchema field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *ReflectRequest) GetResponseSchema() map[string]interface{} {
if o == nil {
var ret map[string]interface{}
return ret
}
return o.ResponseSchema
}
// GetResponseSchemaOk returns a tuple with the ResponseSchema 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 *ReflectRequest) GetResponseSchemaOk() (map[string]interface{}, bool) {
if o == nil || IsNil(o.ResponseSchema) {
return map[string]interface{}{}, false
}
return o.ResponseSchema, true
}
// HasResponseSchema returns a boolean if a field has been set.
func (o *ReflectRequest) HasResponseSchema() bool {
if o != nil && !IsNil(o.ResponseSchema) {
return true
}
return false
}
// SetResponseSchema gets a reference to the given map[string]interface{} and assigns it to the ResponseSchema field.
func (o *ReflectRequest) SetResponseSchema(v map[string]interface{}) {
o.ResponseSchema = v
}
// GetTags returns the Tags field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *ReflectRequest) 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 *ReflectRequest) 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 *ReflectRequest) 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 *ReflectRequest) SetTags(v []string) {
o.Tags = v
}
// GetTagsMatch returns the TagsMatch field value if set, zero value otherwise.
func (o *ReflectRequest) GetTagsMatch() string {
if o == nil || IsNil(o.TagsMatch) {
var ret string
return ret
}
return *o.TagsMatch
}
// GetTagsMatchOk returns a tuple with the TagsMatch field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ReflectRequest) GetTagsMatchOk() (*string, bool) {
if o == nil || IsNil(o.TagsMatch) {
return nil, false
}
return o.TagsMatch, true
}
// HasTagsMatch returns a boolean if a field has been set.
func (o *ReflectRequest) HasTagsMatch() bool {
if o != nil && !IsNil(o.TagsMatch) {
return true
}
return false
}
// SetTagsMatch gets a reference to the given string and assigns it to the TagsMatch field.
func (o *ReflectRequest) SetTagsMatch(v string) {
o.TagsMatch = &v
}
// GetTagGroups returns the TagGroups field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *ReflectRequest) GetTagGroups() []RecallRequestTagGroupsInner {
if o == nil {
var ret []RecallRequestTagGroupsInner
return ret
}
return o.TagGroups
}
// GetTagGroupsOk returns a tuple with the TagGroups 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 *ReflectRequest) GetTagGroupsOk() ([]RecallRequestTagGroupsInner, bool) {
if o == nil || IsNil(o.TagGroups) {
return nil, false
}
return o.TagGroups, true
}
// HasTagGroups returns a boolean if a field has been set.
func (o *ReflectRequest) HasTagGroups() bool {
if o != nil && !IsNil(o.TagGroups) {
return true
}
return false
}
// SetTagGroups gets a reference to the given []RecallRequestTagGroupsInner and assigns it to the TagGroups field.
func (o *ReflectRequest) SetTagGroups(v []RecallRequestTagGroupsInner) {
o.TagGroups = v
}
func (o ReflectRequest) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o ReflectRequest) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["query"] = o.Query
if !IsNil(o.Budget) {
toSerialize["budget"] = o.Budget
}
if o.Context.IsSet() {
toSerialize["context"] = o.Context.Get()
}
if !IsNil(o.MaxTokens) {
toSerialize["max_tokens"] = o.MaxTokens
}
if !IsNil(o.Include) {
toSerialize["include"] = o.Include
}
if o.ResponseSchema != nil {
toSerialize["response_schema"] = o.ResponseSchema
}
if o.Tags != nil {
toSerialize["tags"] = o.Tags
}
if !IsNil(o.TagsMatch) {
toSerialize["tags_match"] = o.TagsMatch
}
if o.TagGroups != nil {
toSerialize["tag_groups"] = o.TagGroups
}
return toSerialize, nil
}
func (o *ReflectRequest) 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{
"query",
}
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)
}
}
varReflectRequest := _ReflectRequest{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varReflectRequest)
if err != nil {
return err
}
*o = ReflectRequest(varReflectRequest)
return err
}
type NullableReflectRequest struct {
value *ReflectRequest
isSet bool
}
func (v NullableReflectRequest) Get() *ReflectRequest {
return v.value
}
func (v *NullableReflectRequest) Set(val *ReflectRequest) {
v.value = val
v.isSet = true
}
func (v NullableReflectRequest) IsSet() bool {
return v.isSet
}
func (v *NullableReflectRequest) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableReflectRequest(val *ReflectRequest) *NullableReflectRequest {
return &NullableReflectRequest{value: val, isSet: true}
}
func (v NullableReflectRequest) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableReflectRequest) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}