Class: Vapi::TrieveKnowledgeBaseSearchPlan
- Inherits:
-
Object
- Object
- Vapi::TrieveKnowledgeBaseSearchPlan
- Defined in:
- lib/vapi_server_sdk/types/trieve_knowledge_base_search_plan.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#remove_stop_words ⇒ Boolean
readonly
If true, stop words (specified in server/src/stop-words.txt in the git repo) will be removed.
-
#score_threshold ⇒ Float
readonly
This is the score threshold to filter out chunks with a score below the threshold for cosine distance metric.
-
#search_type ⇒ Vapi::TrieveKnowledgeBaseSearchPlanSearchType
readonly
This is the search method used when searching for relevant chunks from the vector store.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::TrieveKnowledgeBaseSearchPlan
Deserialize a JSON object to an instance of TrieveKnowledgeBaseSearchPlan.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(search_type:, remove_stop_words: OMIT, score_threshold: OMIT, additional_properties: nil) ⇒ Vapi::TrieveKnowledgeBaseSearchPlan constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TrieveKnowledgeBaseSearchPlan to a JSON object.
Constructor Details
#initialize(search_type:, remove_stop_words: OMIT, score_threshold: OMIT, additional_properties: nil) ⇒ Vapi::TrieveKnowledgeBaseSearchPlan
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base_search_plan.rb', line 42 def initialize(search_type:, remove_stop_words: OMIT, score_threshold: OMIT, additional_properties: nil) @remove_stop_words = remove_stop_words if remove_stop_words != OMIT @score_threshold = score_threshold if score_threshold != OMIT @search_type = search_type @additional_properties = additional_properties @_field_set = { "removeStopWords": remove_stop_words, "scoreThreshold": score_threshold, "searchType": search_type }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
23 24 25 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base_search_plan.rb', line 23 def additional_properties @additional_properties end |
#remove_stop_words ⇒ Boolean (readonly)
Returns If true, stop words (specified in server/src/stop-words.txt in the git repo) will be removed. This will preserve queries that are entirely stop words.
11 12 13 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base_search_plan.rb', line 11 def remove_stop_words @remove_stop_words end |
#score_threshold ⇒ Float (readonly)
Returns This is the score threshold to filter out chunks with a score below the threshold for cosine distance metric. For Manhattan Distance, Euclidean Distance, and Dot Product, it will filter out scores above the threshold distance. This threshold applies before weight and bias modifications. If not specified, this defaults to no threshold. A threshold of 0 will default to no threshold.
18 19 20 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base_search_plan.rb', line 18 def score_threshold @score_threshold end |
#search_type ⇒ Vapi::TrieveKnowledgeBaseSearchPlanSearchType (readonly)
Returns This is the search method used when searching for relevant chunks from the vector store.
21 22 23 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base_search_plan.rb', line 21 def search_type @search_type end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::TrieveKnowledgeBaseSearchPlan
Deserialize a JSON object to an instance of TrieveKnowledgeBaseSearchPlan
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base_search_plan.rb', line 60 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) remove_stop_words = parsed_json["removeStopWords"] score_threshold = parsed_json["scoreThreshold"] search_type = parsed_json["searchType"] new( remove_stop_words: remove_stop_words, score_threshold: score_threshold, search_type: search_type, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
87 88 89 90 91 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base_search_plan.rb', line 87 def self.validate_raw(obj:) obj.remove_stop_words&.is_a?(Boolean) != false || raise("Passed value for field obj.remove_stop_words is not the expected type, validation failed.") obj.score_threshold&.is_a?(Float) != false || raise("Passed value for field obj.score_threshold is not the expected type, validation failed.") obj.search_type.is_a?(Vapi::TrieveKnowledgeBaseSearchPlanSearchType) != false || raise("Passed value for field obj.search_type is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of TrieveKnowledgeBaseSearchPlan to a JSON object
77 78 79 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base_search_plan.rb', line 77 def to_json(*_args) @_field_set&.to_json end |