Class: Vapi::CreateTrieveKnowledgeBaseDto

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: OMIT, search_plan: OMIT, create_plan: OMIT, additional_properties: nil) ⇒ Vapi::CreateTrieveKnowledgeBaseDto

Parameters:

  • name (String) (defaults to: OMIT)

    This is the name of the knowledge base.

  • search_plan (Vapi::TrieveKnowledgeBaseSearchPlan) (defaults to: OMIT)

    This is the searching plan used when searching for relevant chunks from the vector store. You should configure this if you’re running into these issues:

    • Too much unnecessary context is being fed as knowledge base context.

    • Not enough relevant context is being fed as knowledge base context.

  • create_plan (Vapi::TrieveKnowledgeBaseImport) (defaults to: OMIT)

    This is the plan if you want us to create/import a new vector store using Trieve.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



39
40
41
42
43
44
45
46
47
# File 'lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb', line 39

def initialize(name: OMIT, search_plan: OMIT, create_plan: OMIT, additional_properties: nil)
  @name = name if name != OMIT
  @search_plan = search_plan if search_plan != OMIT
  @create_plan = create_plan if create_plan != OMIT
  @additional_properties = additional_properties
  @_field_set = { "name": name, "searchPlan": search_plan, "createPlan": create_plan }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



22
23
24
# File 'lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb', line 22

def additional_properties
  @additional_properties
end

#create_planVapi::TrieveKnowledgeBaseImport (readonly)

Returns This is the plan if you want us to create/import a new vector store using Trieve.

Returns:



20
21
22
# File 'lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb', line 20

def create_plan
  @create_plan
end

#nameString (readonly)

Returns This is the name of the knowledge base.

Returns:

  • (String)

    This is the name of the knowledge base.



11
12
13
# File 'lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb', line 11

def name
  @name
end

#search_planVapi::TrieveKnowledgeBaseSearchPlan (readonly)

Returns This is the searching plan used when searching for relevant chunks from the vector store. You should configure this if you’re running into these issues:

  • Too much unnecessary context is being fed as knowledge base context.

  • Not enough relevant context is being fed as knowledge base context.

Returns:

  • (Vapi::TrieveKnowledgeBaseSearchPlan)

    This is the searching plan used when searching for relevant chunks from the vector store. You should configure this if you’re running into these issues:

    • Too much unnecessary context is being fed as knowledge base context.

    • Not enough relevant context is being fed as knowledge base context.



17
18
19
# File 'lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb', line 17

def search_plan
  @search_plan
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::CreateTrieveKnowledgeBaseDto

Deserialize a JSON object to an instance of CreateTrieveKnowledgeBaseDto

Parameters:

  • json_object (String)

Returns:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb', line 53

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  name = parsed_json["name"]
  if parsed_json["searchPlan"].nil?
    search_plan = nil
  else
    search_plan = parsed_json["searchPlan"].to_json
    search_plan = Vapi::TrieveKnowledgeBaseSearchPlan.from_json(json_object: search_plan)
  end
  if parsed_json["createPlan"].nil?
    create_plan = nil
  else
    create_plan = parsed_json["createPlan"].to_json
    create_plan = Vapi::TrieveKnowledgeBaseImport.from_json(json_object: create_plan)
  end
  new(
    name: name,
    search_plan: search_plan,
    create_plan: create_plan,
    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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


90
91
92
93
94
# File 'lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb', line 90

def self.validate_raw(obj:)
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.search_plan.nil? || Vapi::TrieveKnowledgeBaseSearchPlan.validate_raw(obj: obj.search_plan)
  obj.create_plan.nil? || Vapi::TrieveKnowledgeBaseImport.validate_raw(obj: obj.create_plan)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of CreateTrieveKnowledgeBaseDto to a JSON object

Returns:

  • (String)


80
81
82
# File 'lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb', line 80

def to_json(*_args)
  @_field_set&.to_json
end