mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
383 lines
11 KiB
Go
383 lines
11 KiB
Go
/*
|
|
Hanzo Cloud API
|
|
|
|
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
|
|
|
|
API version: v1
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package hanzoai
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
// checks if the KnowledgeHit type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &KnowledgeHit{}
|
|
|
|
// KnowledgeHit struct for KnowledgeHit
|
|
type KnowledgeHit struct {
|
|
// DocType is which kind of knowledge matched, by address: kb.page (a wiki page), kb.memory (a unit of agent memory) or kb.source (a document a connector ingested). Those three are the whole indexed set, and searchIn.DocTypes filters on them.
|
|
Doctype *string `json:"doctype,omitempty"`
|
|
// Name is the document's name in the framework store — the id to read or open it with. Unique per (org, doctype), so it identifies the document with DocType and not alone.
|
|
Name *string `json:"name,omitempty"`
|
|
// Project is the project scope the document was saved under. Absent for a document saved with none, which is also why a project-scoped query cannot reach it.
|
|
Project *string `json:"project,omitempty"`
|
|
// Provider is the connector that ingested the document — github, slack, google or notion. Absent for a page or memory written in the product, which came from no connector.
|
|
Provider *string `json:"provider,omitempty"`
|
|
// Score is the cosine similarity between the query's embedding and the document's BEST-matching passage, from -1 to 1, higher being closer. A document is cut into passages of about 2000 bytes, each embedded on its own, so a fact deep in a long page scores as high as one in its first paragraph. 0 for a document only the lexical leg found, which has no similarity to report. There is no absolute cutoff: what counts as a good score moves with the query and the embedding model, so compare scores within one response and not across queries.
|
|
Score *float64 `json:"score,omitempty"`
|
|
// Title is the document's title. Empty for a document saved without one; it is a label to show, never the id (that is Name).
|
|
Title *string `json:"title,omitempty"`
|
|
// URL is the document's link back into the app it was ingested from. Absent when the document carries none, which is the normal case for pages and memories.
|
|
Url *string `json:"url,omitempty"`
|
|
AdditionalProperties map[string]interface{}
|
|
}
|
|
|
|
type _KnowledgeHit KnowledgeHit
|
|
|
|
// NewKnowledgeHit instantiates a new KnowledgeHit 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 NewKnowledgeHit() *KnowledgeHit {
|
|
this := KnowledgeHit{}
|
|
return &this
|
|
}
|
|
|
|
// NewKnowledgeHitWithDefaults instantiates a new KnowledgeHit 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 NewKnowledgeHitWithDefaults() *KnowledgeHit {
|
|
this := KnowledgeHit{}
|
|
return &this
|
|
}
|
|
|
|
// GetDoctype returns the Doctype field value if set, zero value otherwise.
|
|
func (o *KnowledgeHit) GetDoctype() string {
|
|
if o == nil || IsNil(o.Doctype) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Doctype
|
|
}
|
|
|
|
// GetDoctypeOk returns a tuple with the Doctype field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *KnowledgeHit) GetDoctypeOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Doctype) {
|
|
return nil, false
|
|
}
|
|
return o.Doctype, true
|
|
}
|
|
|
|
// HasDoctype returns a boolean if a field has been set.
|
|
func (o *KnowledgeHit) HasDoctype() bool {
|
|
if o != nil && !IsNil(o.Doctype) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetDoctype gets a reference to the given string and assigns it to the Doctype field.
|
|
func (o *KnowledgeHit) SetDoctype(v string) {
|
|
o.Doctype = &v
|
|
}
|
|
|
|
// GetName returns the Name field value if set, zero value otherwise.
|
|
func (o *KnowledgeHit) GetName() string {
|
|
if o == nil || IsNil(o.Name) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Name
|
|
}
|
|
|
|
// GetNameOk returns a tuple with the Name field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *KnowledgeHit) GetNameOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Name) {
|
|
return nil, false
|
|
}
|
|
return o.Name, true
|
|
}
|
|
|
|
// HasName returns a boolean if a field has been set.
|
|
func (o *KnowledgeHit) HasName() bool {
|
|
if o != nil && !IsNil(o.Name) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetName gets a reference to the given string and assigns it to the Name field.
|
|
func (o *KnowledgeHit) SetName(v string) {
|
|
o.Name = &v
|
|
}
|
|
|
|
// GetProject returns the Project field value if set, zero value otherwise.
|
|
func (o *KnowledgeHit) GetProject() string {
|
|
if o == nil || IsNil(o.Project) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Project
|
|
}
|
|
|
|
// GetProjectOk returns a tuple with the Project field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *KnowledgeHit) GetProjectOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Project) {
|
|
return nil, false
|
|
}
|
|
return o.Project, true
|
|
}
|
|
|
|
// HasProject returns a boolean if a field has been set.
|
|
func (o *KnowledgeHit) HasProject() bool {
|
|
if o != nil && !IsNil(o.Project) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetProject gets a reference to the given string and assigns it to the Project field.
|
|
func (o *KnowledgeHit) SetProject(v string) {
|
|
o.Project = &v
|
|
}
|
|
|
|
// GetProvider returns the Provider field value if set, zero value otherwise.
|
|
func (o *KnowledgeHit) GetProvider() string {
|
|
if o == nil || IsNil(o.Provider) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Provider
|
|
}
|
|
|
|
// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *KnowledgeHit) GetProviderOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Provider) {
|
|
return nil, false
|
|
}
|
|
return o.Provider, true
|
|
}
|
|
|
|
// HasProvider returns a boolean if a field has been set.
|
|
func (o *KnowledgeHit) HasProvider() bool {
|
|
if o != nil && !IsNil(o.Provider) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetProvider gets a reference to the given string and assigns it to the Provider field.
|
|
func (o *KnowledgeHit) SetProvider(v string) {
|
|
o.Provider = &v
|
|
}
|
|
|
|
// GetScore returns the Score field value if set, zero value otherwise.
|
|
func (o *KnowledgeHit) GetScore() float64 {
|
|
if o == nil || IsNil(o.Score) {
|
|
var ret float64
|
|
return ret
|
|
}
|
|
return *o.Score
|
|
}
|
|
|
|
// GetScoreOk returns a tuple with the Score field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *KnowledgeHit) GetScoreOk() (*float64, bool) {
|
|
if o == nil || IsNil(o.Score) {
|
|
return nil, false
|
|
}
|
|
return o.Score, true
|
|
}
|
|
|
|
// HasScore returns a boolean if a field has been set.
|
|
func (o *KnowledgeHit) HasScore() bool {
|
|
if o != nil && !IsNil(o.Score) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetScore gets a reference to the given float64 and assigns it to the Score field.
|
|
func (o *KnowledgeHit) SetScore(v float64) {
|
|
o.Score = &v
|
|
}
|
|
|
|
// GetTitle returns the Title field value if set, zero value otherwise.
|
|
func (o *KnowledgeHit) GetTitle() string {
|
|
if o == nil || IsNil(o.Title) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Title
|
|
}
|
|
|
|
// GetTitleOk returns a tuple with the Title field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *KnowledgeHit) GetTitleOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Title) {
|
|
return nil, false
|
|
}
|
|
return o.Title, true
|
|
}
|
|
|
|
// HasTitle returns a boolean if a field has been set.
|
|
func (o *KnowledgeHit) HasTitle() bool {
|
|
if o != nil && !IsNil(o.Title) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetTitle gets a reference to the given string and assigns it to the Title field.
|
|
func (o *KnowledgeHit) SetTitle(v string) {
|
|
o.Title = &v
|
|
}
|
|
|
|
// GetUrl returns the Url field value if set, zero value otherwise.
|
|
func (o *KnowledgeHit) GetUrl() string {
|
|
if o == nil || IsNil(o.Url) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Url
|
|
}
|
|
|
|
// GetUrlOk returns a tuple with the Url field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *KnowledgeHit) GetUrlOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Url) {
|
|
return nil, false
|
|
}
|
|
return o.Url, true
|
|
}
|
|
|
|
// HasUrl returns a boolean if a field has been set.
|
|
func (o *KnowledgeHit) HasUrl() bool {
|
|
if o != nil && !IsNil(o.Url) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetUrl gets a reference to the given string and assigns it to the Url field.
|
|
func (o *KnowledgeHit) SetUrl(v string) {
|
|
o.Url = &v
|
|
}
|
|
|
|
func (o KnowledgeHit) MarshalJSON() ([]byte, error) {
|
|
toSerialize, err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o KnowledgeHit) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if !IsNil(o.Doctype) {
|
|
toSerialize["doctype"] = o.Doctype
|
|
}
|
|
if !IsNil(o.Name) {
|
|
toSerialize["name"] = o.Name
|
|
}
|
|
if !IsNil(o.Project) {
|
|
toSerialize["project"] = o.Project
|
|
}
|
|
if !IsNil(o.Provider) {
|
|
toSerialize["provider"] = o.Provider
|
|
}
|
|
if !IsNil(o.Score) {
|
|
toSerialize["score"] = o.Score
|
|
}
|
|
if !IsNil(o.Title) {
|
|
toSerialize["title"] = o.Title
|
|
}
|
|
if !IsNil(o.Url) {
|
|
toSerialize["url"] = o.Url
|
|
}
|
|
|
|
for key, value := range o.AdditionalProperties {
|
|
toSerialize[key] = value
|
|
}
|
|
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *KnowledgeHit) UnmarshalJSON(data []byte) (err error) {
|
|
varKnowledgeHit := _KnowledgeHit{}
|
|
|
|
err = json.Unmarshal(data, &varKnowledgeHit)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = KnowledgeHit(varKnowledgeHit)
|
|
|
|
additionalProperties := make(map[string]interface{})
|
|
|
|
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
|
delete(additionalProperties, "doctype")
|
|
delete(additionalProperties, "name")
|
|
delete(additionalProperties, "project")
|
|
delete(additionalProperties, "provider")
|
|
delete(additionalProperties, "score")
|
|
delete(additionalProperties, "title")
|
|
delete(additionalProperties, "url")
|
|
o.AdditionalProperties = additionalProperties
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableKnowledgeHit struct {
|
|
value *KnowledgeHit
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableKnowledgeHit) Get() *KnowledgeHit {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableKnowledgeHit) Set(val *KnowledgeHit) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableKnowledgeHit) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableKnowledgeHit) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableKnowledgeHit(val *KnowledgeHit) *NullableKnowledgeHit {
|
|
return &NullableKnowledgeHit{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableKnowledgeHit) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableKnowledgeHit) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|