Skip to content

Commit 3360790

Browse files
committed
Fix projectId in generative palm, add text2vec octo configure method, update CI images
1 parent dc630b5 commit 3360790

File tree

7 files changed

+87
-12
lines changed

7 files changed

+87
-12
lines changed

.github/workflows/main.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ on:
77
pull_request:
88

99
env:
10-
WEAVIATE_124: 1.24.19
11-
WEAVIATE_125: 1.25.5
10+
WEAVIATE_124: 1.24.20
11+
WEAVIATE_125: 1.25.7
1212

1313
jobs:
1414
checks:

src/collections/config/types/generative.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export type GenerativePaLMConfig = {
5959
apiEndpoint?: string;
6060
maxOutputTokens?: number;
6161
modelId?: string;
62-
projectId: string;
62+
projectId?: string;
6363
temperature?: number;
6464
topK?: number;
6565
topP?: number;

src/collections/config/types/vectorizer.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export type Vectorizer =
2424
| 'text2vec-gpt4all'
2525
| 'text2vec-huggingface'
2626
| 'text2vec-jina'
27+
| 'text2vec-octoai'
2728
| 'text2vec-ollama'
2829
| 'text2vec-openai'
2930
| 'text2vec-palm'
@@ -254,6 +255,20 @@ export type Text2VecJinaConfig = {
254255
vectorizeCollectionName?: boolean;
255256
};
256257

258+
/**
259+
* The configuration for text vectorization using OctoAI.
260+
*
261+
* See the [documentation](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-octoai) for detailed usage.
262+
*/
263+
export type Text2VecOctoAIConfig = {
264+
/** The base URL to use where API requests should go. */
265+
baseURL?: string;
266+
/** The model to use. */
267+
model?: string;
268+
/** Whether to vectorize the collection name. */
269+
vectorizeCollectionName?: boolean;
270+
};
271+
257272
/**
258273
* The configuration for text vectorization using Ollama.
259274
*
@@ -378,6 +393,8 @@ export type VectorizerConfigType<V> = V extends 'img2vec-neural'
378393
? Text2VecHuggingFaceConfig | undefined
379394
: V extends 'text2vec-jina'
380395
? Text2VecJinaConfig | undefined
396+
: V extends 'text2vec-octoai'
397+
? Text2VecOctoAIConfig | undefined
381398
: V extends 'text2vec-ollama'
382399
? Text2VecOllamaConfig | undefined
383400
: V extends 'text2vec-openai'

src/collections/configure/generative.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,12 @@ export default {
182182
*
183183
* See the [documentation](https://weaviate.io/developers/weaviate/modules/reader-generator-modules/generative-palm) for detailed usage.
184184
*
185-
* @param {GenerativePaLMConfigCreate} config The configuration for the `generative-palm` module.
185+
* @param {GenerativePaLMConfigCreate} [config] The configuration for the `generative-palm` module.
186186
* @returns {ModuleConfig<'generative-palm', GenerativePaLMConfig>} The configuration object.
187187
*/
188-
palm: (config: GenerativePaLMConfigCreate): ModuleConfig<'generative-palm', GenerativePaLMConfig> => {
188+
palm: (
189+
config?: GenerativePaLMConfigCreate
190+
): ModuleConfig<'generative-palm', GenerativePaLMConfig | undefined> => {
189191
return {
190192
name: 'generative-palm',
191193
config,

src/collections/configure/types/vectorizer.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
Text2VecGPT4AllConfig,
1111
Text2VecHuggingFaceConfig,
1212
Text2VecJinaConfig,
13+
Text2VecOctoAIConfig,
1314
Text2VecOllamaConfig,
1415
Text2VecOpenAIConfig,
1516
Text2VecPalmConfig,
@@ -144,6 +145,8 @@ export type Text2VecHuggingFaceConfigCreate = Text2VecHuggingFaceConfig;
144145

145146
export type Text2VecJinaConfigCreate = Text2VecJinaConfig;
146147

148+
export type Text2VecOctoAIConfigCreate = Text2VecOctoAIConfig;
149+
147150
export type Text2VecOllamaConfigCreate = Text2VecOllamaConfig;
148151

149152
export type Text2VecOpenAIConfigCreate = Text2VecOpenAIConfig;
@@ -176,6 +179,8 @@ export type VectorizerConfigCreateType<V> = V extends 'img2vec-neural'
176179
? Text2VecHuggingFaceConfigCreate | undefined
177180
: V extends 'text2vec-jina'
178181
? Text2VecJinaConfigCreate | undefined
182+
: V extends 'text2vec-octoai'
183+
? Text2VecOctoAIConfigCreate | undefined
179184
: V extends 'text2vec-ollama'
180185
? Text2VecOllamaConfigCreate | undefined
181186
: V extends 'text2vec-openai'

src/collections/configure/unit.test.ts

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,45 @@ describe('Unit testing of the vectorizer factory class', () => {
801801
});
802802
});
803803

804+
it('should create the correct Text2VecOctoAIConfig type with defaults', () => {
805+
const config = configure.vectorizer.text2VecOctoAI();
806+
expect(config).toEqual<VectorConfigCreate<never, undefined, 'hnsw', 'text2vec-octoai'>>({
807+
name: undefined,
808+
vectorIndex: {
809+
name: 'hnsw',
810+
config: undefined,
811+
},
812+
vectorizer: {
813+
name: 'text2vec-octoai',
814+
config: undefined,
815+
},
816+
});
817+
});
818+
819+
it('should create the correct Text2VecOctoAIConfig type with all values', () => {
820+
const config = configure.vectorizer.text2VecOctoAI({
821+
name: 'test',
822+
baseURL: 'base-url',
823+
model: 'model',
824+
vectorizeCollectionName: true,
825+
});
826+
expect(config).toEqual<VectorConfigCreate<never, 'test', 'hnsw', 'text2vec-octoai'>>({
827+
name: 'test',
828+
vectorIndex: {
829+
name: 'hnsw',
830+
config: undefined,
831+
},
832+
vectorizer: {
833+
name: 'text2vec-octoai',
834+
config: {
835+
baseURL: 'base-url',
836+
model: 'model',
837+
vectorizeCollectionName: true,
838+
},
839+
},
840+
});
841+
});
842+
804843
it('should create the correct Text2VecOllamaConfig type with defaults', () => {
805844
const config = configure.vectorizer.text2VecOllama();
806845
expect(config).toEqual<VectorConfigCreate<never, undefined, 'hnsw', 'text2vec-ollama'>>({
@@ -1235,14 +1274,10 @@ describe('Unit testing of the generative factory class', () => {
12351274
});
12361275

12371276
it('should create the correct GenerativePaLMConfig type with required & default values', () => {
1238-
const config = configure.generative.palm({
1239-
projectId: 'project-id',
1240-
});
1241-
expect(config).toEqual<ModuleConfig<'generative-palm', GenerativePaLMConfig>>({
1277+
const config = configure.generative.palm();
1278+
expect(config).toEqual<ModuleConfig<'generative-palm', undefined>>({
12421279
name: 'generative-palm',
1243-
config: {
1244-
projectId: 'project-id',
1245-
},
1280+
config: undefined,
12461281
});
12471282
});
12481283

src/collections/configure/vectorizer.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,22 @@ export const vectorizer = {
362362
},
363363
});
364364
},
365+
/**
366+
*
367+
*/
368+
text2VecOctoAI: <T, N extends string | undefined = undefined, I extends VectorIndexType = 'hnsw'>(
369+
opts?: ConfigureTextVectorizerOptions<T, N, I, 'text2vec-octoai'>
370+
): VectorConfigCreate<PrimitiveKeys<T>, N, I, 'text2vec-octoai'> => {
371+
const { name, sourceProperties, vectorIndexConfig, ...config } = opts || {};
372+
return makeVectorizer(name, {
373+
sourceProperties,
374+
vectorIndexConfig,
375+
vectorizerConfig: {
376+
name: 'text2vec-octoai',
377+
config: Object.keys(config).length === 0 ? undefined : config,
378+
},
379+
});
380+
},
365381
/**
366382
* Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-openai'`.
367383
*

0 commit comments

Comments
 (0)