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.
-
#location_description? ⇒ String?
The location_description? method returns the location description string if the location setting is enabled; otherwise it returns nil.
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, and units.
41 42 43 44 45 46 47 |
# File 'lib/ollama_chat/location_handling.rb', line 41 def location_data { location_name: config.location.name, location_decimal_degrees: config.location.decimal_degrees * ', ', 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 and units, using the configured location prompt template.
20 21 22 |
# File 'lib/ollama_chat/location_handling.rb', line 20 def location_description config.prompts.location % location_data end |
#location_description? ⇒ String?
The location_description? method returns the location description string if the location setting is enabled; otherwise it returns nil.
28 29 30 |
# File 'lib/ollama_chat/location_handling.rb', line 28 def location_description? location_description if location.on? end |