Skip to content

Commit

Permalink
Enable usage of the local WeaviateDB without a secure connection.
Browse files Browse the repository at this point in the history
The default connection will be https, but in constructor you can set it to be http. This is a good approach to having a vector database inside Docker. There is no need to set up certificates.
  • Loading branch information
nihadtz committed Apr 22, 2024
1 parent 37c2876 commit 3903f91
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ npm install weaviate-ts-client
- Set Weaviate database as your choice of `vectorDb`

```TS
.setVectorDb(new WeaviateDb({ host: '...', apiKey: '...', className: '...' }))
.setVectorDb(new WeaviateDb({ host: '...', apiKey: '...', className: '...', scheme: '...' }))
```

## Bring your own database
Expand Down
4 changes: 2 additions & 2 deletions src/vectorDb/weaviate-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export class WeaviateDb implements BaseDb {
private readonly className: string;
private readonly client: WeaviateClient;

constructor({ host, apiKey, className }: { host: string; apiKey: string; className: string }) {
constructor({ host, apiKey, className, scheme = 'https' }: { host: string; apiKey: string; className: string; scheme: string }) {
// @ts-ignore
this.client = weaviate.client({ scheme: 'https', host, apiKey: new ApiKey(apiKey) });
this.client = weaviate.client({ scheme, host, apiKey: new ApiKey(apiKey) });
this.className = toTitleCase(className); // Weaviate translates the className during create to title case and errors at other places
}

Expand Down

0 comments on commit 3903f91

Please sign in to comment.