Module: Rails::Nl2sql
- Defined in:
- lib/rails/nl2sql.rb,
lib/rails/nl2sql/cli.rb,
lib/rails/nl2sql/railtie.rb,
lib/rails/nl2sql/version.rb,
lib/rails/nl2sql/prompt_builder.rb,
lib/rails/nl2sql/providers/base.rb,
lib/rails/nl2sql/schema_builder.rb,
lib/rails/nl2sql/query_generator.rb,
lib/rails/nl2sql/query_validator.rb,
lib/rails/nl2sql/active_record_extension.rb,
lib/rails/nl2sql/providers/llama_provider.rb,
lib/rails/nl2sql/providers/gemini_provider.rb,
lib/rails/nl2sql/providers/openai_provider.rb,
lib/rails/nl2sql/providers/anthropic_provider.rb
Defined Under Namespace
Modules: ActiveRecordExtension, Providers Classes: CLI, Error, InstallGenerator, Processor, PromptBuilder, QueryGenerator, QueryValidator, Railtie, SchemaBuilder
Constant Summary collapse
- VERSION =
"0.2.10"
Class Attribute Summary collapse
-
.api_key ⇒ Object
Returns the value of attribute api_key.
-
.debug ⇒ Object
Returns the value of attribute debug.
-
.max_schema_lines ⇒ Object
Returns the value of attribute max_schema_lines.
-
.model ⇒ Object
Returns the value of attribute model.
-
.provider ⇒ Object
Returns the value of attribute provider.
Class Method Summary collapse
- .configure {|_self| ... } ⇒ Object
- .prompt_template ⇒ Object
- .prompt_template_path ⇒ Object
- .prompt_template_path=(path) ⇒ Object
Class Attribute Details
.api_key ⇒ Object
Returns the value of attribute api_key.
20 21 22 |
# File 'lib/rails/nl2sql.rb', line 20 def api_key @api_key end |
.debug ⇒ Object
Returns the value of attribute debug.
24 25 26 |
# File 'lib/rails/nl2sql.rb', line 24 def debug @debug end |
.max_schema_lines ⇒ Object
Returns the value of attribute max_schema_lines.
23 24 25 |
# File 'lib/rails/nl2sql.rb', line 23 def max_schema_lines @max_schema_lines end |
.model ⇒ Object
Returns the value of attribute model.
21 22 23 |
# File 'lib/rails/nl2sql.rb', line 21 def model @model end |
.provider ⇒ Object
Returns the value of attribute provider.
22 23 24 |
# File 'lib/rails/nl2sql.rb', line 22 def provider @provider end |
Class Method Details
.configure {|_self| ... } ⇒ Object
40 41 42 |
# File 'lib/rails/nl2sql.rb', line 40 def self.configure yield self end |
.prompt_template ⇒ Object
44 45 46 47 48 |
# File 'lib/rails/nl2sql.rb', line 44 def self.prompt_template # Load the YAML template without evaluating ERB so we can # interpolate variables later when building prompts. @prompt_template ||= YAML.safe_load(File.read(prompt_template_path)) end |
.prompt_template_path ⇒ Object
31 32 33 |
# File 'lib/rails/nl2sql.rb', line 31 def prompt_template_path @prompt_template_path || File.('nl2sql/prompts/default.yml.erb', __dir__) end |
.prompt_template_path=(path) ⇒ Object
26 27 28 29 |
# File 'lib/rails/nl2sql.rb', line 26 def prompt_template_path=(path) @prompt_template = nil @prompt_template_path = path end |