Module: Pedicab

Defined in:
lib/pedicab.rb,
lib/pedicab/ride.rb,
lib/pedicab/version.rb

Defined Under Namespace

Classes: Error, P, Ride

Constant Summary collapse

VERSION =
"0.3.6"
@@MEMORY =
5

Class Method Summary collapse

Class Method Details

.<<(i) ⇒ String

Prompt without context (convenience method)

Examples:

Pedicab << "My prompt input string"  

Parameters:

  • i (String) —

    Prompt input

Returns:

  • (String) —

    Prompt output



178
179
180
# File 'lib/pedicab.rb', line 178

def self.<< i
  Pedicab['subconscious'].ride.go(i)
end

.[](k) ⇒ Pedicab::P

Create a new conversation instance (convenience method)

Examples:

ai = Pedicab['my_assistant']
response = ai["Hello, world!"]

Parameters:

  • k (String) —

    Unique identifier for the conversation

Returns:



199
200
201
# File 'lib/pedicab.rb', line 199

def self.[] k
  P.new(k)
end

.if?(i) ⇒ Boolean

Gate without context (convenience method)

Examples:

Pedicab.if?("Humans can fly by flpping their arms rapidly.") ? "crazy." : "not crazy."

Parameters:

  • i (String) —

    Prompt input

Returns:

  • (Boolean) —

    Prompt output



188
189
190
# File 'lib/pedicab.rb', line 188

def self.if? i
  Pedicab['subconscious'].ride.if?(i)
end

.memory ⇒ Object



16
17
18
# File 'lib/pedicab.rb', line 16

def self.memory
  @@MEMORY
end

.memory=(size) ⇒ Object



20
21
22
# File 'lib/pedicab.rb', line 20

def self.memory= size
  @@MEMORY = size
end

.models ⇒ Array<String>

Lists all available GGUF models in the /models directory

Examples:

puts Pedicab.models
=> ["qwen", "llama2", "mistral"]

Returns:

  • (Array<String>) —

    Array of model names (without .gguf extension)



29
30
31
# File 'lib/pedicab.rb', line 29

def self.models
  Dir['/models/*'].map { |e| e.gsub('.gguf', '').gsub('/models/','') }
end

.ride(k) ⇒ Object



86
87
88
# File 'lib/pedicab/ride.rb', line 86

def self.ride(k)
  Ride.new(k)
end