@instant.dev/vectors 0.1.0 → 0.1.1
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.
- package/.travis.yml +5 -0
- package/README.md +22 -6
- package/package.json +1 -1
package/.travis.yml
ADDED
package/README.md
CHANGED
|
@@ -55,9 +55,9 @@ const Vectors = new VectorManager();
|
|
|
55
55
|
|
|
56
56
|
## Usage
|
|
57
57
|
|
|
58
|
-
Once you've imported and instantiated the package,
|
|
58
|
+
Once you've imported and instantiated the package, it's easy to use.
|
|
59
59
|
|
|
60
|
-
Set a batch engine
|
|
60
|
+
### Set a batch engine
|
|
61
61
|
|
|
62
62
|
```javascript
|
|
63
63
|
// values will automatically be batched appropriately
|
|
@@ -70,13 +70,15 @@ Vectors.setEngine(async (values) => {
|
|
|
70
70
|
});
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
Create a single
|
|
73
|
+
### Create a single vectors
|
|
74
74
|
|
|
75
75
|
```javascript
|
|
76
76
|
let vector = await Vectors.create(`Something to vectorize!`);
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
Create multiple vectors
|
|
79
|
+
### Create multiple vectors
|
|
80
|
+
|
|
81
|
+
Manually manage vector creation:
|
|
80
82
|
|
|
81
83
|
```javascript
|
|
82
84
|
const myStrings = [
|
|
@@ -89,7 +91,7 @@ const myStrings = [
|
|
|
89
91
|
let vectors = await Promise.all(myStrings.map(str => Vectors.create(str)));
|
|
90
92
|
```
|
|
91
93
|
|
|
92
|
-
|
|
94
|
+
Or create multiple vectors easily with the `batchCreate` utility:
|
|
93
95
|
|
|
94
96
|
```javascript
|
|
95
97
|
const myStrings = [
|
|
@@ -102,7 +104,21 @@ const myStrings = [
|
|
|
102
104
|
let vectors = await Vectors.batchCreate(myStrings);
|
|
103
105
|
```
|
|
104
106
|
|
|
105
|
-
|
|
107
|
+
## Configuration
|
|
108
|
+
|
|
109
|
+
You can configure the following parameters:
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
const Vectors = new VectorManager();
|
|
113
|
+
|
|
114
|
+
// these are the defaults
|
|
115
|
+
Vectors.maximumBatchSize = 7168 * 4; // maximum size of a batch - for OpenAI, 4 tokens per word, estimated
|
|
116
|
+
Vectors.maximumParallelRequests = 10; // 10 web requests simultaneously max
|
|
117
|
+
Vectors.fastQueueTime = 10; // time to wait if no other entries are added
|
|
118
|
+
Vectors.waitQueueTime = 100; // time to wait to collect entries if 1+ entries are added
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Acknowledgements
|
|
106
122
|
|
|
107
123
|
Special thank you to [Scott Gamble](https://x.com/threesided) who helps run all
|
|
108
124
|
of the front-of-house work for instant.dev 💜!
|