Module: OllamaChat::LocationHandling
- Included in:
- Chat
- Defined in:
- lib/ollama_chat/location_handling.rb
Overview
A module that provides location handling functionality for OllamaChat.
The LocationHandling module encapsulates methods for managing location information, including generating location data and creating location descriptions for use in chat sessions. It integrates with the application’s configuration to provide contextual location information to language models.
Instance Method Summary collapse
-
#location_data ⇒ Hash
Generates a hash containing current location data.
-
#location_description ⇒ String
Generates a location description string formatted with the current location data.
Instance Method Details
#location_data ⇒ Hash
Generates a hash containing current location data.
This method collects and returns structured location information including the location name, decimal degrees coordinates, local time, and units.
37 38 39 40 41 42 43 44 |
# File 'lib/ollama_chat/location_handling.rb', line 37 def location_data { location_name: config.location.name, location_decimal_degrees: config.location.decimal_degrees * ', ', localtime: Time.now.iso8601, units: config.location.units, } end |
#location_description ⇒ String
Generates a location description string formatted with the current location data.
This method creates a formatted string containing location information including name, coordinates, local time, and units, using the configured location prompt template.
23 24 25 |
# File 'lib/ollama_chat/location_handling.rb', line 23 def location_description config.prompts.location % location_data end |