prescient 0.4.0 → 0.5.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/CHANGELOG.md +22 -0
- data/INTEGRATION_GUIDE.md +12 -1
- data/README.md +177 -12
- data/Rakefile +1 -1
- data/VECTOR_SEARCH_GUIDE.md +7 -3
- data/examples/README.md +2 -1
- data/examples/basic_usage.rb +1 -1
- data/examples/custom_contexts.rb +6 -21
- data/examples/vector_search.rb +69 -305
- data/lib/prescient/cli.rb +196 -4
- data/lib/prescient/configuration_loader.rb +437 -0
- data/lib/prescient/provider/deepseek.rb +139 -0
- data/lib/prescient/provider/gemini.rb +173 -0
- data/lib/prescient/provider/huggingface.rb +1 -0
- data/lib/prescient/provider/mistral.rb +171 -0
- data/lib/prescient/provider/openai.rb +3 -0
- data/lib/prescient/provider/xai.rb +139 -0
- data/lib/prescient/version.rb +1 -1
- data/lib/prescient.rb +116 -22
- data/schema/prescient.configuration.schema.json +153 -0
- data/sig/prescient.rbs +105 -0
- metadata +7 -1
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/kanutocd/prescient/schema/prescient.configuration.schema.json",
|
|
4
|
+
"title": "Prescient Configuration",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"$schema": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"version": {
|
|
12
|
+
"const": 1
|
|
13
|
+
},
|
|
14
|
+
"default_provider": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"default_provider_env": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"timeout": {
|
|
21
|
+
"type": "number"
|
|
22
|
+
},
|
|
23
|
+
"timeout_env": {
|
|
24
|
+
"type": "string"
|
|
25
|
+
},
|
|
26
|
+
"retry_attempts": {
|
|
27
|
+
"type": "integer"
|
|
28
|
+
},
|
|
29
|
+
"retry_attempts_env": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
"retry_delay": {
|
|
33
|
+
"type": "number"
|
|
34
|
+
},
|
|
35
|
+
"retry_delay_env": {
|
|
36
|
+
"type": "string"
|
|
37
|
+
},
|
|
38
|
+
"fallback_providers": {
|
|
39
|
+
"type": "array",
|
|
40
|
+
"items": {
|
|
41
|
+
"type": "string"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"fallback_providers_env": {
|
|
45
|
+
"type": "string"
|
|
46
|
+
},
|
|
47
|
+
"sensitive_keys": {
|
|
48
|
+
"type": "array",
|
|
49
|
+
"items": {
|
|
50
|
+
"type": "string"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"sensitive_keys_env": {
|
|
54
|
+
"type": "string"
|
|
55
|
+
},
|
|
56
|
+
"providers": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"additionalProperties": {
|
|
59
|
+
"$ref": "#/$defs/provider"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"$defs": {
|
|
64
|
+
"provider": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"additionalProperties": false,
|
|
67
|
+
"required": [
|
|
68
|
+
"type"
|
|
69
|
+
],
|
|
70
|
+
"properties": {
|
|
71
|
+
"type": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"enum": [
|
|
74
|
+
"ollama",
|
|
75
|
+
"anthropic",
|
|
76
|
+
"openai",
|
|
77
|
+
"huggingface",
|
|
78
|
+
"gemini",
|
|
79
|
+
"mistral",
|
|
80
|
+
"deepseek",
|
|
81
|
+
"xai"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"api_key": {
|
|
85
|
+
"type": "string"
|
|
86
|
+
},
|
|
87
|
+
"api_key_env": {
|
|
88
|
+
"type": "string"
|
|
89
|
+
},
|
|
90
|
+
"url": {
|
|
91
|
+
"type": "string"
|
|
92
|
+
},
|
|
93
|
+
"url_env": {
|
|
94
|
+
"type": "string"
|
|
95
|
+
},
|
|
96
|
+
"model": {
|
|
97
|
+
"type": "string"
|
|
98
|
+
},
|
|
99
|
+
"model_env": {
|
|
100
|
+
"type": "string"
|
|
101
|
+
},
|
|
102
|
+
"chat_model": {
|
|
103
|
+
"type": "string"
|
|
104
|
+
},
|
|
105
|
+
"chat_model_env": {
|
|
106
|
+
"type": "string"
|
|
107
|
+
},
|
|
108
|
+
"embedding_model": {
|
|
109
|
+
"type": "string"
|
|
110
|
+
},
|
|
111
|
+
"embedding_model_env": {
|
|
112
|
+
"type": "string"
|
|
113
|
+
},
|
|
114
|
+
"embedding_dimensions": {
|
|
115
|
+
"type": "integer"
|
|
116
|
+
},
|
|
117
|
+
"embedding_dimensions_env": {
|
|
118
|
+
"type": "string"
|
|
119
|
+
},
|
|
120
|
+
"timeout": {
|
|
121
|
+
"type": "number"
|
|
122
|
+
},
|
|
123
|
+
"timeout_env": {
|
|
124
|
+
"type": "string"
|
|
125
|
+
},
|
|
126
|
+
"context_configs": {
|
|
127
|
+
"type": "object"
|
|
128
|
+
},
|
|
129
|
+
"context_configs_env": {
|
|
130
|
+
"type": "string"
|
|
131
|
+
},
|
|
132
|
+
"prompt_templates": {
|
|
133
|
+
"type": "object",
|
|
134
|
+
"additionalProperties": false,
|
|
135
|
+
"properties": {
|
|
136
|
+
"system_prompt": {
|
|
137
|
+
"type": "string"
|
|
138
|
+
},
|
|
139
|
+
"no_context_template": {
|
|
140
|
+
"type": "string"
|
|
141
|
+
},
|
|
142
|
+
"with_context_template": {
|
|
143
|
+
"type": "string"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"prompt_templates_env": {
|
|
148
|
+
"type": "string"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
data/sig/prescient.rbs
CHANGED
|
@@ -154,6 +154,82 @@ module Prescient
|
|
|
154
154
|
def validate_configuration!: () -> void
|
|
155
155
|
def validate_response!: (untyped, String) -> void
|
|
156
156
|
end
|
|
157
|
+
|
|
158
|
+
class Gemini < Base
|
|
159
|
+
def self.base_uri: (String) -> untyped
|
|
160
|
+
def self.default_timeout: (Integer) -> untyped
|
|
161
|
+
def self.get: (String, **untyped) -> untyped
|
|
162
|
+
def self.post: (String, **untyped) -> untyped
|
|
163
|
+
|
|
164
|
+
def initialize: (**untyped) -> void
|
|
165
|
+
def generate_embedding: (String, **untyped) -> Array[Float]
|
|
166
|
+
def generate_response: (String, ?Array[untyped], **untyped) -> Hash[Symbol, untyped]
|
|
167
|
+
def health_check: () -> Hash[Symbol, untyped]
|
|
168
|
+
def list_models: () -> Array[Hash[Symbol, untyped]]
|
|
169
|
+
|
|
170
|
+
private
|
|
171
|
+
|
|
172
|
+
def validate_configuration!: () -> void
|
|
173
|
+
def api_headers: () -> Hash[String, String]
|
|
174
|
+
def model_endpoint: (untyped, String) -> String
|
|
175
|
+
def find_model: (Array[untyped], untyped, String) -> bool
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
class Mistral < Base
|
|
179
|
+
def self.base_uri: (String) -> untyped
|
|
180
|
+
def self.default_timeout: (Integer) -> untyped
|
|
181
|
+
def self.get: (String, **untyped) -> untyped
|
|
182
|
+
def self.post: (String, **untyped) -> untyped
|
|
183
|
+
|
|
184
|
+
def initialize: (**untyped) -> void
|
|
185
|
+
def generate_embedding: (String, **untyped) -> Array[Float]
|
|
186
|
+
def generate_response: (String, ?Array[untyped], **untyped) -> Hash[Symbol, untyped]
|
|
187
|
+
def health_check: () -> Hash[Symbol, untyped]
|
|
188
|
+
def list_models: () -> Array[Hash[Symbol, untyped]]
|
|
189
|
+
|
|
190
|
+
private
|
|
191
|
+
|
|
192
|
+
def validate_configuration!: () -> void
|
|
193
|
+
def api_headers: () -> Hash[String, String]
|
|
194
|
+
def model_available?: (Array[untyped], untyped) -> bool
|
|
195
|
+
def normalize_content: (untyped) -> String?
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
class DeepSeek < Base
|
|
199
|
+
def self.base_uri: (String) -> untyped
|
|
200
|
+
def self.default_timeout: (Integer) -> untyped
|
|
201
|
+
def self.get: (String, **untyped) -> untyped
|
|
202
|
+
def self.post: (String, **untyped) -> untyped
|
|
203
|
+
|
|
204
|
+
def initialize: (**untyped) -> void
|
|
205
|
+
def generate_embedding: (String, **untyped) -> untyped
|
|
206
|
+
def generate_response: (String, ?Array[untyped], **untyped) -> Hash[Symbol, untyped]
|
|
207
|
+
def health_check: () -> Hash[Symbol, untyped]
|
|
208
|
+
def list_models: () -> Array[Hash[Symbol, untyped]]
|
|
209
|
+
|
|
210
|
+
private
|
|
211
|
+
|
|
212
|
+
def validate_configuration!: () -> void
|
|
213
|
+
def api_headers: () -> Hash[String, String]
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
class XAI < Base
|
|
217
|
+
def self.base_uri: (String) -> untyped
|
|
218
|
+
def self.default_timeout: (Integer) -> untyped
|
|
219
|
+
def self.get: (String, **untyped) -> untyped
|
|
220
|
+
def self.post: (String, **untyped) -> untyped
|
|
221
|
+
|
|
222
|
+
def initialize: (**untyped) -> void
|
|
223
|
+
def generate_embedding: (String, **untyped) -> untyped
|
|
224
|
+
def generate_response: (String, ?Array[untyped], **untyped) -> Hash[Symbol, untyped]
|
|
225
|
+
def health_check: () -> Hash[Symbol, untyped]
|
|
226
|
+
def list_models: () -> Array[Hash[Symbol, untyped]]
|
|
227
|
+
|
|
228
|
+
private
|
|
229
|
+
|
|
230
|
+
def validate_configuration!: () -> void
|
|
231
|
+
def api_headers: () -> Hash[String, String]
|
|
232
|
+
end
|
|
157
233
|
end
|
|
158
234
|
|
|
159
235
|
module Pgvector
|
|
@@ -222,9 +298,30 @@ module Prescient
|
|
|
222
298
|
def run: () -> Integer
|
|
223
299
|
end
|
|
224
300
|
|
|
301
|
+
class ConfigurationLoader
|
|
302
|
+
CONFIGURATION_VERSION: Integer
|
|
303
|
+
TOP_LEVEL_KEYS: Array[String]
|
|
304
|
+
PROVIDER_TYPES: Hash[String, untyped]
|
|
305
|
+
COMMON_PROVIDER_KEYS: Array[String]
|
|
306
|
+
PROMPT_TEMPLATE_KEYS: Array[String]
|
|
307
|
+
ATTR_KEYS: Array[String]
|
|
308
|
+
|
|
309
|
+
def self.load_file: (String, ?env: untyped) -> Configuration
|
|
310
|
+
def self.load_yaml: (String, ?env: untyped) -> Configuration
|
|
311
|
+
def self.load_hash: (Hash[untyped, untyped], ?env: untyped) -> Configuration
|
|
312
|
+
def self.schema_path: () -> String
|
|
313
|
+
|
|
314
|
+
def initialize: (?untyped) -> void
|
|
315
|
+
def load_file: (String) -> Configuration
|
|
316
|
+
def load_yaml: (String, ?source: String?) -> Configuration
|
|
317
|
+
def load_hash: (untyped, ?source: String?) -> Configuration
|
|
318
|
+
def apply!: (Configuration, untyped, ?source: String?) -> Configuration
|
|
319
|
+
end
|
|
320
|
+
|
|
225
321
|
def self.configure: () { (Configuration) -> void } -> void
|
|
226
322
|
def self.configuration: () -> Configuration
|
|
227
323
|
def self.reset_configuration!: () -> Configuration
|
|
324
|
+
def self.load_configuration: (?String?, ?env: untyped) -> Configuration
|
|
228
325
|
def self.client: (?Symbol, ?enable_fallback: bool, ?provider_options: Hash[Symbol, untyped]) -> Client
|
|
229
326
|
def self.generate_embedding: (String, ?provider: Symbol, ?enable_fallback: bool, **untyped) -> Array[Float]
|
|
230
327
|
def self.generate_response: (String, ?Array[untyped], ?provider: Symbol, ?enable_fallback: bool, **untyped) -> Hash[Symbol, untyped]
|
|
@@ -233,4 +330,12 @@ module Prescient
|
|
|
233
330
|
private
|
|
234
331
|
|
|
235
332
|
def self.configure_default_providers: (Configuration, untyped) -> void
|
|
333
|
+
def self.configure_ollama: (Configuration, untyped) -> void
|
|
334
|
+
def self.configure_openai: (Configuration, untyped) -> void
|
|
335
|
+
def self.configure_anthropic: (Configuration, untyped) -> void
|
|
336
|
+
def self.configure_gemini: (Configuration, untyped) -> void
|
|
337
|
+
def self.configure_mistral: (Configuration, untyped) -> void
|
|
338
|
+
def self.configure_deepseek: (Configuration, untyped) -> void
|
|
339
|
+
def self.configure_xai: (Configuration, untyped) -> void
|
|
340
|
+
def self.configure_huggingface: (Configuration, untyped) -> void
|
|
236
341
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: prescient
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ken C. Demanawa
|
|
@@ -61,13 +61,19 @@ files:
|
|
|
61
61
|
- lib/prescient/base.rb
|
|
62
62
|
- lib/prescient/cli.rb
|
|
63
63
|
- lib/prescient/client.rb
|
|
64
|
+
- lib/prescient/configuration_loader.rb
|
|
64
65
|
- lib/prescient/errors.rb
|
|
65
66
|
- lib/prescient/pgvector.rb
|
|
66
67
|
- lib/prescient/provider/anthropic.rb
|
|
68
|
+
- lib/prescient/provider/deepseek.rb
|
|
69
|
+
- lib/prescient/provider/gemini.rb
|
|
67
70
|
- lib/prescient/provider/huggingface.rb
|
|
71
|
+
- lib/prescient/provider/mistral.rb
|
|
68
72
|
- lib/prescient/provider/ollama.rb
|
|
69
73
|
- lib/prescient/provider/openai.rb
|
|
74
|
+
- lib/prescient/provider/xai.rb
|
|
70
75
|
- lib/prescient/version.rb
|
|
76
|
+
- schema/prescient.configuration.schema.json
|
|
71
77
|
- scripts/setup-ollama-models.sh
|
|
72
78
|
- sig/prescient.rbs
|
|
73
79
|
homepage: https://kanutocd.github.io/prescient
|