vectra-client 0.1.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 +7 -0
- data/.codecov.yml +31 -0
- data/.rspec +4 -0
- data/.rubocop.yml +183 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +88 -0
- data/CODE_OF_CONDUCT.md +127 -0
- data/CONTRIBUTING.md +239 -0
- data/LICENSE +21 -0
- data/README.md +456 -0
- data/Rakefile +34 -0
- data/SECURITY.md +196 -0
- data/lib/vectra/client.rb +304 -0
- data/lib/vectra/configuration.rb +169 -0
- data/lib/vectra/errors.rb +73 -0
- data/lib/vectra/providers/base.rb +265 -0
- data/lib/vectra/providers/pgvector/connection.rb +75 -0
- data/lib/vectra/providers/pgvector/index_management.rb +122 -0
- data/lib/vectra/providers/pgvector/sql_helpers.rb +115 -0
- data/lib/vectra/providers/pgvector.rb +297 -0
- data/lib/vectra/providers/pinecone.rb +308 -0
- data/lib/vectra/providers/qdrant.rb +48 -0
- data/lib/vectra/providers/weaviate.rb +48 -0
- data/lib/vectra/query_result.rb +257 -0
- data/lib/vectra/vector.rb +155 -0
- data/lib/vectra/version.rb +5 -0
- data/lib/vectra.rb +133 -0
- metadata +226 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 20a46681e8f00bb511f72b3ce95d354ff9384bf1344c459f38f125278f6b0e4f
|
|
4
|
+
data.tar.gz: 789c701852f7ac470407c6bba2a6fcc1c4515f94803591e5054885ed7f60af1e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 9eb0dcbb37f18fbd0ba6dd75c4707c9e4f78f7eebb7ecc20efadc58a6a14115d73f2edbd1ab89c7fe164442066c40a1c34cff52e330861c76057d4bbf3c81e5e
|
|
7
|
+
data.tar.gz: 9cd0ffabc9a4da469b713ceda5faa3255648d1e367841fad57b23f4efedda64cb2496248a52889d976e15c855f4bc2e6c35192f6ff0685f3a64591da3340612c
|
data/.codecov.yml
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
coverage:
|
|
2
|
+
precision: 2
|
|
3
|
+
round: down
|
|
4
|
+
range: "70...100"
|
|
5
|
+
|
|
6
|
+
status:
|
|
7
|
+
project:
|
|
8
|
+
default:
|
|
9
|
+
target: 90%
|
|
10
|
+
threshold: 1%
|
|
11
|
+
if_ci_failed: error
|
|
12
|
+
|
|
13
|
+
patch:
|
|
14
|
+
default:
|
|
15
|
+
target: 80%
|
|
16
|
+
threshold: 5%
|
|
17
|
+
if_ci_failed: error
|
|
18
|
+
|
|
19
|
+
ignore:
|
|
20
|
+
- "spec/**/*"
|
|
21
|
+
- "lib/vectra/version.rb"
|
|
22
|
+
|
|
23
|
+
comment:
|
|
24
|
+
layout: "header, diff, flags, files"
|
|
25
|
+
behavior: default
|
|
26
|
+
require_changes: false
|
|
27
|
+
require_base: false
|
|
28
|
+
require_head: true
|
|
29
|
+
|
|
30
|
+
github_checks:
|
|
31
|
+
annotations: true
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
require:
|
|
2
|
+
- rubocop-rspec
|
|
3
|
+
|
|
4
|
+
AllCops:
|
|
5
|
+
TargetRubyVersion: 3.2
|
|
6
|
+
NewCops: enable
|
|
7
|
+
SuggestExtensions: false
|
|
8
|
+
Exclude:
|
|
9
|
+
- 'vendor/**/*'
|
|
10
|
+
- 'tmp/**/*'
|
|
11
|
+
- 'bin/**/*'
|
|
12
|
+
- 'node_modules/**/*'
|
|
13
|
+
|
|
14
|
+
# Layout
|
|
15
|
+
Layout/LineLength:
|
|
16
|
+
Max: 120
|
|
17
|
+
AllowedPatterns:
|
|
18
|
+
- '\A\s*#' # Allow long comment lines
|
|
19
|
+
|
|
20
|
+
Layout/MultilineMethodCallIndentation:
|
|
21
|
+
EnforcedStyle: indented
|
|
22
|
+
|
|
23
|
+
# Metrics
|
|
24
|
+
Metrics/BlockLength:
|
|
25
|
+
Exclude:
|
|
26
|
+
- 'spec/**/*'
|
|
27
|
+
- 'vectra.gemspec'
|
|
28
|
+
- 'Rakefile'
|
|
29
|
+
|
|
30
|
+
Metrics/MethodLength:
|
|
31
|
+
Max: 25
|
|
32
|
+
Exclude:
|
|
33
|
+
- 'spec/**/*'
|
|
34
|
+
|
|
35
|
+
Metrics/AbcSize:
|
|
36
|
+
Max: 25
|
|
37
|
+
Exclude:
|
|
38
|
+
- 'spec/**/*'
|
|
39
|
+
|
|
40
|
+
Metrics/ClassLength:
|
|
41
|
+
Max: 250
|
|
42
|
+
Exclude:
|
|
43
|
+
- 'spec/**/*'
|
|
44
|
+
|
|
45
|
+
Metrics/ModuleLength:
|
|
46
|
+
Exclude:
|
|
47
|
+
- 'spec/**/*'
|
|
48
|
+
|
|
49
|
+
Metrics/CyclomaticComplexity:
|
|
50
|
+
Max: 10
|
|
51
|
+
|
|
52
|
+
Metrics/PerceivedComplexity:
|
|
53
|
+
Max: 10
|
|
54
|
+
|
|
55
|
+
Metrics/ParameterLists:
|
|
56
|
+
Max: 7
|
|
57
|
+
CountKeywordArgs: false
|
|
58
|
+
|
|
59
|
+
# Style
|
|
60
|
+
Style/Documentation:
|
|
61
|
+
Enabled: false # We use YARD documentation
|
|
62
|
+
|
|
63
|
+
Style/StringLiterals:
|
|
64
|
+
EnforcedStyle: double_quotes
|
|
65
|
+
|
|
66
|
+
Style/StringLiteralsInInterpolation:
|
|
67
|
+
Enabled: false # Allow both single and double quotes
|
|
68
|
+
|
|
69
|
+
Style/ArgumentsForwarding:
|
|
70
|
+
Enabled: false # Ruby 3.2+ feature, but not required
|
|
71
|
+
|
|
72
|
+
Style/IfUnlessModifier:
|
|
73
|
+
Enabled: false # Allow multi-line if/unless for clarity
|
|
74
|
+
|
|
75
|
+
Style/FrozenStringLiteralComment:
|
|
76
|
+
Enabled: true
|
|
77
|
+
EnforcedStyle: always
|
|
78
|
+
|
|
79
|
+
Style/SymbolArray:
|
|
80
|
+
EnforcedStyle: brackets
|
|
81
|
+
|
|
82
|
+
Style/WordArray:
|
|
83
|
+
EnforcedStyle: brackets
|
|
84
|
+
|
|
85
|
+
Style/TrailingCommaInArrayLiteral:
|
|
86
|
+
EnforcedStyleForMultiline: no_comma
|
|
87
|
+
|
|
88
|
+
Style/TrailingCommaInHashLiteral:
|
|
89
|
+
EnforcedStyleForMultiline: no_comma
|
|
90
|
+
|
|
91
|
+
Style/TrailingCommaInArguments:
|
|
92
|
+
EnforcedStyleForMultiline: no_comma
|
|
93
|
+
|
|
94
|
+
# Naming
|
|
95
|
+
Naming/MethodParameterName:
|
|
96
|
+
AllowedNames:
|
|
97
|
+
- id
|
|
98
|
+
- to
|
|
99
|
+
- db
|
|
100
|
+
- io
|
|
101
|
+
|
|
102
|
+
# Lint
|
|
103
|
+
Lint/MissingSuper:
|
|
104
|
+
Enabled: false # Allow classes without super calls
|
|
105
|
+
|
|
106
|
+
# RSpec specific
|
|
107
|
+
RSpec/ExampleLength:
|
|
108
|
+
Max: 15
|
|
109
|
+
|
|
110
|
+
RSpec/MultipleExpectations:
|
|
111
|
+
Max: 5
|
|
112
|
+
|
|
113
|
+
RSpec/MultipleMemoizedHelpers:
|
|
114
|
+
Max: 10
|
|
115
|
+
|
|
116
|
+
RSpec/NestedGroups:
|
|
117
|
+
Max: 5
|
|
118
|
+
|
|
119
|
+
RSpec/DescribeClass:
|
|
120
|
+
Enabled: true
|
|
121
|
+
Exclude:
|
|
122
|
+
- 'spec/integration/**/*'
|
|
123
|
+
|
|
124
|
+
RSpec/ContextWording:
|
|
125
|
+
Enabled: false
|
|
126
|
+
|
|
127
|
+
RSpec/MessageSpies:
|
|
128
|
+
Enabled: false # Allow both have_received and receive
|
|
129
|
+
|
|
130
|
+
RSpec/IdenticalEqualityAssertion:
|
|
131
|
+
Enabled: false
|
|
132
|
+
|
|
133
|
+
RSpec/VerifiedDoubles:
|
|
134
|
+
Enabled: false
|
|
135
|
+
|
|
136
|
+
RSpec/MultipleDescribes:
|
|
137
|
+
Enabled: false
|
|
138
|
+
|
|
139
|
+
RSpec/DescribeClass:
|
|
140
|
+
Enabled: false # Allow string descriptions
|
|
141
|
+
|
|
142
|
+
# Disable problematic Capybara cop
|
|
143
|
+
Capybara/RSpec/PredicateMatcher:
|
|
144
|
+
Enabled: false
|
|
145
|
+
|
|
146
|
+
# Gemspec
|
|
147
|
+
Gemspec/DevelopmentDependencies:
|
|
148
|
+
Enabled: false
|
|
149
|
+
|
|
150
|
+
# Naming
|
|
151
|
+
Naming/MemoizedInstanceVariableName:
|
|
152
|
+
Enabled: false # Allow descriptive names
|
|
153
|
+
|
|
154
|
+
# Layout
|
|
155
|
+
Layout/LineLength:
|
|
156
|
+
Max: 185
|
|
157
|
+
Exclude:
|
|
158
|
+
- 'vectra.gemspec'
|
|
159
|
+
|
|
160
|
+
# Additional disables for auto-correctable minor issues
|
|
161
|
+
Style/SymbolArray:
|
|
162
|
+
Enabled: false
|
|
163
|
+
|
|
164
|
+
Style/WordArray:
|
|
165
|
+
Enabled: false
|
|
166
|
+
|
|
167
|
+
Style/MapIntoArray:
|
|
168
|
+
Enabled: false
|
|
169
|
+
|
|
170
|
+
Lint/RedundantDirGlobSort:
|
|
171
|
+
Enabled: false
|
|
172
|
+
|
|
173
|
+
RSpec/LeadingSubject:
|
|
174
|
+
Enabled: false
|
|
175
|
+
|
|
176
|
+
RSpec/ExampleLength:
|
|
177
|
+
Max: 20
|
|
178
|
+
|
|
179
|
+
RSpec/MultipleExpectations:
|
|
180
|
+
Max: 10
|
|
181
|
+
|
|
182
|
+
Gemspec/OrderedDependencies:
|
|
183
|
+
Enabled: false
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.2.0
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.1] - 2025-01-07
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **pgvector provider** - Full PostgreSQL with pgvector extension support:
|
|
15
|
+
- Vector upsert, query, fetch, update, delete operations
|
|
16
|
+
- Index (table) management with automatic schema creation
|
|
17
|
+
- Multiple similarity metrics: cosine, euclidean, inner product
|
|
18
|
+
- Namespace support via namespace column
|
|
19
|
+
- Metadata filtering with JSONB
|
|
20
|
+
- IVFFlat index creation for fast similarity search
|
|
21
|
+
- `Vectra.pgvector` convenience method for creating pgvector clients
|
|
22
|
+
- Comprehensive unit and integration tests for pgvector provider
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- Updated gemspec description to include pgvector
|
|
27
|
+
- Added `pg` gem as development dependency
|
|
28
|
+
|
|
29
|
+
### Provider Support
|
|
30
|
+
|
|
31
|
+
- ✅ Pinecone - Fully implemented
|
|
32
|
+
- ✅ pgvector (PostgreSQL) - Fully implemented
|
|
33
|
+
- 🚧 Qdrant - Stub implementation (planned for v0.2.0)
|
|
34
|
+
- 🚧 Weaviate - Stub implementation (planned for v0.3.0)
|
|
35
|
+
|
|
36
|
+
## [0.1.0] - 2024-XX-XX
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- Initial release
|
|
41
|
+
- Pinecone provider with full support for:
|
|
42
|
+
- Vector upsert, query, fetch, update, delete operations
|
|
43
|
+
- Index management (list, describe, create, delete)
|
|
44
|
+
- Namespace support
|
|
45
|
+
- Metadata filtering
|
|
46
|
+
- Configuration system with global and per-client options
|
|
47
|
+
- Automatic retry logic with exponential backoff
|
|
48
|
+
- Comprehensive error handling with specific error classes:
|
|
49
|
+
- `AuthenticationError` - API key issues
|
|
50
|
+
- `RateLimitError` - Rate limiting with retry-after
|
|
51
|
+
- `NotFoundError` - Resource not found
|
|
52
|
+
- `ValidationError` - Invalid request parameters
|
|
53
|
+
- `ServerError` - Server-side errors
|
|
54
|
+
- `ConnectionError` - Network issues
|
|
55
|
+
- `TimeoutError` - Request timeouts
|
|
56
|
+
- `Vector` class for vector representation with:
|
|
57
|
+
- Cosine similarity calculation
|
|
58
|
+
- Euclidean distance calculation
|
|
59
|
+
- Metadata support
|
|
60
|
+
- `QueryResult` class with Enumerable support:
|
|
61
|
+
- Score filtering
|
|
62
|
+
- Easy iteration
|
|
63
|
+
- Result statistics
|
|
64
|
+
- Full RSpec test suite
|
|
65
|
+
- YARD documentation
|
|
66
|
+
|
|
67
|
+
## Planned
|
|
68
|
+
|
|
69
|
+
### [0.2.0]
|
|
70
|
+
|
|
71
|
+
- Qdrant provider implementation
|
|
72
|
+
- Enhanced error messages
|
|
73
|
+
- Connection pooling
|
|
74
|
+
- Improved retry strategies
|
|
75
|
+
|
|
76
|
+
### [0.3.0]
|
|
77
|
+
|
|
78
|
+
- Weaviate provider implementation
|
|
79
|
+
- Batch operation improvements
|
|
80
|
+
- Performance optimizations
|
|
81
|
+
- Async operations support
|
|
82
|
+
|
|
83
|
+
### [1.0.0]
|
|
84
|
+
|
|
85
|
+
- Rails integration
|
|
86
|
+
- ActiveRecord-like DSL for vector models
|
|
87
|
+
- Background job integration (Sidekiq, GoodJob)
|
|
88
|
+
- Production-ready with full documentation
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Project maintainers are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Project maintainers have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the project team responsible for enforcement at mijo@mijokristo.com.
|
|
63
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
64
|
+
|
|
65
|
+
All project maintainers are obligated to respect the privacy and security of the
|
|
66
|
+
reporter of any incident.
|
|
67
|
+
|
|
68
|
+
## Enforcement Guidelines
|
|
69
|
+
|
|
70
|
+
Project maintainers will follow these Community Impact Guidelines in determining
|
|
71
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
72
|
+
|
|
73
|
+
### 1. Correction
|
|
74
|
+
|
|
75
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
76
|
+
unprofessional or unwelcome in the community.
|
|
77
|
+
|
|
78
|
+
**Consequence**: A private, written warning from project maintainers, providing
|
|
79
|
+
clarity around the nature of the violation and an explanation of why the
|
|
80
|
+
behavior was inappropriate. A public apology may be requested.
|
|
81
|
+
|
|
82
|
+
### 2. Warning
|
|
83
|
+
|
|
84
|
+
**Community Impact**: A violation through a single incident or series
|
|
85
|
+
of actions.
|
|
86
|
+
|
|
87
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
88
|
+
interaction with the people involved, including unsolicited interaction with
|
|
89
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
90
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
91
|
+
like social media. Violating these terms may lead to a temporary or
|
|
92
|
+
permanent ban.
|
|
93
|
+
|
|
94
|
+
### 3. Temporary Ban
|
|
95
|
+
|
|
96
|
+
**Community Impact**: A serious violation of community standards, including
|
|
97
|
+
sustained inappropriate behavior.
|
|
98
|
+
|
|
99
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
100
|
+
communication with the community for a specified period of time. No public or
|
|
101
|
+
private interaction with the people involved, including unsolicited interaction
|
|
102
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
103
|
+
Violating these terms may lead to a permanent ban.
|
|
104
|
+
|
|
105
|
+
### 4. Permanent Ban
|
|
106
|
+
|
|
107
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
108
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
109
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
110
|
+
|
|
111
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
112
|
+
the community.
|
|
113
|
+
|
|
114
|
+
## Attribution
|
|
115
|
+
|
|
116
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
117
|
+
version 2.0, available at
|
|
118
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
119
|
+
|
|
120
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
121
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
122
|
+
|
|
123
|
+
[homepage]: https://www.contributor-covenant.org
|
|
124
|
+
|
|
125
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
126
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
|
127
|
+
https://www.contributor-covenant.org/translations.
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Contributing to Vectra
|
|
2
|
+
|
|
3
|
+
Thank you for considering contributing to Vectra! This document outlines the process for contributing to this project.
|
|
4
|
+
|
|
5
|
+
## Code of Conduct
|
|
6
|
+
|
|
7
|
+
By participating in this project, you agree to maintain a respectful and inclusive environment for everyone.
|
|
8
|
+
|
|
9
|
+
## How Can I Contribute?
|
|
10
|
+
|
|
11
|
+
### Reporting Bugs
|
|
12
|
+
|
|
13
|
+
Before creating bug reports, please check existing issues to avoid duplicates. When creating a bug report, include:
|
|
14
|
+
|
|
15
|
+
- **Clear title and description**
|
|
16
|
+
- **Steps to reproduce** the problem
|
|
17
|
+
- **Expected behavior** vs **actual behavior**
|
|
18
|
+
- **Ruby version** and **Vectra version**
|
|
19
|
+
- **Provider** you're using (Pinecone, Qdrant, Weaviate)
|
|
20
|
+
- **Code samples** if applicable
|
|
21
|
+
|
|
22
|
+
### Suggesting Enhancements
|
|
23
|
+
|
|
24
|
+
Enhancement suggestions are welcome! Please include:
|
|
25
|
+
|
|
26
|
+
- **Clear use case** for the enhancement
|
|
27
|
+
- **Expected behavior** of the new feature
|
|
28
|
+
- **Examples** of how it would be used
|
|
29
|
+
- **Benefits** to users
|
|
30
|
+
|
|
31
|
+
### Pull Requests
|
|
32
|
+
|
|
33
|
+
1. **Fork the repository** and create your branch from `main`:
|
|
34
|
+
```bash
|
|
35
|
+
git checkout -b feature/my-new-feature
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
2. **Set up your development environment**:
|
|
39
|
+
```bash
|
|
40
|
+
bundle install
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
3. **Make your changes**:
|
|
44
|
+
- Follow the existing code style
|
|
45
|
+
- Add tests for any new functionality
|
|
46
|
+
- Update documentation as needed
|
|
47
|
+
- Ensure all tests pass
|
|
48
|
+
|
|
49
|
+
4. **Run the test suite**:
|
|
50
|
+
```bash
|
|
51
|
+
# Run all tests
|
|
52
|
+
bundle exec rspec
|
|
53
|
+
|
|
54
|
+
# Run specific test file
|
|
55
|
+
bundle exec rspec spec/vectra/client_spec.rb
|
|
56
|
+
|
|
57
|
+
# Run with coverage
|
|
58
|
+
COVERAGE=true bundle exec rspec
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
5. **Run the linter**:
|
|
62
|
+
```bash
|
|
63
|
+
bundle exec rubocop
|
|
64
|
+
|
|
65
|
+
# Auto-fix issues
|
|
66
|
+
bundle exec rubocop -a
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
6. **Commit your changes**:
|
|
70
|
+
- Use clear, descriptive commit messages
|
|
71
|
+
- Reference issue numbers when applicable
|
|
72
|
+
```bash
|
|
73
|
+
git commit -m "Add feature X to improve Y (#123)"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
7. **Push to your fork** and submit a pull request:
|
|
77
|
+
```bash
|
|
78
|
+
git push origin feature/my-new-feature
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Development Setup
|
|
82
|
+
|
|
83
|
+
### Prerequisites
|
|
84
|
+
|
|
85
|
+
- Ruby 3.2 or higher
|
|
86
|
+
- Bundler 2.0+
|
|
87
|
+
|
|
88
|
+
### Installation
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Clone your fork
|
|
92
|
+
git clone https://github.com/YOUR-USERNAME/vectra.git
|
|
93
|
+
cd vectra
|
|
94
|
+
|
|
95
|
+
# Install dependencies
|
|
96
|
+
bundle install
|
|
97
|
+
|
|
98
|
+
# Run tests to verify setup
|
|
99
|
+
bundle exec rspec
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Running Tests
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Run all tests
|
|
106
|
+
bundle exec rake
|
|
107
|
+
|
|
108
|
+
# Run only unit tests
|
|
109
|
+
bundle exec rake spec:unit
|
|
110
|
+
|
|
111
|
+
# Run only integration tests
|
|
112
|
+
bundle exec rake spec:integration
|
|
113
|
+
|
|
114
|
+
# Run with coverage report
|
|
115
|
+
COVERAGE=true bundle exec rspec
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Code Style
|
|
119
|
+
|
|
120
|
+
We use RuboCop to enforce consistent code style. Configuration is in `.rubocop.yml`.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Check code style
|
|
124
|
+
bundle exec rubocop
|
|
125
|
+
|
|
126
|
+
# Auto-fix violations
|
|
127
|
+
bundle exec rubocop -a
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Documentation
|
|
131
|
+
|
|
132
|
+
We use YARD for documentation. All public methods should be documented.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Generate documentation
|
|
136
|
+
bundle exec rake docs
|
|
137
|
+
|
|
138
|
+
# View documentation locally
|
|
139
|
+
open doc/index.html
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Adding a New Provider
|
|
143
|
+
|
|
144
|
+
To add support for a new vector database provider:
|
|
145
|
+
|
|
146
|
+
1. **Create provider class** in `lib/vectra/providers/`:
|
|
147
|
+
```ruby
|
|
148
|
+
# lib/vectra/providers/new_provider.rb
|
|
149
|
+
module Vectra
|
|
150
|
+
module Providers
|
|
151
|
+
class NewProvider < Base
|
|
152
|
+
def provider_name
|
|
153
|
+
:new_provider
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Implement required methods from Base
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
2. **Add to configuration**:
|
|
163
|
+
Update `SUPPORTED_PROVIDERS` in `lib/vectra/configuration.rb`
|
|
164
|
+
|
|
165
|
+
3. **Require in main file**:
|
|
166
|
+
Add to `lib/vectra.rb`
|
|
167
|
+
|
|
168
|
+
4. **Write comprehensive tests**:
|
|
169
|
+
- Unit tests in `spec/vectra/providers/new_provider_spec.rb`
|
|
170
|
+
- Integration tests in `spec/integration/new_provider_integration_spec.rb`
|
|
171
|
+
|
|
172
|
+
5. **Update documentation**:
|
|
173
|
+
- Add to README.md
|
|
174
|
+
- Update CHANGELOG.md
|
|
175
|
+
- Add YARD documentation
|
|
176
|
+
|
|
177
|
+
## Testing with VCR
|
|
178
|
+
|
|
179
|
+
Integration tests use VCR to record HTTP interactions:
|
|
180
|
+
|
|
181
|
+
```ruby
|
|
182
|
+
# spec/integration/provider_spec.rb
|
|
183
|
+
RSpec.describe "Provider Integration", :vcr do
|
|
184
|
+
it "performs operation", vcr: { cassette_name: "provider/operation" } do
|
|
185
|
+
# Test code
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
To record new cassettes:
|
|
191
|
+
```bash
|
|
192
|
+
# Delete old cassettes
|
|
193
|
+
rm -rf spec/fixtures/vcr_cassettes/provider
|
|
194
|
+
|
|
195
|
+
# Run tests with real API (set API keys in ENV)
|
|
196
|
+
PINECONE_API_KEY=your_key bundle exec rspec spec/integration/
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Commit Message Guidelines
|
|
200
|
+
|
|
201
|
+
We follow conventional commits:
|
|
202
|
+
|
|
203
|
+
- `feat:` New feature
|
|
204
|
+
- `fix:` Bug fix
|
|
205
|
+
- `docs:` Documentation changes
|
|
206
|
+
- `test:` Adding or updating tests
|
|
207
|
+
- `refactor:` Code refactoring
|
|
208
|
+
- `style:` Code style changes
|
|
209
|
+
- `chore:` Maintenance tasks
|
|
210
|
+
|
|
211
|
+
Examples:
|
|
212
|
+
```
|
|
213
|
+
feat: add support for Qdrant vector database
|
|
214
|
+
fix: handle rate limit errors correctly
|
|
215
|
+
docs: update README with new examples
|
|
216
|
+
test: add integration tests for Pinecone
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Release Process
|
|
220
|
+
|
|
221
|
+
Releases are managed by maintainers:
|
|
222
|
+
|
|
223
|
+
1. Update version in `lib/vectra/version.rb`
|
|
224
|
+
2. Update CHANGELOG.md
|
|
225
|
+
3. Create git tag: `git tag -a v0.2.0 -m "Release v0.2.0"`
|
|
226
|
+
4. Push tag: `git push origin v0.2.0`
|
|
227
|
+
5. Build gem: `gem build vectra.gemspec`
|
|
228
|
+
6. Push to RubyGems: `gem push vectra-0.2.0.gem`
|
|
229
|
+
|
|
230
|
+
## Questions?
|
|
231
|
+
|
|
232
|
+
Feel free to open an issue for:
|
|
233
|
+
- Questions about the codebase
|
|
234
|
+
- Clarification on contribution process
|
|
235
|
+
- Feature discussions
|
|
236
|
+
|
|
237
|
+
## License
|
|
238
|
+
|
|
239
|
+
By contributing to Vectra, you agree that your contributions will be licensed under the MIT License.
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Vectra Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|