Class: Githuh::LLM::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/githuh/llm/base.rb

Direct Known Subclasses

Anthropic, OpenAI

Constant Summary collapse

README_CHAR_LIMIT =

Hard cap to keep prompts cheap and within model context.

12_000
REQUEST_TIMEOUT =
30
PROMPT =
<<~PROMPT
  You are summarizing a GitHub repository for a public directory page.
  Below is the README. Write a user-friendly description of 5–6 sentences.
  Focus on: what the project *is*, what problem it *solves*, who would
  use it, and any notable technical approach or feature. Keep it flowing
  prose — no bullet points, no headings, no quotes, no markdown syntax.
  Do NOT include installation instructions, badges, license mentions,
  or author credits. Return ONLY the description prose — no preamble.

  README:
  ---
  %<readme>s
  ---
PROMPT

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key:) ⇒ Base

Returns a new instance of Base.



31
32
33
34
# File 'lib/githuh/llm/base.rb', line 31

def initialize(api_key:)
  @api_key = api_key
  @name = self.class.name.split('::').last.downcase
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



29
30
31
# File 'lib/githuh/llm/base.rb', line 29

def api_key
  @api_key
end

#nameObject (readonly)

Returns the value of attribute name.



29
30
31
# File 'lib/githuh/llm/base.rb', line 29

def name
  @name
end

Instance Method Details

#summarize(readme) ⇒ String

Returns a 2-4 sentence description.

Parameters:

  • readme (String)

    raw README markdown

Returns:

  • (String)

    a 2-4 sentence description

Raises:

  • (NotImplementedError)


38
39
40
# File 'lib/githuh/llm/base.rb', line 38

def summarize(readme)
  raise NotImplementedError
end