Class: AppchatFunction
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- AppchatFunction
- Defined in:
- lib/generators/appchat/templates/models/appchat_function.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.all_to_prompt_json ⇒ Object
15 16 17 |
# File 'lib/generators/appchat/templates/models/appchat_function.rb', line 15 def self.all_to_prompt_json all.includes(:function_parameters).map(&:to_prompt_hash).to_json end |
Instance Method Details
#to_prompt_hash ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/generators/appchat/templates/models/appchat_function.rb', line 4 def to_prompt_hash { name: name, description: description, class_name: class_name, parameters: function_parameters.each_with_object({}) do |param, hash| hash[param.name] = param.example_value end } end |