vectra-client 0.2.1 → 0.2.2
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/README.md +140 -334
- data/docs/Gemfile +10 -0
- data/docs/_config.yml +20 -0
- data/docs/_layouts/default.html +14 -0
- data/docs/_layouts/home.html +33 -0
- data/docs/_layouts/page.html +20 -0
- data/docs/_site/api/overview/index.html +145 -0
- data/docs/_site/assets/main.css +649 -0
- data/docs/_site/assets/main.css.map +1 -0
- data/docs/_site/assets/minima-social-icons.svg +33 -0
- data/docs/_site/assets/style.css +295 -0
- data/docs/_site/community/contributing/index.html +110 -0
- data/docs/_site/examples/basic-usage/index.html +117 -0
- data/docs/_site/examples/index.html +58 -0
- data/docs/_site/feed.xml +1 -0
- data/docs/_site/guides/getting-started/index.html +106 -0
- data/docs/_site/guides/installation/index.html +82 -0
- data/docs/_site/index.html +92 -0
- data/docs/_site/providers/index.html +119 -0
- data/docs/_site/providers/pgvector/index.html +155 -0
- data/docs/_site/providers/pinecone/index.html +121 -0
- data/docs/_site/providers/qdrant/index.html +124 -0
- data/docs/_site/providers/weaviate/index.html +123 -0
- data/docs/_site/robots.txt +1 -0
- data/docs/_site/sitemap.xml +39 -0
- data/docs/api/overview.md +126 -0
- data/docs/assets/style.css +295 -0
- data/docs/community/contributing.md +89 -0
- data/docs/examples/basic-usage.md +102 -0
- data/docs/examples/index.md +32 -0
- data/docs/guides/getting-started.md +90 -0
- data/docs/guides/installation.md +67 -0
- data/docs/index.md +53 -0
- data/docs/providers/index.md +62 -0
- data/docs/providers/pgvector.md +95 -0
- data/docs/providers/pinecone.md +72 -0
- data/docs/providers/qdrant.md +73 -0
- data/docs/providers/weaviate.md +72 -0
- data/lib/vectra/version.rb +1 -1
- data/netlify.toml +12 -0
- metadata +39 -5
- data/IMPLEMENTATION_GUIDE.md +0 -686
- data/NEW_FEATURES_v0.2.0.md +0 -459
- data/RELEASE_CHECKLIST_v0.2.0.md +0 -383
- data/USAGE_EXAMPLES.md +0 -787
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
/* Main Styles */
|
|
2
|
+
:root {
|
|
3
|
+
--primary-color: #2d3748;
|
|
4
|
+
--accent-color: #4299e1;
|
|
5
|
+
--accent-dark: #2b6cb0;
|
|
6
|
+
--bg-color: #f7fafc;
|
|
7
|
+
--text-color: #2d3748;
|
|
8
|
+
--border-color: #e2e8f0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
* {
|
|
12
|
+
margin: 0;
|
|
13
|
+
padding: 0;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
body {
|
|
18
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
|
|
19
|
+
font-size: 16px;
|
|
20
|
+
line-height: 1.6;
|
|
21
|
+
color: var(--text-color);
|
|
22
|
+
background: white;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Header & Navigation */
|
|
26
|
+
.site-header {
|
|
27
|
+
background: white;
|
|
28
|
+
border-bottom: 1px solid var(--border-color);
|
|
29
|
+
position: sticky;
|
|
30
|
+
top: 0;
|
|
31
|
+
z-index: 100;
|
|
32
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.site-nav {
|
|
36
|
+
max-width: 1200px;
|
|
37
|
+
margin: 0 auto;
|
|
38
|
+
padding: 0 20px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.nav-container {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: space-between;
|
|
45
|
+
padding: 1rem 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.nav-brand {
|
|
49
|
+
font-size: 24px;
|
|
50
|
+
font-weight: 700;
|
|
51
|
+
color: var(--primary-color);
|
|
52
|
+
text-decoration: none;
|
|
53
|
+
letter-spacing: -0.5px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.nav-menu {
|
|
57
|
+
display: flex;
|
|
58
|
+
list-style: none;
|
|
59
|
+
gap: 2rem;
|
|
60
|
+
align-items: center;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.nav-link {
|
|
64
|
+
color: var(--text-color);
|
|
65
|
+
text-decoration: none;
|
|
66
|
+
font-weight: 500;
|
|
67
|
+
transition: color 0.3s ease;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.nav-link:hover {
|
|
71
|
+
color: var(--accent-color);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Main Content */
|
|
75
|
+
.site-main {
|
|
76
|
+
max-width: 900px;
|
|
77
|
+
margin: 0 auto;
|
|
78
|
+
padding: 3rem 20px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.home-main {
|
|
82
|
+
padding: 4rem 20px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
h1 {
|
|
86
|
+
font-size: 2.5rem;
|
|
87
|
+
margin: 2rem 0 1rem;
|
|
88
|
+
color: var(--primary-color);
|
|
89
|
+
line-height: 1.2;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
h2 {
|
|
93
|
+
font-size: 1.8rem;
|
|
94
|
+
margin: 2rem 0 1rem;
|
|
95
|
+
color: var(--primary-color);
|
|
96
|
+
border-bottom: 2px solid var(--accent-color);
|
|
97
|
+
padding-bottom: 0.5rem;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
h3 {
|
|
101
|
+
font-size: 1.3rem;
|
|
102
|
+
margin: 1.5rem 0 0.5rem;
|
|
103
|
+
color: var(--primary-color);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
p {
|
|
107
|
+
margin: 1rem 0;
|
|
108
|
+
line-height: 1.8;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
a {
|
|
112
|
+
color: var(--accent-color);
|
|
113
|
+
text-decoration: none;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
a:hover {
|
|
117
|
+
text-decoration: underline;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Code Blocks */
|
|
121
|
+
code {
|
|
122
|
+
background: var(--bg-color);
|
|
123
|
+
padding: 2px 6px;
|
|
124
|
+
border-radius: 3px;
|
|
125
|
+
font-family: 'Courier New', Courier, monospace;
|
|
126
|
+
font-size: 0.9em;
|
|
127
|
+
color: #d73a49;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
pre {
|
|
131
|
+
background: #282c34;
|
|
132
|
+
color: #abb2bf;
|
|
133
|
+
padding: 1.5rem;
|
|
134
|
+
border-radius: 6px;
|
|
135
|
+
overflow-x: auto;
|
|
136
|
+
margin: 1.5rem 0;
|
|
137
|
+
font-size: 0.9rem;
|
|
138
|
+
line-height: 1.5;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
pre code {
|
|
142
|
+
background: none;
|
|
143
|
+
color: inherit;
|
|
144
|
+
padding: 0;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* Features Grid */
|
|
148
|
+
.features {
|
|
149
|
+
display: grid;
|
|
150
|
+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
151
|
+
gap: 2rem;
|
|
152
|
+
margin: 3rem 0;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.feature-card {
|
|
156
|
+
padding: 2rem;
|
|
157
|
+
background: var(--bg-color);
|
|
158
|
+
border-radius: 6px;
|
|
159
|
+
border-left: 4px solid var(--accent-color);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.feature-card h3 {
|
|
163
|
+
margin-top: 0;
|
|
164
|
+
color: var(--accent-color);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/* Quick Links */
|
|
168
|
+
.quick-links {
|
|
169
|
+
display: grid;
|
|
170
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
171
|
+
gap: 1rem;
|
|
172
|
+
margin: 2rem 0;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.quick-link {
|
|
176
|
+
padding: 1rem;
|
|
177
|
+
background: var(--bg-color);
|
|
178
|
+
border-radius: 4px;
|
|
179
|
+
text-align: center;
|
|
180
|
+
border: 1px solid var(--border-color);
|
|
181
|
+
transition: all 0.3s ease;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.quick-link:hover {
|
|
185
|
+
border-color: var(--accent-color);
|
|
186
|
+
box-shadow: 0 2px 8px rgba(66, 153, 225, 0.1);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.quick-link a {
|
|
190
|
+
display: block;
|
|
191
|
+
font-weight: 600;
|
|
192
|
+
color: var(--accent-color);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* Tables */
|
|
196
|
+
table {
|
|
197
|
+
width: 100%;
|
|
198
|
+
border-collapse: collapse;
|
|
199
|
+
margin: 1.5rem 0;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
thead {
|
|
203
|
+
background: var(--bg-color);
|
|
204
|
+
border-bottom: 2px solid var(--border-color);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
th, td {
|
|
208
|
+
padding: 0.75rem;
|
|
209
|
+
text-align: left;
|
|
210
|
+
border-bottom: 1px solid var(--border-color);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
th {
|
|
214
|
+
font-weight: 600;
|
|
215
|
+
color: var(--primary-color);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/* Lists */
|
|
219
|
+
ul, ol {
|
|
220
|
+
margin: 1rem 0 1rem 2rem;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
li {
|
|
224
|
+
margin: 0.5rem 0;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/* Footer */
|
|
228
|
+
.site-footer {
|
|
229
|
+
background: var(--primary-color);
|
|
230
|
+
color: white;
|
|
231
|
+
padding: 3rem 20px;
|
|
232
|
+
margin-top: 4rem;
|
|
233
|
+
border-top: 1px solid var(--border-color);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.footer-content {
|
|
237
|
+
max-width: 1200px;
|
|
238
|
+
margin: 0 auto;
|
|
239
|
+
display: flex;
|
|
240
|
+
justify-content: space-between;
|
|
241
|
+
align-items: center;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.footer-links {
|
|
245
|
+
list-style: none;
|
|
246
|
+
display: flex;
|
|
247
|
+
gap: 2rem;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.footer-links a {
|
|
251
|
+
color: #cbd5e0;
|
|
252
|
+
text-decoration: none;
|
|
253
|
+
transition: color 0.3s ease;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.footer-links a:hover {
|
|
257
|
+
color: white;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/* Responsive */
|
|
261
|
+
@media (max-width: 768px) {
|
|
262
|
+
.nav-container {
|
|
263
|
+
flex-direction: column;
|
|
264
|
+
gap: 1rem;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.nav-menu {
|
|
268
|
+
flex-direction: column;
|
|
269
|
+
gap: 0.5rem;
|
|
270
|
+
text-align: center;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
h1 {
|
|
274
|
+
font-size: 2rem;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
h2 {
|
|
278
|
+
font-size: 1.5rem;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.site-main {
|
|
282
|
+
padding: 2rem 15px;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.footer-content {
|
|
286
|
+
flex-direction: column;
|
|
287
|
+
gap: 2rem;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.footer-links {
|
|
291
|
+
flex-direction: column;
|
|
292
|
+
gap: 1rem;
|
|
293
|
+
text-align: center;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
title: Contributing
|
|
4
|
+
permalink: /community/contributing/
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Contributing to Vectra
|
|
8
|
+
|
|
9
|
+
We welcome contributions! Here's how to get started.
|
|
10
|
+
|
|
11
|
+
## Development Setup
|
|
12
|
+
|
|
13
|
+
1. Clone the repository:
|
|
14
|
+
```bash
|
|
15
|
+
git clone https://github.com/stokry/vectra.git
|
|
16
|
+
cd vectra
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
2. Install dependencies:
|
|
20
|
+
```bash
|
|
21
|
+
bundle install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
3. Run tests:
|
|
25
|
+
```bash
|
|
26
|
+
bundle exec rspec
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Making Changes
|
|
30
|
+
|
|
31
|
+
1. Create a feature branch:
|
|
32
|
+
```bash
|
|
33
|
+
git checkout -b feature/your-feature-name
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
2. Make your changes and write tests
|
|
37
|
+
3. Run linter:
|
|
38
|
+
```bash
|
|
39
|
+
bundle exec rubocop
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
4. Commit and push:
|
|
43
|
+
```bash
|
|
44
|
+
git add .
|
|
45
|
+
git commit -m "Description of changes"
|
|
46
|
+
git push origin feature/your-feature-name
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
5. Create a Pull Request
|
|
50
|
+
|
|
51
|
+
## Code Style
|
|
52
|
+
|
|
53
|
+
We use RuboCop for code style. Ensure your code passes:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
bundle exec rubocop
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Testing
|
|
60
|
+
|
|
61
|
+
All changes require tests:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Run all tests
|
|
65
|
+
bundle exec rspec
|
|
66
|
+
|
|
67
|
+
# Run specific suite
|
|
68
|
+
bundle exec rspec spec/vectra
|
|
69
|
+
|
|
70
|
+
# Run with coverage
|
|
71
|
+
bundle exec rspec --cov
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Documentation
|
|
75
|
+
|
|
76
|
+
Please update documentation for any changes:
|
|
77
|
+
|
|
78
|
+
- Update README.md for user-facing changes
|
|
79
|
+
- Update CHANGELOG.md
|
|
80
|
+
- Add examples if needed
|
|
81
|
+
|
|
82
|
+
## Questions?
|
|
83
|
+
|
|
84
|
+
Feel free to:
|
|
85
|
+
- Open an issue on GitHub
|
|
86
|
+
- Check existing issues and discussions
|
|
87
|
+
- Read the [Implementation Guide](https://github.com/stokry/vectra/blob/main/IMPLEMENTATION_GUIDE.md)
|
|
88
|
+
|
|
89
|
+
Thank you for contributing! 🙌
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
title: Basic Usage
|
|
4
|
+
permalink: /examples/basic-usage/
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Basic Usage Examples
|
|
8
|
+
|
|
9
|
+
## Simple Search
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
require 'vectra'
|
|
13
|
+
|
|
14
|
+
client = Vectra::Client.new(
|
|
15
|
+
provider: :pinecone,
|
|
16
|
+
api_key: ENV['PINECONE_API_KEY'],
|
|
17
|
+
environment: 'us-west-4'
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Search for similar vectors
|
|
21
|
+
results = client.query(
|
|
22
|
+
vector: [0.1, 0.2, 0.3],
|
|
23
|
+
top_k: 5
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
puts results.matches.count
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Batch Operations
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
# Upsert multiple vectors at once
|
|
33
|
+
vectors = [
|
|
34
|
+
{ id: '1', values: [0.1, 0.2, 0.3], metadata: { title: 'Doc 1' } },
|
|
35
|
+
{ id: '2', values: [0.2, 0.3, 0.4], metadata: { title: 'Doc 2' } },
|
|
36
|
+
{ id: '3', values: [0.3, 0.4, 0.5], metadata: { title: 'Doc 3' } }
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
client.upsert(vectors: vectors)
|
|
40
|
+
|
|
41
|
+
# Delete multiple vectors
|
|
42
|
+
client.delete(ids: ['1', '2', '3'])
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Rails Integration
|
|
46
|
+
|
|
47
|
+
```ruby
|
|
48
|
+
# config/initializers/vectra.rb
|
|
49
|
+
Vectra.configure do |config|
|
|
50
|
+
config.provider = :pgvector
|
|
51
|
+
config.database = Rails.configuration.database_configuration[Rails.env]['database']
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# app/models/document.rb
|
|
55
|
+
class Document < ApplicationRecord
|
|
56
|
+
include Vectra::ActiveRecord
|
|
57
|
+
|
|
58
|
+
vector_search :embedding
|
|
59
|
+
|
|
60
|
+
def generate_embedding
|
|
61
|
+
# Generate embedding using OpenAI, Cohere, etc.
|
|
62
|
+
embedding_vector = generate_vector_from_text(content)
|
|
63
|
+
self.embedding = embedding_vector
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Usage
|
|
68
|
+
doc = Document.find(1)
|
|
69
|
+
similar_docs = doc.vector_search(limit: 10)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## With Metadata Filtering
|
|
73
|
+
|
|
74
|
+
```ruby
|
|
75
|
+
results = client.query(
|
|
76
|
+
vector: [0.1, 0.2, 0.3],
|
|
77
|
+
top_k: 10,
|
|
78
|
+
include_metadata: true
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
results.matches.each do |match|
|
|
82
|
+
puts "ID: #{match['id']}"
|
|
83
|
+
puts "Score: #{match['score']}"
|
|
84
|
+
puts "Metadata: #{match['metadata']}"
|
|
85
|
+
end
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Error Handling
|
|
89
|
+
|
|
90
|
+
```ruby
|
|
91
|
+
begin
|
|
92
|
+
client.query(vector: [0.1, 0.2, 0.3])
|
|
93
|
+
rescue Vectra::ConnectionError => e
|
|
94
|
+
puts "Connection failed: #{e.message}"
|
|
95
|
+
rescue Vectra::ValidationError => e
|
|
96
|
+
puts "Invalid input: #{e.message}"
|
|
97
|
+
rescue => e
|
|
98
|
+
puts "Unexpected error: #{e.message}"
|
|
99
|
+
end
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
See [Getting Started]({{ site.baseurl }}/guides/getting-started) for more examples.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
title: Examples
|
|
4
|
+
permalink: /examples/
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Code Examples
|
|
8
|
+
|
|
9
|
+
Explore practical examples to get started with Vectra:
|
|
10
|
+
|
|
11
|
+
## Basic Examples
|
|
12
|
+
|
|
13
|
+
- [Basic Usage]({{ site.baseurl }}/examples/basic-usage/) - Simple searches and operations
|
|
14
|
+
- [Batch Operations]({{ site.baseurl }}/examples/basic-usage/#batch-operations) - Working with multiple vectors
|
|
15
|
+
- [Error Handling]({{ site.baseurl }}/examples/basic-usage/#error-handling) - Proper error handling patterns
|
|
16
|
+
|
|
17
|
+
## Provider-Specific Examples
|
|
18
|
+
|
|
19
|
+
- [Pinecone Example]({{ site.baseurl }}/providers/pinecone/#example)
|
|
20
|
+
- [Qdrant Example]({{ site.baseurl }}/providers/qdrant/#example)
|
|
21
|
+
- [Weaviate Example]({{ site.baseurl }}/providers/weaviate/#example)
|
|
22
|
+
- [pgvector Example]({{ site.baseurl }}/providers/pgvector/#example)
|
|
23
|
+
|
|
24
|
+
## Rails Integration
|
|
25
|
+
|
|
26
|
+
Check out the [pgvector guide]({{ site.baseurl }}/providers/pgvector/) for Rails ActiveRecord integration examples.
|
|
27
|
+
|
|
28
|
+
## Need More Examples?
|
|
29
|
+
|
|
30
|
+
- Check the [GitHub Repository](https://github.com/stokry/vectra/tree/main/examples)
|
|
31
|
+
- See the [Implementation Guide](https://github.com/stokry/vectra/blob/main/IMPLEMENTATION_GUIDE.md)
|
|
32
|
+
- Review [Integration Tests](https://github.com/stokry/vectra/tree/main/spec/integration)
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
title: Getting Started
|
|
4
|
+
permalink: /guides/getting-started/
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Getting Started with Vectra
|
|
8
|
+
|
|
9
|
+
## Initialize a Client
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
require 'vectra'
|
|
13
|
+
|
|
14
|
+
# Initialize with Pinecone
|
|
15
|
+
client = Vectra::Client.new(
|
|
16
|
+
provider: :pinecone,
|
|
17
|
+
api_key: ENV['PINECONE_API_KEY'],
|
|
18
|
+
environment: 'us-west-4'
|
|
19
|
+
)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Basic Operations
|
|
23
|
+
|
|
24
|
+
### Upsert Vectors
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
client.upsert(
|
|
28
|
+
vectors: [
|
|
29
|
+
{
|
|
30
|
+
id: 'vec-1',
|
|
31
|
+
values: [0.1, 0.2, 0.3],
|
|
32
|
+
metadata: { title: 'Document 1' }
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'vec-2',
|
|
36
|
+
values: [0.2, 0.3, 0.4],
|
|
37
|
+
metadata: { title: 'Document 2' }
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Query (Search)
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
results = client.query(
|
|
47
|
+
vector: [0.1, 0.2, 0.3],
|
|
48
|
+
top_k: 5,
|
|
49
|
+
include_metadata: true
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
results.matches.each do |match|
|
|
53
|
+
puts "ID: #{match['id']}, Score: #{match['score']}"
|
|
54
|
+
end
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Delete Vectors
|
|
58
|
+
|
|
59
|
+
```ruby
|
|
60
|
+
client.delete(ids: ['vec-1', 'vec-2'])
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Get Vector Stats
|
|
64
|
+
|
|
65
|
+
```ruby
|
|
66
|
+
stats = client.stats
|
|
67
|
+
puts "Index dimension: #{stats['dimension']}"
|
|
68
|
+
puts "Vector count: #{stats['vector_count']}"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Configuration
|
|
72
|
+
|
|
73
|
+
Create a configuration file (Rails: `config/initializers/vectra.rb`):
|
|
74
|
+
|
|
75
|
+
```ruby
|
|
76
|
+
Vectra.configure do |config|
|
|
77
|
+
config.provider = :pinecone
|
|
78
|
+
config.api_key = ENV['PINECONE_API_KEY']
|
|
79
|
+
config.environment = 'us-west-4'
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Later in your code:
|
|
83
|
+
client = Vectra::Client.new
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Next Steps
|
|
87
|
+
|
|
88
|
+
- [API Reference]({{ site.baseurl }}/api/overview)
|
|
89
|
+
- [Provider Guides]({{ site.baseurl }}/providers)
|
|
90
|
+
- [Examples]({{ site.baseurl }}/examples/basic-usage)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
title: Installation
|
|
4
|
+
permalink: /guides/installation/
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Installation Guide
|
|
8
|
+
|
|
9
|
+
## Requirements
|
|
10
|
+
|
|
11
|
+
- Ruby 3.2.0 or higher
|
|
12
|
+
- Bundler
|
|
13
|
+
|
|
14
|
+
## Install via Bundler
|
|
15
|
+
|
|
16
|
+
Add Vectra to your Gemfile:
|
|
17
|
+
|
|
18
|
+
```ruby
|
|
19
|
+
gem 'vectra-client'
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Then run:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
bundle install
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Install Standalone
|
|
29
|
+
|
|
30
|
+
Alternatively, install via RubyGems:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
gem install vectra-client
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Rails Integration
|
|
37
|
+
|
|
38
|
+
For Rails applications, run the install generator:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
rails generate vectra:install
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
This will create an initializer file at `config/initializers/vectra.rb`.
|
|
45
|
+
|
|
46
|
+
## Provider-Specific Setup
|
|
47
|
+
|
|
48
|
+
Each vector database provider may require additional dependencies:
|
|
49
|
+
|
|
50
|
+
### PostgreSQL with pgvector
|
|
51
|
+
```ruby
|
|
52
|
+
gem 'pg', '~> 1.5'
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Instrumentation
|
|
56
|
+
|
|
57
|
+
#### Datadog
|
|
58
|
+
```ruby
|
|
59
|
+
gem 'dogstatsd-ruby'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### New Relic
|
|
63
|
+
```ruby
|
|
64
|
+
gem 'newrelic_rpm'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
See [Provider Guides]({{ site.baseurl }}/providers) for detailed setup instructions.
|
data/docs/index.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: home
|
|
3
|
+
title: Vectra
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Welcome to Vectra Documentation
|
|
7
|
+
|
|
8
|
+
**Vectra** is a unified Ruby client for vector databases that allows you to write once and switch providers easily.
|
|
9
|
+
|
|
10
|
+
## Supported Vector Databases
|
|
11
|
+
|
|
12
|
+
- **Pinecone** - Managed vector database in the cloud
|
|
13
|
+
- **Qdrant** - Open-source vector database
|
|
14
|
+
- **Weaviate** - Open-source vector search engine
|
|
15
|
+
- **PostgreSQL with pgvector** - SQL database with vector support
|
|
16
|
+
|
|
17
|
+
## Quick Links
|
|
18
|
+
|
|
19
|
+
- [Installation Guide]({{ site.baseurl }}/guides/installation)
|
|
20
|
+
- [Getting Started]({{ site.baseurl }}/guides/getting-started)
|
|
21
|
+
- [API Reference]({{ site.baseurl }}/api/overview)
|
|
22
|
+
- [Examples]({{ site.baseurl }}/examples/basic-usage)
|
|
23
|
+
- [Contributing]({{ site.baseurl }}/community/contributing)
|
|
24
|
+
|
|
25
|
+
## Key Features
|
|
26
|
+
|
|
27
|
+
- 🔄 **Provider Agnostic** - Switch between different vector database providers with minimal code changes
|
|
28
|
+
- 🚀 **Easy Integration** - Works seamlessly with Rails and other Ruby frameworks
|
|
29
|
+
- 📊 **Vector Operations** - Create, search, update, and delete vectors
|
|
30
|
+
- 🔌 **Multiple Providers** - Support for leading vector database platforms
|
|
31
|
+
- 📈 **Instrumentation** - Built-in support for Datadog and New Relic monitoring
|
|
32
|
+
- 🗄️ **ActiveRecord Integration** - Native support for Rails models
|
|
33
|
+
|
|
34
|
+
## Get Started
|
|
35
|
+
|
|
36
|
+
```ruby
|
|
37
|
+
require 'vectra'
|
|
38
|
+
|
|
39
|
+
# Initialize client
|
|
40
|
+
client = Vectra::Client.new(provider: :pinecone, api_key: 'your-key')
|
|
41
|
+
|
|
42
|
+
# Upsert vectors
|
|
43
|
+
client.upsert(
|
|
44
|
+
vectors: [
|
|
45
|
+
{ id: '1', values: [0.1, 0.2, 0.3], metadata: { text: 'example' } }
|
|
46
|
+
]
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
# Search
|
|
50
|
+
results = client.query(vector: [0.1, 0.2, 0.3], top_k: 5)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
For more detailed examples, see [Basic Usage]({{ site.baseurl }}/examples/basic-usage).
|