Module: Z4ai
- Defined in:
- lib/z4ai.rb,
lib/z4ai/version.rb
Defined Under Namespace
Classes: C, Error, Func, JsonApi
Constant Summary collapse
- VERSION =
"0.1.0"
- COMMIT =
`git log --format="%H" -n 1`.strip
- @@C =
Hash.new { |h,k| h[k] = C.new(k) }
- @@GPS =
Hash.new do |h,k| x = Wikipedia.find(k.to_s) if x xx = x.coordinates if xx != nil h[k] = [ xx[0], xx[1] ] end end end
- @@INFO =
Hash.new do |h,k| a = [] s = Wikipedia.find(k.to_s) if s s.page['extract'].split("\n").each { |e| ee = %[#{e}] if !/^=+/.match(e) ee.split(". ").each { |ss| if ss.length > 5 && ss.length <= 200; a << ss.strip end } end } h[k] = a else return false end end
Class Method Summary collapse
-
.calc(f) ⇒ Object
function calculator handler.
-
.engine(i) ⇒ Object
general llm engine.
-
.engines ⇒ Object
active llm engines.
-
.gps ⇒ Object
fixed point locations.
-
.info ⇒ Object
information corpus.
-
.weather(*gps) ⇒ Object
weather information.
Class Method Details
.calc(f) ⇒ Object
function calculator handler
157 158 159 |
# File 'lib/z4ai.rb', line 157 def self.calc f Func.new(f) end |
.engine(i) ⇒ Object
general llm engine.
59 60 61 |
# File 'lib/z4ai.rb', line 59 def self.engine i @@C[i] end |
.engines ⇒ Object
active llm engines.
53 54 55 |
# File 'lib/z4ai.rb', line 53 def self.engines @@C end |
.gps ⇒ Object
fixed point locations.
98 99 100 |
# File 'lib/z4ai.rb', line 98 def self.gps @@GPS end |
.info ⇒ Object
information corpus
124 125 126 |
# File 'lib/z4ai.rb', line 124 def self.info @@INFO end |
.weather(*gps) ⇒ Object
weather information
130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/z4ai.rb', line 130 def self.weather *gps ggps = [gps].flatten hh = {} hh[:latitude] = ggps[0] hh[:longitude] = ggps[1] hh[:current] = [:temperature_2m,:relativehumidity_2m,:precipitation,:weathercode,:surface_pressure,:windspeed_10m,:winddirection_10m,:windgusts_10m] hh[:hourly] = [:temperature_2m,:precipitation_probability,:precipitation,:weathercode,:surface_pressure,:visibility] hh[:timezone] = ggps[2] || %[America%2FDenver] hh[:precipitation_unit] = %[inch] hh[:forecast_days] = ggps[3] || 1 hh[:windspeed_unit] = %[mph] hh[:temperature_unit] = %[fahrenheit] JsonApi.new("https://api.open-meteo.com/v1").get('forecast',hh) end |