Skip to content

DigitalOcean.VectorDB reference

Source: packages/digitalocean/src/VectorDB/Connect.ts

Connect a runtime to a managed vector database. Its endpoints and API key reach the host as secrets, for the Weaviate client of your choice.

export default class Api extends DigitalOcean.App<Api>()(
"Api",
{ main: import.meta.url },
Effect.gen(function* () {
const db = yield* Vectors;
const conn = yield* DigitalOcean.VectorDB.Connect(db);
return {
fetch: Effect.gen(function* () {
const url = yield* conn.httpEndpoint;
const key = yield* conn.apiKey;
const live = yield* Effect.tryPromise(async () => {
const client = await weaviate.connectToWeaviateCloud(url, {
authCredentials: new weaviate.ApiKey(Redacted.value(key)),
});
return client.isLive();
});
return HttpServerResponse.text(String(live));
}).pipe(Effect.orDie),
};
}).pipe(Effect.provide(DigitalOcean.VectorDB.ConnectHttp)),
) {}

Source: packages/digitalocean/src/VectorDB/ConnectHttp.ts Kind: Layer · Provides: DigitalOcean.VectorDB.Connect

VectorDB.Connect for any host: the endpoints and API key travel through the host’s runtime context.

Source: packages/digitalocean/src/VectorDB/Database.ts

A managed vector database: a Weaviate cluster DigitalOcean runs for you. Connect to it from a runtime with VectorDB.Connect, or with any Weaviate client using httpEndpoint and apiKey. size, projectId and tags update in place; name and region replace the database.

const project = yield* DigitalOcean.Project("search", {});
const vectors = yield* DigitalOcean.VectorDB.Database("vectors", {
projectId: project.projectId,
size: "small",
});