Skip to content

Commit

Permalink
feat(vector-store-service): add support for Voy vector store and upda…
Browse files Browse the repository at this point in the history
…te middleware configuration
  • Loading branch information
dingyi222666 committed Dec 28, 2024
1 parent 16fd0d9 commit 4880cd6
Show file tree
Hide file tree
Showing 5 changed files with 468 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/vector-store-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@langchain/core": "^0.3.18",
"@langchain/redis": "^0.1.0",
"redis": "^4.7.0",
"voy-search": "^0.6.3",
"zod-to-json-schema": "3.23.5"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/vector-store-service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export const Config: Schema<Config> = Schema.intersect([
Schema.union([
Schema.const('faiss').description('Faiss'),
Schema.const('redis').description('Redis'),
Schema.const('milvus').description('Milvus')
Schema.const('milvus').description('Milvus'),
Schema.const('voy').description('Voy')
])
)
.default([])
Expand Down
5 changes: 3 additions & 2 deletions packages/vector-store-service/src/vectorstore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { Config } from '.'
// import start
import { apply as faiss } from './vectorstore/faiss'
import { apply as milvus } from './vectorstore/milvus'
import { apply as redis } from './vectorstore/redis' // import end
import { apply as redis } from './vectorstore/redis'
import { apply as voy } from './vectorstore/voy' // import end

export async function vectorStore(
ctx: Context,
Expand All @@ -19,7 +20,7 @@ export async function vectorStore(

const middlewares: VectorStore[] =
// middleware start
[faiss, milvus, redis] // middleware end
[faiss, milvus, redis, voy] // middleware end

for (const middleware of middlewares) {
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/vector-store-service/src/vectorstore/faiss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export async function apply(
logger.error(
`embeddings dimension mismatch: ${testEmbedding.length} !== ${faissStore.index.getDimension()}. Please check the embeddings.`
)
faissStore = undefined
// faissStore = undefined
}
} catch (e) {
faissStore = await FaissStore.fromTexts(
Expand Down
Loading

0 comments on commit 4880cd6

Please sign in to comment.