Skip to content

Commit ac3d758

Browse files
committed
Merge branch 'main' of https://github.com/weaviate/typescript-client into 1.29/colbert-multivector-support
2 parents 644a32b + c26380a commit ac3d758

File tree

19 files changed

+899
-55
lines changed

19 files changed

+899
-55
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
WEAVIATE_127: 1.27.15
1414
WEAVIATE_128: 1.28.11
1515
WEAVIATE_129: 1.29.1
16-
WEAVIATE_130: 1.30.0-rc.0-6b9a01c
16+
WEAVIATE_130: 1.30.1
1717

1818
concurrency:
1919
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

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.6.0-alpha.0",
3+
"version": "3.5.5",
44
"description": "JS/TS client for Weaviate",
55
"main": "dist/node/cjs/index.js",
66
"type": "module",

src/collections/config/types/generative.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export type GenerativeAnthropicConfig = {
2525
};
2626

2727
export type GenerativeAnyscaleConfig = {
28+
baseURL?: string;
2829
model?: string;
2930
temperature?: number;
3031
};
@@ -54,6 +55,7 @@ export type GenerativeFriendliAIConfig = {
5455
};
5556

5657
export type GenerativeMistralConfig = {
58+
baseURL?: string;
5759
maxTokens?: number;
5860
model?: string;
5961
temperature?: number;

src/collections/config/types/reranker.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export type RerankerCohereConfig = {
55
};
66

77
export type RerankerVoyageAIConfig = {
8+
baseURL?: string;
89
model?: 'rerank-lite-1' | string;
910
};
1011

@@ -18,9 +19,15 @@ export type RerankerJinaAIConfig = {
1819
| string;
1920
};
2021

22+
export type RerankerNvidiaConfig = {
23+
baseURL?: string;
24+
model?: 'nvidia/rerank-qa-mistral-4b' | string;
25+
};
26+
2127
export type RerankerConfig =
2228
| RerankerCohereConfig
2329
| RerankerJinaAIConfig
30+
| RerankerNvidiaConfig
2431
| RerankerTransformersConfig
2532
| RerankerVoyageAIConfig
2633
| Record<string, any>
@@ -29,6 +36,7 @@ export type RerankerConfig =
2936
export type Reranker =
3037
| 'reranker-cohere'
3138
| 'reranker-jinaai'
39+
| 'reranker-nvidia'
3240
| 'reranker-transformers'
3341
| 'reranker-voyageai'
3442
| 'none'
@@ -38,6 +46,8 @@ export type RerankerConfigType<R> = R extends 'reranker-cohere'
3846
? RerankerCohereConfig
3947
: R extends 'reranker-jinaai'
4048
? RerankerJinaAIConfig
49+
: R extends 'reranker-nvidia'
50+
? RerankerNvidiaConfig
4151
: R extends 'reranker-transformers'
4252
? RerankerTransformersConfig
4353
: R extends 'reranker-voyageai'

src/collections/config/types/vectorizer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,8 @@ export type Text2VecNvidiaConfig = {
390390
* See the [documentation](https://weaviate.io/developers/weaviate/model-providers/mistral/embeddings) for detailed usage.
391391
*/
392392
export type Text2VecMistralConfig = {
393+
/** The base URL to use where API requests should go. */
394+
baseURL?: string;
393395
/** The model to use. */
394396
model?: 'mistral-embed' | string;
395397
/** Whether to vectorize the collection name. */

src/collections/configure/reranker.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
ModuleConfig,
33
RerankerCohereConfig,
44
RerankerJinaAIConfig,
5+
RerankerNvidiaConfig,
56
RerankerVoyageAIConfig,
67
} from '../config/types/index.js';
78

@@ -38,6 +39,22 @@ export default {
3839
config: config,
3940
};
4041
},
42+
/**
43+
* Create a `ModuleConfig<'reranker-nvidia', RerankerNvidiaConfig>` object for use when reranking using the `reranker-nvidia` module.
44+
*
45+
* See the [documentation](https://weaviate.io/developers/weaviate/model-providers/nvidia/reranker) for detailed usage.
46+
*
47+
* @param {RerankerNvidiaConfig} [config] The configuration for the `reranker-nvidia` module.
48+
* @returns {ModuleConfig<'reranker-nvidia', RerankerNvidiaConfig | undefined>} The configuration object.
49+
*/
50+
nvidia: (
51+
config?: RerankerNvidiaConfig
52+
): ModuleConfig<'reranker-nvidia', RerankerNvidiaConfig | undefined> => {
53+
return {
54+
name: 'reranker-nvidia',
55+
config: config,
56+
};
57+
},
4158
/**
4259
* Create a `ModuleConfig<'reranker-transformers', Record<string, never>>` object for use when reranking using the `reranker-transformers` module.
4360
*

src/collections/configure/unit.test.ts

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import {
1212
GenerativeOpenAIConfig,
1313
GenerativeXAIConfig,
1414
ModuleConfig,
15+
RerankerCohereConfig,
16+
RerankerJinaAIConfig,
17+
RerankerNvidiaConfig,
18+
RerankerTransformersConfig,
19+
RerankerVoyageAIConfig,
1520
VectorConfigCreate,
1621
} from '../types/index.js';
1722
import { configure } from './index.js';
@@ -1240,6 +1245,7 @@ describe('Unit testing of the vectorizer factory class', () => {
12401245

12411246
it('should create the correct Text2VecMistralConfig type with all values', () => {
12421247
const config = configure.vectorizer.text2VecMistral({
1248+
baseURL: 'base-url',
12431249
name: 'test',
12441250
model: 'model',
12451251
vectorizeCollectionName: true,
@@ -1253,6 +1259,7 @@ describe('Unit testing of the vectorizer factory class', () => {
12531259
vectorizer: {
12541260
name: 'text2vec-mistral',
12551261
config: {
1262+
baseURL: 'base-url',
12561263
model: 'model',
12571264
vectorizeCollectionName: true,
12581265
},
@@ -1587,12 +1594,14 @@ describe('Unit testing of the generative factory class', () => {
15871594

15881595
it('should create the correct GenerativeAnyscaleConfig type with all values', () => {
15891596
const config = configure.generative.anyscale({
1597+
baseURL: 'base-url',
15901598
model: 'model',
15911599
temperature: 0.5,
15921600
});
15931601
expect(config).toEqual<ModuleConfig<'generative-anyscale', GenerativeAnyscaleConfig | undefined>>({
15941602
name: 'generative-anyscale',
15951603
config: {
1604+
baseURL: 'base-url',
15961605
model: 'model',
15971606
temperature: 0.5,
15981607
},
@@ -1769,13 +1778,15 @@ describe('Unit testing of the generative factory class', () => {
17691778

17701779
it('should create the correct GenerativeMistralConfig type with all values', () => {
17711780
const config = configure.generative.mistral({
1781+
baseURL: 'base-url',
17721782
maxTokens: 100,
17731783
model: 'model',
17741784
temperature: 0.5,
17751785
});
17761786
expect(config).toEqual<ModuleConfig<'generative-mistral', GenerativeMistralConfig | undefined>>({
17771787
name: 'generative-mistral',
17781788
config: {
1789+
baseURL: 'base-url',
17791790
maxTokens: 100,
17801791
model: 'model',
17811792
temperature: 0.5,
@@ -1929,3 +1940,97 @@ describe('Unit testing of the generative factory class', () => {
19291940
});
19301941
});
19311942
});
1943+
1944+
describe('Unit testing of the reranker factory class', () => {
1945+
it('should create the correct RerankerCohereConfig type using required & default values', () => {
1946+
const config = configure.reranker.cohere();
1947+
expect(config).toEqual<ModuleConfig<'reranker-cohere', RerankerCohereConfig | undefined>>({
1948+
name: 'reranker-cohere',
1949+
config: undefined,
1950+
});
1951+
});
1952+
1953+
it('should create the correct RerankerCohereConfig type with all values', () => {
1954+
const config = configure.reranker.cohere({
1955+
model: 'model',
1956+
});
1957+
expect(config).toEqual<ModuleConfig<'reranker-cohere', RerankerCohereConfig | undefined>>({
1958+
name: 'reranker-cohere',
1959+
config: {
1960+
model: 'model',
1961+
},
1962+
});
1963+
});
1964+
1965+
it('should create the correct RerankerJinaAIConfig type using required & default values', () => {
1966+
const config = configure.reranker.jinaai();
1967+
expect(config).toEqual<ModuleConfig<'reranker-jinaai', RerankerJinaAIConfig | undefined>>({
1968+
name: 'reranker-jinaai',
1969+
config: undefined,
1970+
});
1971+
});
1972+
1973+
it('should create the correct RerankerJinaAIConfig type with all values', () => {
1974+
const config = configure.reranker.jinaai({
1975+
model: 'model',
1976+
});
1977+
expect(config).toEqual<ModuleConfig<'reranker-jinaai', RerankerJinaAIConfig | undefined>>({
1978+
name: 'reranker-jinaai',
1979+
config: {
1980+
model: 'model',
1981+
},
1982+
});
1983+
});
1984+
1985+
it('should create the correct RerankerNvidiaConfig type with required & default values', () => {
1986+
const config = configure.reranker.nvidia();
1987+
expect(config).toEqual<ModuleConfig<'reranker-nvidia', RerankerNvidiaConfig | undefined>>({
1988+
name: 'reranker-nvidia',
1989+
config: undefined,
1990+
});
1991+
});
1992+
1993+
it('should create the correct RerankerNvidiaConfig type with all values', () => {
1994+
const config = configure.reranker.nvidia({
1995+
baseURL: 'base-url',
1996+
model: 'model',
1997+
});
1998+
expect(config).toEqual<ModuleConfig<'reranker-nvidia', RerankerNvidiaConfig | undefined>>({
1999+
name: 'reranker-nvidia',
2000+
config: {
2001+
baseURL: 'base-url',
2002+
model: 'model',
2003+
},
2004+
});
2005+
});
2006+
2007+
it('should create the correct RerankerTransformersConfig type using required & default values', () => {
2008+
const config = configure.reranker.transformers();
2009+
expect(config).toEqual<ModuleConfig<'reranker-transformers', RerankerTransformersConfig>>({
2010+
name: 'reranker-transformers',
2011+
config: {},
2012+
});
2013+
});
2014+
2015+
it('should create the correct RerankerVoyageAIConfig with required & default values', () => {
2016+
const config = configure.reranker.voyageAI();
2017+
expect(config).toEqual<ModuleConfig<'reranker-voyageai', RerankerVoyageAIConfig | undefined>>({
2018+
name: 'reranker-voyageai',
2019+
config: undefined,
2020+
});
2021+
});
2022+
2023+
it('should create the correct RerankerVoyageAIConfig type with all values', () => {
2024+
const config = configure.reranker.voyageAI({
2025+
baseURL: 'base-url',
2026+
model: 'model',
2027+
});
2028+
expect(config).toEqual<ModuleConfig<'reranker-voyageai', RerankerVoyageAIConfig | undefined>>({
2029+
name: 'reranker-voyageai',
2030+
config: {
2031+
baseURL: 'base-url',
2032+
model: 'model',
2033+
},
2034+
});
2035+
});
2036+
});

src/collections/types/query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export interface BaseRefProperty<T> {
143143
/** The metadata to return for the referenced objects. */
144144
returnMetadata?: QueryMetadata;
145145
/** The properties to return for the referenced objects. */
146-
returnProperties?: QueryProperty<T>[];
146+
returnProperties?: QueryProperty<ExtractCrossReferenceType<T[this['linkOn']]>>[];
147147
/** The references to return for the referenced objects. */
148148
returnReferences?: QueryReference<ExtractCrossReferenceType<T[this['linkOn']]>>[];
149149
/** The collection to target when traversing the references. Required for multi-target references. */

src/connection/grpc.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ import { InternalConnectionParams } from './http.js';
55

66
import { ConsistencyLevel } from '../data/index.js';
77

8-
import { ChannelCredentials, ChannelOptions, createChannel, createClientFactory, Metadata } from 'nice-grpc';
8+
import {
9+
ChannelCredentials,
10+
ChannelOptions,
11+
ClientError,
12+
createChannel,
13+
createClientFactory,
14+
Metadata,
15+
Status,
16+
} from 'nice-grpc';
917
import { retryMiddleware } from 'nice-grpc-client-middleware-retry';
1018

1119
import { HealthCheckResponse_ServingStatus, HealthDefinition } from '../proto/google/health/v1/health.js';
@@ -204,7 +212,18 @@ export const grpcClient = (config: GrpcConnectionParams & { grpcMaxMessageLength
204212
const controller = new AbortController();
205213
const timeoutId = setTimeout(() => controller.abort(), (config.timeout?.init || 2) * 1000);
206214
return health
207-
.check({ service: '/grpc.health.v1.Health/Check' }, { signal: controller.signal })
215+
.check(
216+
{ service: '/grpc.health.v1.Health/Check' },
217+
{
218+
signal: controller.signal,
219+
retry: true,
220+
retryMaxAttempts: 1,
221+
retryableStatuses: [Status.UNAVAILABLE],
222+
onRetryableError(error: ClientError, attempt: number, delayMs: number) {
223+
console.warn(error, `Healthcheck ${attempt} failed. Retrying in ${delayMs}ms.`);
224+
},
225+
}
226+
)
208227
.then((res) => res.status === HealthCheckResponse_ServingStatus.SERVING)
209228
.catch((err) => {
210229
if (isAbortError(err)) {

0 commit comments

Comments
 (0)