Module: Prescient
- Defined in:
- lib/prescient.rb,
lib/prescient.rb,
lib/prescient/client.rb,
lib/prescient/version.rb
Overview
Main Prescient module for AI provider abstraction
Prescient provides a unified interface for working with multiple AI providers including Ollama, OpenAI, Anthropic, and HuggingFace. It supports both embedding generation and text completion with configurable context handling.
Defined Under Namespace
Modules: Provider Classes: AuthenticationError, Base, Client, Configuration, ConnectionError, Error, InvalidResponseError, ModelNotAvailableError, RateLimitError
Constant Summary collapse
- VERSION =
'0.2.0'
Class Method Summary collapse
-
.client(provider_name = nil, enable_fallback: true) ⇒ Object
Convenience methods for quick access.
-
.configuration ⇒ Configuration
Get the current configuration instance.
-
.configure {|config| ... } ⇒ void
Configure Prescient with custom settings and providers.
- .generate_embedding(text, provider: nil, enable_fallback: true, **options) ⇒ Object
- .generate_response(prompt, context_items = [], provider: nil, enable_fallback: true, **options) ⇒ Object
- .health_check(provider: nil) ⇒ Object
-
.reset_configuration! ⇒ Configuration
Reset configuration to defaults.
Class Method Details
.client(provider_name = nil, enable_fallback: true) ⇒ Object
Convenience methods for quick access
196 197 198 |
# File 'lib/prescient/client.rb', line 196 def self.client(provider_name = nil, enable_fallback: true) Client.new(provider_name, enable_fallback: enable_fallback) end |
.configuration ⇒ Configuration
Get the current configuration instance
82 83 84 |
# File 'lib/prescient.rb', line 82 def self.configuration @_configuration ||= Configuration.new end |
.configure {|config| ... } ⇒ void
This method returns an undefined value.
Configure Prescient with custom settings and providers
75 76 77 |
# File 'lib/prescient.rb', line 75 def self.configure yield(configuration) end |
.generate_embedding(text, provider: nil, enable_fallback: true, **options) ⇒ Object
200 201 202 |
# File 'lib/prescient/client.rb', line 200 def self.(text, provider: nil, enable_fallback: true, **) client(provider, enable_fallback: enable_fallback).(text, **) end |
.generate_response(prompt, context_items = [], provider: nil, enable_fallback: true, **options) ⇒ Object
204 205 206 |
# File 'lib/prescient/client.rb', line 204 def self.generate_response(prompt, context_items = [], provider: nil, enable_fallback: true, **) client(provider, enable_fallback: enable_fallback).generate_response(prompt, context_items, **) end |
.health_check(provider: nil) ⇒ Object
208 209 210 |
# File 'lib/prescient/client.rb', line 208 def self.health_check(provider: nil) client(provider, enable_fallback: false).health_check end |
.reset_configuration! ⇒ Configuration
Reset configuration to defaults
89 90 91 |
# File 'lib/prescient.rb', line 89 def self.reset_configuration! @_configuration = Configuration.new end |