Class: Aidp::PromptOptimization::ProjectKnowledgeFragment

Inherits:
Object
  • Object
show all
Defined in:
lib/aidp/prompt_optimization/project_knowledge_indexer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, title:, note_type:, file_path:, content:, linked_paths:, tags:) ⇒ ProjectKnowledgeFragment

Returns a new instance of ProjectKnowledgeFragment.



83
84
85
86
87
88
89
90
91
# File 'lib/aidp/prompt_optimization/project_knowledge_indexer.rb', line 83

def initialize(id:, title:, note_type:, file_path:, content:, linked_paths:, tags:)
  @id = id
  @title = title
  @note_type = note_type
  @file_path = file_path
  @content = content
  @linked_paths = linked_paths
  @tags = tags
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



81
82
83
# File 'lib/aidp/prompt_optimization/project_knowledge_indexer.rb', line 81

def content
  @content
end

#file_pathObject (readonly)

Returns the value of attribute file_path.



81
82
83
# File 'lib/aidp/prompt_optimization/project_knowledge_indexer.rb', line 81

def file_path
  @file_path
end

#idObject (readonly)

Returns the value of attribute id.



81
82
83
# File 'lib/aidp/prompt_optimization/project_knowledge_indexer.rb', line 81

def id
  @id
end

#linked_pathsObject (readonly)

Returns the value of attribute linked_paths.



81
82
83
# File 'lib/aidp/prompt_optimization/project_knowledge_indexer.rb', line 81

def linked_paths
  @linked_paths
end

#note_typeObject (readonly)

Returns the value of attribute note_type.



81
82
83
# File 'lib/aidp/prompt_optimization/project_knowledge_indexer.rb', line 81

def note_type
  @note_type
end

#tagsObject (readonly)

Returns the value of attribute tags.



81
82
83
# File 'lib/aidp/prompt_optimization/project_knowledge_indexer.rb', line 81

def tags
  @tags
end

#titleObject (readonly)

Returns the value of attribute title.



81
82
83
# File 'lib/aidp/prompt_optimization/project_knowledge_indexer.rb', line 81

def title
  @title
end

Instance Method Details

#estimated_tokensObject



93
94
95
# File 'lib/aidp/prompt_optimization/project_knowledge_indexer.rb', line 93

def estimated_tokens
  (content.length / 4.0).ceil
end