prescient 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +21 -268
- data/CHANGELOG.md +37 -0
- data/INTEGRATION_GUIDE.md +7 -1
- data/README.md +210 -1
- data/Steepfile +12 -12
- data/db/migrate/001_create_prescient_tables.rb +15 -16
- data/examples/README.md +2 -1
- data/examples/custom_contexts.rb +4 -4
- data/exe/prescient +2 -2
- data/exe/prescient-mcp +7 -0
- data/lib/prescient/agent/audit_log.rb +37 -0
- data/lib/prescient/agent/cli_adapter.rb +29 -0
- data/lib/prescient/agent/configuration.rb +57 -0
- data/lib/prescient/agent/context.rb +56 -0
- data/lib/prescient/agent/error_serializer.rb +47 -0
- data/lib/prescient/agent/errors.rb +25 -0
- data/lib/prescient/agent/parser.rb +49 -0
- data/lib/prescient/agent/prompt_builder.rb +31 -0
- data/lib/prescient/agent/result.rb +36 -0
- data/lib/prescient/agent/runtime.rb +175 -0
- data/lib/prescient/agent/schema_validator.rb +215 -0
- data/lib/prescient/agent/tool_registry.rb +89 -0
- data/lib/prescient/agent.rb +22 -0
- data/lib/prescient/api.rb +337 -274
- data/lib/prescient/base.rb +370 -372
- data/lib/prescient/cli.rb +586 -526
- data/lib/prescient/client.rb +7 -6
- data/lib/prescient/configuration_loader.rb +492 -488
- data/lib/prescient/document_source.rb +114 -0
- data/lib/prescient/errors.rb +1 -3
- data/lib/prescient/mcp/authentication.rb +39 -0
- data/lib/prescient/mcp/configuration.rb +38 -0
- data/lib/prescient/mcp/rack.rb +243 -0
- data/lib/prescient/mcp/server.rb +202 -0
- data/lib/prescient/mcp/stdio.rb +42 -0
- data/lib/prescient/mcp.rb +8 -0
- data/lib/prescient/pgvector.rb +193 -189
- data/lib/prescient/provider/anthropic.rb +129 -125
- data/lib/prescient/provider/deepseek.rb +122 -118
- data/lib/prescient/provider/gemini.rb +153 -149
- data/lib/prescient/provider/huggingface.rb +191 -187
- data/lib/prescient/provider/mistral.rb +151 -147
- data/lib/prescient/provider/ollama.rb +168 -165
- data/lib/prescient/provider/openai.rb +174 -169
- data/lib/prescient/provider/xai.rb +122 -118
- data/lib/prescient/tool/search_api.rb +125 -121
- data/lib/prescient/tool/searxng.rb +123 -119
- data/lib/prescient/tool.rb +100 -98
- data/lib/prescient/version.rb +1 -1
- data/lib/prescient.rb +68 -62
- data/sig/prescient.rbs +176 -1
- metadata +23 -1
data/lib/prescient/client.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
# Main Prescient module for AI provider abstraction
|
|
3
4
|
module Prescient
|
|
4
5
|
# Client class for interacting with AI providers
|
|
5
6
|
#
|
|
@@ -104,10 +105,10 @@ module Prescient
|
|
|
104
105
|
# and recursively sanitized :options
|
|
105
106
|
def provider_info
|
|
106
107
|
{
|
|
107
|
-
name:
|
|
108
|
-
class:
|
|
108
|
+
name: @provider_name,
|
|
109
|
+
class: @provider.class.name.split("::").last,
|
|
109
110
|
available: available?,
|
|
110
|
-
options:
|
|
111
|
+
options: sanitize_options(@provider.options)
|
|
111
112
|
}
|
|
112
113
|
end
|
|
113
114
|
|
|
@@ -210,7 +211,7 @@ module Prescient
|
|
|
210
211
|
Prescient::ConnectionError,
|
|
211
212
|
Prescient::RateLimitError,
|
|
212
213
|
Prescient::ModelNotAvailableError,
|
|
213
|
-
Prescient::ProviderError
|
|
214
|
+
Prescient::ProviderError
|
|
214
215
|
].any? { |error_class| error.is_a?(error_class) }
|
|
215
216
|
end
|
|
216
217
|
end
|
|
@@ -264,12 +265,12 @@ module Prescient
|
|
|
264
265
|
|
|
265
266
|
search_result = search_tool.search(query, limit: limit)
|
|
266
267
|
context_items = search_result[:results]
|
|
267
|
-
raise Prescient::ToolInvalidResponseError,
|
|
268
|
+
raise Prescient::ToolInvalidResponseError, "tool results must be an array" unless context_items.is_a?(Array)
|
|
268
269
|
|
|
269
270
|
client(provider, enable_fallback:, provider_options:).generate_response(
|
|
270
271
|
query,
|
|
271
272
|
context_items,
|
|
272
|
-
**options
|
|
273
|
+
**options
|
|
273
274
|
)
|
|
274
275
|
end
|
|
275
276
|
|