@midsummer-ai/sdk 0.1.0-staging.3668 → 0.1.0-staging.3674
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/database/stand-in.d.mts +1 -1
- package/{index-B9zs0wIp.d.mts → index-5INBK1BU.d.mts} +54 -1
- package/package.json +1 -1
- package/vector/contract.d.mts +1 -1
- package/vector/contract.mjs +1 -1
- package/vector/index.d.mts +2 -2
- package/vector/index.mjs +18 -2
- package/vector/stand-in.d.mts +1 -1
- package/vector/stand-in.mjs +1 -1
- package/vector/wire.d.mts +2 -34
- package/vector/wire.mjs +2 -2
- package/{wire-BdNDzlIN.mjs → wire-BnZXAFNf.mjs} +52 -6
package/database/stand-in.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { p as Storage } from "../index-CXiY5knc.mjs";
|
|
|
3
3
|
import { t as AuthConfig } from "../auth-B7rCtXFQ.mjs";
|
|
4
4
|
import { a as FileMetadata, c as FunctionReference, d as HttpRouter, n as CronJob, s as FunctionKind, v as RegisteredFunction, y as Row } from "../server-B5HK2Ou9.mjs";
|
|
5
5
|
import { r as Built } from "../build-Y6rsumMB.mjs";
|
|
6
|
-
import { A as VectorControl, M as VectorEngine } from "../index-
|
|
6
|
+
import { A as VectorControl, M as VectorEngine } from "../index-5INBK1BU.mjs";
|
|
7
7
|
//#region src/database/stand-in.d.ts
|
|
8
8
|
/** A Database as its client reaches it: by function name or reference. A refusal throws `DatabaseError`. */
|
|
9
9
|
interface DatabaseClient {
|
|
@@ -13,6 +13,51 @@ declare class VectorError extends Error {
|
|
|
13
13
|
constructor(code: VectorErrorCode, why: string);
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
|
+
//#region src/vector/wire.d.ts
|
|
17
|
+
/** Carries one request frame to a server and brings back its answer frame. */
|
|
18
|
+
interface Transport {
|
|
19
|
+
send(frame: Uint8Array): Promise<Uint8Array>;
|
|
20
|
+
}
|
|
21
|
+
/** Where a frame's vectors are: paths of keys, `*` each item of an array. */
|
|
22
|
+
type Places = ReadonlyArray<ReadonlyArray<string>>;
|
|
23
|
+
/** The places of a call's vectors (`side` "call") or of its answer's (`side` "answer"), by its op. */
|
|
24
|
+
declare function places(op: string, side: "call" | "answer"): Places;
|
|
25
|
+
/** `value` as a frame: the arrays of numbers at `where` (`places`) moved into sections (`{"$v": n}`), the JSON first. */
|
|
26
|
+
declare function encode(value: unknown, where?: Places): Uint8Array;
|
|
27
|
+
/** A frame's value (`encode`): its sections back in place of their `{"$v": n}` at `where` (`places`; or, for a call
|
|
28
|
+
* read before its op is known, the places of the op its JSON names). Throws where it does not read. */
|
|
29
|
+
declare function decode(frame: Uint8Array, where?: Places | ((json: unknown) => Places)): unknown;
|
|
30
|
+
/**
|
|
31
|
+
* A transport that sends each frame straight to a Vector DB region: `POST <origin>/v1/call` with `key` as its bearer
|
|
32
|
+
* token. For a namespace kept in another region, the region returns 421 with that region's origin in `location`: the frame goes
|
|
33
|
+
* there again, and that namespace's calls go there from then on. Anything else that isn't a frame, and a fetch that
|
|
34
|
+
* fails, throws, which `remote` reads as `unavailable`.
|
|
35
|
+
*
|
|
36
|
+
* const engine = remote(direct({ key: process.env.MIDSUMMER_VECTOR_KEY!, origin: process.env.MIDSUMMER_VECTOR_ORIGIN! }))
|
|
37
|
+
*/
|
|
38
|
+
declare function direct(options: {
|
|
39
|
+
readonly key: string;
|
|
40
|
+
readonly origin: string;
|
|
41
|
+
readonly fetch?: (input: string, init?: RequestInit) => Promise<Response>;
|
|
42
|
+
}): Transport;
|
|
43
|
+
/** An engine that sends each call over `transport`. A transport that fails is `unavailable`. */
|
|
44
|
+
declare function remote(transport: Transport): VectorEngine & VectorControl;
|
|
45
|
+
/**
|
|
46
|
+
* Serves request frames from `engine`. A frame comes from the network, so it is checked here as the
|
|
47
|
+
* client would check it; a refusal is returned as `invalid`. Making and dropping namespaces is
|
|
48
|
+
* served only by an engine that has them, else `forbidden`. A failure that is not a `VectorError`
|
|
49
|
+
* is the engine's own fault and is thrown to the transport, never returned.
|
|
50
|
+
*/
|
|
51
|
+
declare function serve(engine: VectorEngine & Partial<VectorControl>): (frame: Uint8Array) => Promise<Uint8Array>;
|
|
52
|
+
/**
|
|
53
|
+
* `engine` as a Site of one Environment reaches it: `namespaceId` returns, for the one name a call
|
|
54
|
+
* names, the id the engine knows that Environment's Vector namespace by, so a call costs the lookup
|
|
55
|
+
* of its own namespace and never a listing of the others. A name with no id is `not_found`, as a
|
|
56
|
+
* namespace that does not exist is, so a Site learns nothing of other Environments. It cannot make
|
|
57
|
+
* or drop one.
|
|
58
|
+
*/
|
|
59
|
+
declare function scoped(engine: VectorEngine, namespaceId: (name: string) => Promise<string | undefined>): VectorEngine;
|
|
60
|
+
//#endregion
|
|
16
61
|
//#region src/vector/schema.d.ts
|
|
17
62
|
/** Most numbers a Vector holds. */
|
|
18
63
|
declare const MAX_DIMENSION = 4096;
|
|
@@ -401,6 +446,14 @@ interface VectorControl {
|
|
|
401
446
|
* Tests use `vectorDb(standIn())` instead.
|
|
402
447
|
*/
|
|
403
448
|
declare function namespace(name: string): Namespace;
|
|
449
|
+
/**
|
|
450
|
+
* Vector DB over a Vector key, from code outside Midsummer: each call goes straight to `origin`, a region's origin as
|
|
451
|
+
* `vector.key.create` returns them, and on to the region that keeps its namespace (`direct`).
|
|
452
|
+
*/
|
|
453
|
+
declare function connect(options: {
|
|
454
|
+
readonly key: string;
|
|
455
|
+
readonly origin: string;
|
|
456
|
+
}): VectorDb;
|
|
404
457
|
/** Vector DB over `engine`. */
|
|
405
458
|
declare function vectorDb(engine: VectorEngine): VectorDb;
|
|
406
459
|
/**
|
|
@@ -412,4 +465,4 @@ declare function vectorDb(engine: VectorEngine): VectorDb;
|
|
|
412
465
|
*/
|
|
413
466
|
declare function embedded(engine: ValuesEngine, embed: (namespace: string, texts: ReadonlyArray<string>) => Promise<ReadonlyArray<ReadonlyArray<number>> | undefined>): VectorEngine;
|
|
414
467
|
//#endregion
|
|
415
|
-
export { VectorControl as A,
|
|
468
|
+
export { serve as $, VectorControl as A, MAX_METADATA_BYTES as B, QueryOptions as C, ValuesEngine as D, TextVector as E, namespace as F, Places as G, MAX_TEXT as H, vectorDb as I, direct as J, Transport as K, MAX_BATCH as L, VectorEngine as M, connect as N, ValuesMultiQuery as O, embedded as P, scoped as Q, MAX_DIMENSION as R, NamespaceInfo as S, TextSearchOptions as T, MAX_TOP_K as U, MAX_QUERIES as V, MAX_VALUE as W, places as X, encode as Y, remote as Z, Metric as _, Consistency as a, MultiQueryResult as b, EngineMultiQuery as c, EngineTextSearch as d, VectorError as et, Filter as f, MetadataValue as g, Match as h, Condition as i, VectorDb as j, Vector as k, EnginePart as l, Listed as m, AggregateGroup as n, vectorErrorCodes as nt, EngineAggregate as o, ListOptions as p, decode as q, AggregateOptions as r, EngineList as s, Aggregate as t, VectorErrorCode as tt, EngineQuery as u, MultiQueryOptions as v, Scalar as w, Namespace as x, MultiQueryPart as y, MAX_FULL_TEXT as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midsummer-ai/sdk",
|
|
3
|
-
"version": "0.1.0-staging.
|
|
3
|
+
"version": "0.1.0-staging.3674",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Midsummer's handles for an app's code: its Database, Storage, Queues, Vector DB, AI, Email and Agents, with stand-ins for tests.",
|
package/vector/contract.d.mts
CHANGED
package/vector/contract.mjs
CHANGED
package/vector/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as VectorControl, B as
|
|
2
|
-
export { Aggregate, AggregateGroup, AggregateOptions, Condition, Consistency, EngineAggregate, EngineList, EngineMultiQuery, EnginePart, EngineQuery, EngineTextSearch, Filter, ListOptions, Listed, MAX_BATCH, MAX_DIMENSION, MAX_FULL_TEXT, MAX_METADATA_BYTES, MAX_QUERIES, MAX_TEXT, MAX_TOP_K, MAX_VALUE, Match, MetadataValue, Metric, MultiQueryOptions, MultiQueryPart, MultiQueryResult, Namespace, NamespaceInfo, QueryOptions, Scalar, TextSearchOptions, TextVector, ValuesEngine, ValuesMultiQuery, Vector, VectorControl, VectorDb, VectorEngine, VectorError, type VectorErrorCode, embedded, namespace, vectorDb, vectorErrorCodes };
|
|
1
|
+
import { A as VectorControl, B as MAX_METADATA_BYTES, C as QueryOptions, D as ValuesEngine, E as TextVector, F as namespace, H as MAX_TEXT, I as vectorDb, J as direct, K as Transport, L as MAX_BATCH, M as VectorEngine, N as connect, O as ValuesMultiQuery, P as embedded, R as MAX_DIMENSION, S as NamespaceInfo, T as TextSearchOptions, U as MAX_TOP_K, V as MAX_QUERIES, W as MAX_VALUE, _ as Metric, a as Consistency, b as MultiQueryResult, c as EngineMultiQuery, d as EngineTextSearch, et as VectorError, f as Filter, g as MetadataValue, h as Match, i as Condition, j as VectorDb, k as Vector, l as EnginePart, m as Listed, n as AggregateGroup, nt as vectorErrorCodes, o as EngineAggregate, p as ListOptions, r as AggregateOptions, s as EngineList, t as Aggregate, tt as VectorErrorCode, u as EngineQuery, v as MultiQueryOptions, w as Scalar, x as Namespace, y as MultiQueryPart, z as MAX_FULL_TEXT } from "../index-5INBK1BU.mjs";
|
|
2
|
+
export { Aggregate, AggregateGroup, AggregateOptions, Condition, Consistency, EngineAggregate, EngineList, EngineMultiQuery, EnginePart, EngineQuery, EngineTextSearch, Filter, ListOptions, Listed, MAX_BATCH, MAX_DIMENSION, MAX_FULL_TEXT, MAX_METADATA_BYTES, MAX_QUERIES, MAX_TEXT, MAX_TOP_K, MAX_VALUE, Match, MetadataValue, Metric, MultiQueryOptions, MultiQueryPart, MultiQueryResult, Namespace, NamespaceInfo, QueryOptions, Scalar, TextSearchOptions, TextVector, type Transport, ValuesEngine, ValuesMultiQuery, Vector, VectorControl, VectorDb, VectorEngine, VectorError, type VectorErrorCode, connect, direct, embedded, namespace, vectorDb, vectorErrorCodes };
|
package/vector/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as late, t as here } from "../here-1plIxb0D.mjs";
|
|
2
|
-
import { C as
|
|
2
|
+
import { C as Vectors, E as vectorErrorCodes, S as TextSearch, T as VectorError, _ as MAX_TOP_K, a as remote, b as NamespaceName, c as Aggregation, d as MAX_BATCH, f as MAX_DIMENSION, g as MAX_TEXT, h as MAX_QUERIES, l as Ids, m as MAX_METADATA_BYTES, n as direct, p as MAX_FULL_TEXT, u as List, v as MAX_VALUE, w as checked, x as Query, y as MultiQuery } from "../wire-BnZXAFNf.mjs";
|
|
3
3
|
//#region src/vector/index.ts
|
|
4
4
|
/**
|
|
5
5
|
* Vector DB: a Team's Vectors in Vector namespaces, searched by closeness and filtered by their
|
|
@@ -26,6 +26,15 @@ import { C as checked, S as Vectors, T as vectorErrorCodes, _ as MAX_VALUE, b as
|
|
|
26
26
|
* const { fused } = await docs.multiQuery([{ vector: [0.1, 0.2, 0.25] }, { textSearch: "reset password", field: "title" }], { fuse: { rrf: {} } })
|
|
27
27
|
* const perLang = await docs.aggregate({ aggregates: { n: ["count"] }, groupBy: ["lang"] })
|
|
28
28
|
*
|
|
29
|
+
* Outside Midsummer, such as in a script or another host's server, `connect` reaches the namespaces a Vector key
|
|
30
|
+
* reaches, sending each call straight to the region that keeps its namespace. `midsummer vector key create` shows the
|
|
31
|
+
* key's secret once, with each region's origin:
|
|
32
|
+
*
|
|
33
|
+
* import { connect } from "@midsummer-ai/sdk/vector"
|
|
34
|
+
*
|
|
35
|
+
* const vectors = connect({ key: process.env.MIDSUMMER_VECTOR_KEY!, origin: process.env.MIDSUMMER_VECTOR_ORIGIN! })
|
|
36
|
+
* const matches = await vectors.namespace("docs").query([0.1, 0.2, 0.25], { topK: 5 })
|
|
37
|
+
*
|
|
29
38
|
* In tests and `midsummer dev`, `standIn()` from `@midsummer-ai/sdk/vector/stand-in` keeps Vectors in
|
|
30
39
|
* memory. Each is held to the cases in `@midsummer-ai/sdk/vector/contract`; a behaviour that is not a
|
|
31
40
|
* case there is not promised.
|
|
@@ -51,6 +60,13 @@ function namespace(name) {
|
|
|
51
60
|
throw new VectorError("forbidden", "This code runs outside a deployment, so no environment binds a Vector DB namespace for it.");
|
|
52
61
|
})).namespace(name);
|
|
53
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Vector DB over a Vector key, from code outside Midsummer: each call goes straight to `origin`, a region's origin as
|
|
65
|
+
* `vector.key.create` returns them, and on to the region that keeps its namespace (`direct`).
|
|
66
|
+
*/
|
|
67
|
+
function connect(options) {
|
|
68
|
+
return vectorDb(remote(direct(options)));
|
|
69
|
+
}
|
|
54
70
|
/** Vector DB over `engine`. */
|
|
55
71
|
function vectorDb(engine) {
|
|
56
72
|
return { namespace(name) {
|
|
@@ -184,4 +200,4 @@ function embedded(engine, embed) {
|
|
|
184
200
|
};
|
|
185
201
|
}
|
|
186
202
|
//#endregion
|
|
187
|
-
export { MAX_BATCH, MAX_DIMENSION, MAX_FULL_TEXT, MAX_METADATA_BYTES, MAX_QUERIES, MAX_TEXT, MAX_TOP_K, MAX_VALUE, VectorError, embedded, namespace, vectorDb, vectorErrorCodes };
|
|
203
|
+
export { MAX_BATCH, MAX_DIMENSION, MAX_FULL_TEXT, MAX_METADATA_BYTES, MAX_QUERIES, MAX_TEXT, MAX_TOP_K, MAX_VALUE, VectorError, connect, direct, embedded, namespace, vectorDb, vectorErrorCodes };
|
package/vector/stand-in.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as VectorControl, M as VectorEngine } from "../index-
|
|
1
|
+
import { A as VectorControl, M as VectorEngine } from "../index-5INBK1BU.mjs";
|
|
2
2
|
//#region src/vector/stand-in.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* A text's Stand-in embedding of `dimension` numbers: each word (letters and digits, in lower case)
|
package/vector/stand-in.mjs
CHANGED
package/vector/wire.d.mts
CHANGED
|
@@ -1,34 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/** Carries one request frame to a server and brings back its answer frame. */
|
|
4
|
-
interface Transport {
|
|
5
|
-
send(frame: Uint8Array): Promise<Uint8Array>;
|
|
6
|
-
}
|
|
7
|
-
/** Where a frame's vectors are: paths of keys, `*` each item of an array. */
|
|
8
|
-
type Places = ReadonlyArray<ReadonlyArray<string>>;
|
|
9
|
-
/** The places of a call's vectors (`side` "call") or of its answer's (`side` "answer"), by its op. */
|
|
10
|
-
declare function places(op: string, side: "call" | "answer"): Places;
|
|
11
|
-
/** `value` as a frame: the arrays of numbers at `where` (`places`) moved into sections (`{"$v": n}`), the JSON first. */
|
|
12
|
-
declare function encode(value: unknown, where?: Places): Uint8Array;
|
|
13
|
-
/** A frame's value (`encode`): its sections back in place of their `{"$v": n}` at `where` (`places`; or, for a call
|
|
14
|
-
* read before its op is known, the places of the op its JSON names). Throws where it does not read. */
|
|
15
|
-
declare function decode(frame: Uint8Array, where?: Places | ((json: unknown) => Places)): unknown;
|
|
16
|
-
/** An engine that sends each call over `transport`. A transport that fails is `unavailable`. */
|
|
17
|
-
declare function remote(transport: Transport): VectorEngine & VectorControl;
|
|
18
|
-
/**
|
|
19
|
-
* Serves request frames from `engine`. A frame comes from the network, so it is checked here as the
|
|
20
|
-
* client would check it; a refusal is returned as `invalid`. Making and dropping namespaces is
|
|
21
|
-
* served only by an engine that has them, else `forbidden`. A failure that is not a `VectorError`
|
|
22
|
-
* is the engine's own fault and is thrown to the transport, never returned.
|
|
23
|
-
*/
|
|
24
|
-
declare function serve(engine: VectorEngine & Partial<VectorControl>): (frame: Uint8Array) => Promise<Uint8Array>;
|
|
25
|
-
/**
|
|
26
|
-
* `engine` as a Site of one Environment reaches it: `namespaceId` returns, for the one name a call
|
|
27
|
-
* names, the id the engine knows that Environment's Vector namespace by, so a call costs the lookup
|
|
28
|
-
* of its own namespace and never a listing of the others. A name with no id is `not_found`, as a
|
|
29
|
-
* namespace that does not exist is, so a Site learns nothing of other Environments. It cannot make
|
|
30
|
-
* or drop one.
|
|
31
|
-
*/
|
|
32
|
-
declare function scoped(engine: VectorEngine, namespaceId: (name: string) => Promise<string | undefined>): VectorEngine;
|
|
33
|
-
//#endregion
|
|
34
|
-
export { Places, Transport, decode, encode, places, remote, scoped, serve };
|
|
1
|
+
import { $ as serve, G as Places, J as direct, K as Transport, Q as scoped, X as places, Y as encode, Z as remote, q as decode } from "../index-5INBK1BU.mjs";
|
|
2
|
+
export { Places, Transport, decode, direct, encode, places, remote, scoped, serve };
|
package/vector/wire.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { decode, encode, places, remote, scoped, serve };
|
|
1
|
+
import { a as remote, i as places, n as direct, o as scoped, r as encode, s as serve, t as decode } from "../wire-BnZXAFNf.mjs";
|
|
2
|
+
export { decode, direct, encode, places, remote, scoped, serve };
|
|
@@ -223,14 +223,15 @@ function checked(schema, value) {
|
|
|
223
223
|
* an aggregate's key, whatever its fields are named) is `{"$v": n}` in the JSON and section n after
|
|
224
224
|
* it, a u32 count and that many little-endian 32-bit floats, so a value crosses the wire bit for bit
|
|
225
225
|
* (-0 included), never as a JSON number. A transport
|
|
226
|
-
* only carries frames; a Site's own handle is one (`{ send }`), handed to it
|
|
227
|
-
*
|
|
226
|
+
* only carries frames; a Site's own handle is one (`{ send }`), handed to it for its Environment, and
|
|
227
|
+
* `direct` is one that sends each frame to a region with a Vector key.
|
|
228
228
|
*
|
|
229
229
|
* const docs = vectorDb(remote(context.vector)).namespace("docs") // a Site
|
|
230
|
-
* const
|
|
230
|
+
* const docs = vectorDb(remote(direct({ key, origin }))).namespace("docs") // anywhere else, with a Vector key
|
|
231
|
+
* const answer = await serve(engine)(frame) // a server
|
|
231
232
|
*
|
|
232
|
-
* `scoped`
|
|
233
|
-
*
|
|
233
|
+
* `scoped` serves names mapped to the ids an engine knows them by, with making, changing or dropping
|
|
234
|
+
* a namespace refused.
|
|
234
235
|
*/
|
|
235
236
|
const call = z.discriminatedUnion("op", [
|
|
236
237
|
z.object({
|
|
@@ -396,6 +397,51 @@ function callPlaces(json) {
|
|
|
396
397
|
const op = json !== null && typeof json === "object" ? json.op : void 0;
|
|
397
398
|
return typeof op === "string" ? places(op, "call") : [];
|
|
398
399
|
}
|
|
400
|
+
/** How many times `direct` follows a region's 421 for one frame before it gives up. */
|
|
401
|
+
const MOVES = 2;
|
|
402
|
+
/** The namespace a call frame names, read from its JSON alone, its vectors left where they are. */
|
|
403
|
+
function frameNamespace(frame) {
|
|
404
|
+
const length = new DataView(frame.buffer, frame.byteOffset, frame.byteLength).getUint32(0, true);
|
|
405
|
+
const json = JSON.parse(new TextDecoder().decode(frame.subarray(4, 4 + length)));
|
|
406
|
+
const name = json !== null && typeof json === "object" ? json.namespace : void 0;
|
|
407
|
+
return typeof name === "string" ? name : void 0;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* A transport that sends each frame straight to a Vector DB region: `POST <origin>/v1/call` with `key` as its bearer
|
|
411
|
+
* token. For a namespace kept in another region, the region returns 421 with that region's origin in `location`: the frame goes
|
|
412
|
+
* there again, and that namespace's calls go there from then on. Anything else that isn't a frame, and a fetch that
|
|
413
|
+
* fails, throws, which `remote` reads as `unavailable`.
|
|
414
|
+
*
|
|
415
|
+
* const engine = remote(direct({ key: process.env.MIDSUMMER_VECTOR_KEY!, origin: process.env.MIDSUMMER_VECTOR_ORIGIN! }))
|
|
416
|
+
*/
|
|
417
|
+
function direct(options) {
|
|
418
|
+
const send = options.fetch ?? ((input, init) => fetch(input, init));
|
|
419
|
+
const home = options.origin.replace(/\/+$/, "");
|
|
420
|
+
const moved = /* @__PURE__ */ new Map();
|
|
421
|
+
return { async send(frame) {
|
|
422
|
+
const name = frameNamespace(frame);
|
|
423
|
+
let origin = name !== void 0 && moved.get(name) || home;
|
|
424
|
+
for (let moves = 0;; moves++) {
|
|
425
|
+
const response = await send(`${origin}/v1/call`, {
|
|
426
|
+
method: "POST",
|
|
427
|
+
headers: {
|
|
428
|
+
authorization: `Bearer ${options.key}`,
|
|
429
|
+
"content-type": "application/octet-stream"
|
|
430
|
+
},
|
|
431
|
+
body: frame
|
|
432
|
+
});
|
|
433
|
+
const location = response.status === 421 ? response.headers.get("location")?.replace(/\/+$/, "") : void 0;
|
|
434
|
+
if (location && moves < MOVES) {
|
|
435
|
+
await response.body?.cancel();
|
|
436
|
+
origin = location;
|
|
437
|
+
if (name !== void 0) moved.set(name, location);
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
if (!response.ok) throw new Error(`Vector DB answered HTTP ${response.status}`);
|
|
441
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
442
|
+
}
|
|
443
|
+
} };
|
|
444
|
+
}
|
|
399
445
|
/** An engine that sends each call over `transport`. A transport that fails is `unavailable`. */
|
|
400
446
|
function remote(transport) {
|
|
401
447
|
async function ask(request) {
|
|
@@ -551,4 +597,4 @@ function scoped(engine, namespaceId) {
|
|
|
551
597
|
};
|
|
552
598
|
}
|
|
553
599
|
//#endregion
|
|
554
|
-
export {
|
|
600
|
+
export { Vectors as C, vectorErrorCodes as E, TextSearch as S, VectorError as T, MAX_TOP_K as _, remote as a, NamespaceName as b, Aggregation as c, MAX_BATCH as d, MAX_DIMENSION as f, MAX_TEXT as g, MAX_QUERIES as h, places as i, Ids as l, MAX_METADATA_BYTES as m, direct as n, scoped as o, MAX_FULL_TEXT as p, encode as r, serve as s, decode as t, List as u, MAX_VALUE as v, checked as w, Query as x, MultiQuery as y };
|