Skip to content

Commit 8f82eac

Browse files
tsmith023bevzzz
andauthored
Dev/1.30 (#275)
* Add support for defining generative config at query-time (dynamic RAG) * Fix unit test * Again fix unit test * Add concurrency limit to CI on a per branch basis to cancel old runs * Add test of string-only usage with runtime generative * Add factory to produce user friendly gen runtime config objects * Remove `it.only` from test * Update CI images * Update name of version checker method * Update to use latest proto with optional model fix in openai * Fix unit test * Update CI images * merge * Add ability to define tenant-level perms for `data` and `tenants` perms * Make the next publish job push a next tag (add bash script to do this automatically in future) * 3.5.0-beta.0 * Fix action typo, add generic to catch this in future * 3.5.0-beta.1 * Fix broken add/remove permissions method * 3.5.0-beta.2 * Make fixes in response to user feedback * Improvements: (#279) - Fixes bad typing of `GenerativeConfigRuntime` - adds mocks for this usage - renames `generativeConfigRuntime` to `generativeParameters` to match Python naming * Use REST instead of gRPC for `tenants.getByName` when available due to filtering issues with rbac * Add back tests of unsupported error throwing for <1.25 * chore: update OpenAPI schema * feat: enable dynamic user management, add db/oidc namespaces * refactor: re-use common code snippets * test: extend integration test suite * refactor(test): use concise Promise.all * feat(breaking): include user types in user assignments * chore: format and lint * test: activate test case for 'oidc' users * chore: lint and format * refactor: replace .reduce with .map where possible Rewrote other .reduce occurences in a more succinct manner * test: use valid tenant name * refactor: collect optional parameters in an object * test: add test case w/ includePermissions=true * chore: lint and format * Add missing modules and module params for - `baseURL` in `generative-anthropic` - `videoIntervalSeconds` in `multi2vec-google` - `outputEncoding` in `Multi2VecVoyageAIConfig` - the entire `text2vec-nvidia` module * fix: expect no response for /activate and /deactivate * fix: allow expected code only for instances of WeaviateUnexpectedStatusCodeError * refactor: declare types in **/types.ts * test: await on all expectations which should resolve/reject * refactor: replace postNoBody with a more explicit postReturn<null, R> * chore: add documentation for dynamic user management * chore: lint and format * test: use different port binding for backup/unit.test.ts Seems like Node 18 does not automatically 'resolve' port collisions, so 2 test running Express servers on the same ports will interfere with one another. * feat: add revokeKey option to /deactivate * Remove `--tag next` from CI publish in preparation for merging --------- Co-authored-by: dyma solovei <dyma@weaviate.io>
1 parent d0b7ac2 commit 8f82eac

39 files changed

+3159
-584
lines changed

.github/workflows/main.yaml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@ on:
88

99
env:
1010
WEAVIATE_124: 1.24.26
11-
WEAVIATE_125: 1.25.30
12-
WEAVIATE_126: 1.26.14
13-
WEAVIATE_127: 1.27.11
14-
WEAVIATE_128: 1.28.4
15-
WEAVIATE_129: 1.29.0
11+
WEAVIATE_125: 1.25.34
12+
WEAVIATE_126: 1.26.17
13+
WEAVIATE_127: 1.27.15
14+
WEAVIATE_128: 1.28.11
15+
WEAVIATE_129: 1.29.1
16+
WEAVIATE_130: 1.30.0-rc.0-6b9a01c
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
20+
cancel-in-progress: true
1621

1722
jobs:
1823
checks:
@@ -41,9 +46,10 @@ jobs:
4146
{ node: "22.x", weaviate: $WEAVIATE_126},
4247
{ node: "22.x", weaviate: $WEAVIATE_127},
4348
{ node: "22.x", weaviate: $WEAVIATE_128},
44-
{ node: "18.x", weaviate: $WEAVIATE_129},
45-
{ node: "20.x", weaviate: $WEAVIATE_129},
46-
{ node: "22.x", weaviate: $WEAVIATE_129}
49+
{ node: "22.x", weaviate: $WEAVIATE_129},
50+
{ node: "18.x", weaviate: $WEAVIATE_130},
51+
{ node: "20.x", weaviate: $WEAVIATE_130},
52+
{ node: "22.x", weaviate: $WEAVIATE_130}
4753
]
4854
steps:
4955
- uses: actions/checkout@v3
@@ -74,7 +80,7 @@ jobs:
7480
fail-fast: false
7581
matrix:
7682
versions: [
77-
{ node: "22.x", weaviate: $WEAVIATE_129}
83+
{ node: "22.x", weaviate: $WEAVIATE_130}
7884
]
7985
steps:
8086
- uses: actions/checkout@v3
@@ -133,4 +139,4 @@ jobs:
133139
uses: softprops/action-gh-release@v1
134140
with:
135141
generate_release_notes: true
136-
draft: true
142+
draft: true

ci/compose.sh

100644100755
File mode changed.

ci/docker-compose-rbac.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,10 @@ services:
2828
AUTHORIZATION_RBAC_ENABLED: "true"
2929
AUTHORIZATION_ADMIN_USERS: "admin-user"
3030
AUTHORIZATION_VIEWER_USERS: "viewer-user"
31+
AUTHENTICATION_DB_USERS_ENABLED: "true"
32+
AUTHENTICATION_OIDC_ENABLED: "true"
33+
AUTHENTICATION_OIDC_CLIENT_ID: "wcs"
34+
AUTHENTICATION_OIDC_ISSUER: "https://auth.wcs.api.weaviate.io/auth/realms/SeMI"
35+
AUTHENTICATION_OIDC_USERNAME_CLAIM: "email"
36+
AUTHENTICATION_OIDC_GROUPS_CLAIM: "groups"
3137
...

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "weaviate-client",
3-
"version": "3.4.2",
3+
"version": "3.5.0-beta.2",
44
"description": "JS/TS client for Weaviate",
55
"main": "dist/node/cjs/index.js",
66
"type": "module",

src/collections/backup/unit.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ describe('Mock testing of backup cancellation', () => {
109109
let mock: CancelMock;
110110

111111
beforeAll(async () => {
112-
mock = await CancelMock.use('1.27.0', 8958, 8959);
113-
client = await weaviate.connectToLocal({ port: 8958, grpcPort: 8959 });
112+
mock = await CancelMock.use('1.27.0', 8912, 8913);
113+
client = await weaviate.connectToLocal({ port: 8912, grpcPort: 8913 });
114114
});
115115

116116
it('should throw while waiting for creation if backup is cancelled in the meantime', async () => {
@@ -133,7 +133,7 @@ describe('Mock testing of backup cancellation', () => {
133133
});
134134

135135
it('should return false if creation backup does not exist', async () => {
136-
const success = await client.backup.cancel({ backupId: `${BACKUP_ID}4`, backend: BACKEND });
136+
const success = await client.backup.cancel({ backupId: `${BACKUP_ID}-unknown`, backend: BACKEND });
137137
expect(success).toBe(false);
138138
});
139139

src/collections/config/types/generative.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export type GenerativeAWSConfig = {
1515
};
1616

1717
export type GenerativeAnthropicConfig = {
18+
baseURL?: string;
1819
maxTokens?: number;
1920
model?: string;
2021
stopSequences?: string[];
@@ -58,6 +59,13 @@ export type GenerativeMistralConfig = {
5859
temperature?: number;
5960
};
6061

62+
export type GenerativeNvidiaConfig = {
63+
baseURL?: string;
64+
maxTokens?: number;
65+
model?: string;
66+
temperature?: number;
67+
};
68+
6169
export type GenerativeOllamaConfig = {
6270
apiEndpoint?: string;
6371
model?: string;

src/collections/config/types/vectorizer.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export type Vectorizer =
3535
| 'text2vec-gpt4all'
3636
| 'text2vec-huggingface'
3737
| 'text2vec-jinaai'
38+
| 'text2vec-nvidia'
3839
| 'text2vec-mistral'
3940
| 'text2vec-ollama'
4041
| 'text2vec-openai'
@@ -169,6 +170,8 @@ export type Multi2VecGoogleConfig = {
169170
textFields?: string[];
170171
/** The video fields used when vectorizing. */
171172
videoFields?: string[];
173+
/** Length of a video interval in seconds. */
174+
videoIntervalSeconds?: number;
172175
/** The model ID in use. */
173176
modelId?: string;
174177
/** The dimensionality of the vector once embedded. */
@@ -223,6 +226,8 @@ export type Multi2VecVoyageAIConfig = {
223226
imageFields?: string[];
224227
/** The model to use. */
225228
model?: string;
229+
/** How the output from the model should be encoded on return. */
230+
outputEncoding?: string;
226231
/** The text fields used when vectorizing. */
227232
textFields?: string[];
228233
/** Whether the input should be truncated to fit in the context window. */
@@ -363,6 +368,22 @@ export type Text2VecJinaAIConfig = {
363368
/** @deprecated Use `Text2VecJinaAIConfig` instead. */
364369
export type Text2VecJinaConfig = Text2VecJinaAIConfig;
365370

371+
/**
372+
* The configuration for text vectorization using the Nvidia module.
373+
*
374+
* See the [documentation](https://weaviate.io/developers/weaviate/model-providers/nvidia/embeddings) for detailed usage.
375+
*/
376+
export type Text2VecNvidiaConfig = {
377+
/** The base URL to use where API requests should go. */
378+
baseURL?: string;
379+
/** The model to use. */
380+
model?: string;
381+
/** Whether to truncate when vectorising. */
382+
truncate?: boolean;
383+
/** Whether to vectorize the collection name. */
384+
vectorizeCollectionName?: boolean;
385+
};
386+
366387
/**
367388
* The configuration for text vectorization using the Mistral module.
368389
*
@@ -541,6 +562,8 @@ export type VectorizerConfigType<V> = V extends 'img2vec-neural'
541562
? Text2VecHuggingFaceConfig | undefined
542563
: V extends 'text2vec-jinaai'
543564
? Text2VecJinaAIConfig | undefined
565+
: V extends 'text2vec-nvidia'
566+
? Text2VecNvidiaConfig | undefined
544567
: V extends 'text2vec-mistral'
545568
? Text2VecMistralConfig | undefined
546569
: V extends 'text2vec-ollama'

src/collections/configure/generative.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
GenerativeFriendliAIConfig,
99
GenerativeGoogleConfig,
1010
GenerativeMistralConfig,
11+
GenerativeNvidiaConfig,
1112
GenerativeOllamaConfig,
1213
GenerativeOpenAIConfig,
1314
GenerativePaLMConfig,
@@ -22,6 +23,7 @@ import {
2223
GenerativeDatabricksConfigCreate,
2324
GenerativeFriendliAIConfigCreate,
2425
GenerativeMistralConfigCreate,
26+
GenerativeNvidiaConfigCreate,
2527
GenerativeOllamaConfigCreate,
2628
GenerativeOpenAIConfigCreate,
2729
GenerativePaLMConfigCreate,
@@ -169,6 +171,22 @@ export default {
169171
config,
170172
};
171173
},
174+
/**
175+
* Create a `ModuleConfig<'generative-nvidia', GenerativeNvidiaConfig | undefined>` object for use when performing AI generation using the `generative-mistral` module.
176+
*
177+
* See the [documentation](https://weaviate.io/developers/weaviate/model-providers/nvidia/generative) for detailed usage.
178+
*
179+
* @param {GenerativeNvidiaConfigCreate} [config] The configuration for the `generative-nvidia` module.
180+
* @returns {ModuleConfig<'generative-nvidia', GenerativeNvidiaConfig | undefined>} The configuration object.
181+
*/
182+
nvidia(
183+
config?: GenerativeNvidiaConfigCreate
184+
): ModuleConfig<'generative-nvidia', GenerativeNvidiaConfig | undefined> {
185+
return {
186+
name: 'generative-nvidia',
187+
config,
188+
};
189+
},
172190
/**
173191
* Create a `ModuleConfig<'generative-ollama', GenerativeOllamaConfig | undefined>` object for use when performing AI generation using the `generative-ollama` module.
174192
*

src/collections/configure/types/generative.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
GenerativeDatabricksConfig,
66
GenerativeFriendliAIConfig,
77
GenerativeMistralConfig,
8+
GenerativeNvidiaConfig,
89
GenerativeOllamaConfig,
910
GenerativePaLMConfig,
1011
} from '../../index.js';
@@ -44,6 +45,8 @@ export type GenerativeFriendliAIConfigCreate = GenerativeFriendliAIConfig;
4445

4546
export type GenerativeMistralConfigCreate = GenerativeMistralConfig;
4647

48+
export type GenerativeNvidiaConfigCreate = GenerativeNvidiaConfig;
49+
4750
export type GenerativeOllamaConfigCreate = GenerativeOllamaConfig;
4851

4952
export type GenerativeOpenAIConfigCreate = GenerativeOpenAIConfigBaseCreate & {
@@ -61,6 +64,7 @@ export type GenerativeConfigCreate =
6164
| GenerativeDatabricksConfigCreate
6265
| GenerativeFriendliAIConfigCreate
6366
| GenerativeMistralConfigCreate
67+
| GenerativeNvidiaConfigCreate
6468
| GenerativeOllamaConfigCreate
6569
| GenerativeOpenAIConfigCreate
6670
| GenerativePaLMConfigCreate
@@ -81,6 +85,8 @@ export type GenerativeConfigCreateType<G> = G extends 'generative-anthropic'
8185
? GenerativeFriendliAIConfigCreate
8286
: G extends 'generative-mistral'
8387
? GenerativeMistralConfigCreate
88+
: G extends 'generative-nvidia'
89+
? GenerativeNvidiaConfigCreate
8490
: G extends 'generative-ollama'
8591
? GenerativeOllamaConfigCreate
8692
: G extends 'generative-openai'

src/collections/configure/types/vectorizer.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
Text2VecHuggingFaceConfig,
1414
Text2VecJinaAIConfig,
1515
Text2VecMistralConfig,
16+
Text2VecNvidiaConfig,
1617
Text2VecOllamaConfig,
1718
Text2VecOpenAIConfig,
1819
Text2VecTransformersConfig,
@@ -198,6 +199,8 @@ export type Text2VecHuggingFaceConfigCreate = Text2VecHuggingFaceConfig;
198199

199200
export type Text2VecJinaAIConfigCreate = Text2VecJinaAIConfig;
200201

202+
export type Text2VecNvidiaConfigCreate = Text2VecNvidiaConfig;
203+
201204
export type Text2VecMistralConfigCreate = Text2VecMistralConfig;
202205

203206
export type Text2VecOllamaConfigCreate = Text2VecOllamaConfig;
@@ -247,6 +250,8 @@ export type VectorizerConfigCreateType<V> = V extends 'img2vec-neural'
247250
? Text2VecHuggingFaceConfigCreate | undefined
248251
: V extends 'text2vec-jinaai'
249252
? Text2VecJinaAIConfigCreate | undefined
253+
: V extends 'text2vec-nvidia'
254+
? Text2VecNvidiaConfigCreate | undefined
250255
: V extends 'text2vec-mistral'
251256
? Text2VecMistralConfigCreate | undefined
252257
: V extends 'text2vec-ollama'

src/collections/configure/unit.test.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,47 @@ describe('Unit testing of the vectorizer factory class', () => {
11611161
});
11621162
});
11631163

1164+
it('should create the correct Text2VecNvidiaConfig type with defaults', () => {
1165+
const config = configure.vectorizer.text2VecNvidia();
1166+
expect(config).toEqual<VectorConfigCreate<never, undefined, 'hnsw', 'text2vec-nvidia'>>({
1167+
name: undefined,
1168+
vectorIndex: {
1169+
name: 'hnsw',
1170+
config: undefined,
1171+
},
1172+
vectorizer: {
1173+
name: 'text2vec-nvidia',
1174+
config: undefined,
1175+
},
1176+
});
1177+
});
1178+
1179+
it('should create the correct Text2VecNvidiaConfig type with all values', () => {
1180+
const config = configure.vectorizer.text2VecNvidia({
1181+
name: 'test',
1182+
baseURL: 'base-url',
1183+
model: 'model',
1184+
truncate: true,
1185+
vectorizeCollectionName: true,
1186+
});
1187+
expect(config).toEqual<VectorConfigCreate<never, 'test', 'hnsw', 'text2vec-nvidia'>>({
1188+
name: 'test',
1189+
vectorIndex: {
1190+
name: 'hnsw',
1191+
config: undefined,
1192+
},
1193+
vectorizer: {
1194+
name: 'text2vec-nvidia',
1195+
config: {
1196+
baseURL: 'base-url',
1197+
model: 'model',
1198+
truncate: true,
1199+
vectorizeCollectionName: true,
1200+
},
1201+
},
1202+
});
1203+
});
1204+
11641205
it('should create the correct Text2VecMistralConfig type with defaults', () => {
11651206
const config = configure.vectorizer.text2VecMistral();
11661207
expect(config).toEqual<VectorConfigCreate<never, undefined, 'hnsw', 'text2vec-mistral'>>({

src/collections/configure/vectorizer.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,19 @@ export const vectorizer = {
518518
},
519519
});
520520
},
521+
text2VecNvidia: <T, N extends string | undefined = undefined, I extends VectorIndexType = 'hnsw'>(
522+
opts?: ConfigureTextVectorizerOptions<T, N, I, 'text2vec-nvidia'>
523+
): VectorConfigCreate<PrimitiveKeys<T>, N, I, 'text2vec-nvidia'> => {
524+
const { name, sourceProperties, vectorIndexConfig, ...config } = opts || {};
525+
return makeVectorizer(name, {
526+
sourceProperties,
527+
vectorIndexConfig,
528+
vectorizerConfig: {
529+
name: 'text2vec-nvidia',
530+
config: Object.keys(config).length === 0 ? undefined : config,
531+
},
532+
});
533+
},
521534
/**
522535
* Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-mistral'`.
523536
*

0 commit comments

Comments
 (0)