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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +21 -268
  3. data/CHANGELOG.md +37 -0
  4. data/INTEGRATION_GUIDE.md +7 -1
  5. data/README.md +210 -1
  6. data/Steepfile +12 -12
  7. data/db/migrate/001_create_prescient_tables.rb +15 -16
  8. data/examples/README.md +2 -1
  9. data/examples/custom_contexts.rb +4 -4
  10. data/exe/prescient +2 -2
  11. data/exe/prescient-mcp +7 -0
  12. data/lib/prescient/agent/audit_log.rb +37 -0
  13. data/lib/prescient/agent/cli_adapter.rb +29 -0
  14. data/lib/prescient/agent/configuration.rb +57 -0
  15. data/lib/prescient/agent/context.rb +56 -0
  16. data/lib/prescient/agent/error_serializer.rb +47 -0
  17. data/lib/prescient/agent/errors.rb +25 -0
  18. data/lib/prescient/agent/parser.rb +49 -0
  19. data/lib/prescient/agent/prompt_builder.rb +31 -0
  20. data/lib/prescient/agent/result.rb +36 -0
  21. data/lib/prescient/agent/runtime.rb +175 -0
  22. data/lib/prescient/agent/schema_validator.rb +215 -0
  23. data/lib/prescient/agent/tool_registry.rb +89 -0
  24. data/lib/prescient/agent.rb +22 -0
  25. data/lib/prescient/api.rb +337 -274
  26. data/lib/prescient/base.rb +370 -372
  27. data/lib/prescient/cli.rb +586 -526
  28. data/lib/prescient/client.rb +7 -6
  29. data/lib/prescient/configuration_loader.rb +492 -488
  30. data/lib/prescient/document_source.rb +114 -0
  31. data/lib/prescient/errors.rb +1 -3
  32. data/lib/prescient/mcp/authentication.rb +39 -0
  33. data/lib/prescient/mcp/configuration.rb +38 -0
  34. data/lib/prescient/mcp/rack.rb +243 -0
  35. data/lib/prescient/mcp/server.rb +202 -0
  36. data/lib/prescient/mcp/stdio.rb +42 -0
  37. data/lib/prescient/mcp.rb +8 -0
  38. data/lib/prescient/pgvector.rb +193 -189
  39. data/lib/prescient/provider/anthropic.rb +129 -125
  40. data/lib/prescient/provider/deepseek.rb +122 -118
  41. data/lib/prescient/provider/gemini.rb +153 -149
  42. data/lib/prescient/provider/huggingface.rb +191 -187
  43. data/lib/prescient/provider/mistral.rb +151 -147
  44. data/lib/prescient/provider/ollama.rb +168 -165
  45. data/lib/prescient/provider/openai.rb +174 -169
  46. data/lib/prescient/provider/xai.rb +122 -118
  47. data/lib/prescient/tool/search_api.rb +125 -121
  48. data/lib/prescient/tool/searxng.rb +123 -119
  49. data/lib/prescient/tool.rb +100 -98
  50. data/lib/prescient/version.rb +1 -1
  51. data/lib/prescient.rb +68 -62
  52. data/sig/prescient.rbs +176 -1
  53. metadata +23 -1
@@ -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: @provider_name,
108
- class: @provider.class.name.split('::').last,
108
+ name: @provider_name,
109
+ class: @provider.class.name.split("::").last,
109
110
  available: available?,
110
- options: sanitize_options(@provider.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, 'tool results must be an array' unless context_items.is_a?(Array)
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