feat: Add Azure AI Search vector store support for TypeScript SDK#3549
Conversation
- Implement AzureAISearch class with full VectorStore interface - Support hybrid search combining vector and text search - Support compression (scalar and binary quantization) - Support float16 for reduced memory footprint - Support vector filtering with OData expressions - Add Azure Search Documents SDK dependency (@azure/search-documents) - Add Azure Identity SDK for authentication (@azure/identity) - Create example file demonstrating usage - Add comprehensive inline documentation Features: - Vector search with configurable dimensions - Hybrid search (vector + text) - Compression (scalar/binary quantization) - Float16 support - Filter expressions (OData) - Vector filter mode (preFilter/postFilter) - Full CRUD operations (insert, search, get, update, delete) - Index management (create, delete, list, reset) - Authentication (API key + DefaultAzureCredential) Closes mem0ai#1119
|
Hey @G26karthik thanks for adding this. Will review it! |
Thanks @parshvadaftari |
| @@ -0,0 +1,646 @@ | |||
| import { | |||
There was a problem hiding this comment.
You'll need to add these new changes in the mem0-ts/src/oss/src/utils/factory.ts. else no one will be able to use it and will also give rise to new errors.
- Import AzureAISearch class in factory.ts - Add 'azure-ai-search' case to VectorStoreFactory.create() - Enables users to use Azure AI Search vector store in TypeScript SDK - Addresses maintainer review feedback
- Fix Anthropic SDK type error in generateResponse method - Format all files with Prettier to resolve style issues - Add Azure AI Search integration to VectorStoreFactory - Ensure successful TypeScript compilation and DTS generation
…delines - Add comprehensive tests for VectorStoreFactory.create() method - Include Azure AI Search in vector store examples index - Fix Anthropic SDK type error for proper content block handling - Ensure all code follows Prettier formatting standards - Verify TypeScript compilation and DTS generation - Add documentation through example integration Tests added: - Factory instantiation tests for Azure AI Search - Error handling for unsupported providers - Type safety validation Examples updated: - Azure AI Search included in vector-stores examples - Proper environment variable documentation Build verified: - All Prettier formatting checks pass - TypeScript compilation successful - Declaration files generated correctly
|
@parshvadaftari - Changes implemented! ✅ Thank you for the feedback! I've successfully added the Azure AI Search integration to the factory as requested. Changes MadeFactory Integration✅ Added AzureAISearch import to factory.ts Complete Implementation (Following Contribution Guidelines)✅ Tests Added: Created comprehensive factory tests in factory.test.ts Additional Fixes✅ Fixed Anthropic SDK type error (content block handling) Usageconst store = VectorStoreFactory.create("azure-ai-search", {
collectionName: "memories",
serviceName: process.env.AZURE_AI_SEARCH_SERVICE_NAME,
apiKey: process.env.AZURE_AI_SEARCH_API_KEY,
embeddingModelDims: 1536
});
The Azure AI Search vector store is now fully integrated and ready for use! All tests pass and the build is clean. |
|
is this issue fixed? |
Yes |
parshvadaftari
left a comment
There was a problem hiding this comment.
Looks good to me!
|
@G26karthik Thank you for your contribution! |
This PR adds Azure AI Search as a vector store option for the TypeScript SDK, providing feature parity with the existing Python implementation.
Changes
AzureAISearchclass inmem0-ts/src/oss/src/vector_stores/azure_ai_search.ts(646 lines)@azure/search-documents(^12.0.0) and@azure/identity(^4.0.0) as peer dependenciesmem0-ts/src/oss/examples/vector-stores/azure-ai-search.tsmem0-ts/src/oss/src/index.tsqdrant.ts)Features Supported
Implementation Details
@azure/search-documents(^12.0.0) - Azure Cognitive Search client@azure/identity(^4.0.0) - Azure authenticationVectorStoreinterface with all 11 required methodsqdrant.tsas reference)Reference
mem0/vector_stores/azure_ai_search.py(397 lines) - Full feature parity achievedTesting
VectorStoreinterfacedist/oss/index.jsanddist/oss/index.mjsNote: TypeScript SDK follows integration testing pattern. Individual vector stores (qdrant, redis, supabase, pgvector) don't have dedicated unit test files - they're tested through the
Memoryclass with actual service connections.Usage Example
Configuration Options
serviceNamecollectionNameapiKeyembeddingModelDimscompressionTypeuseFloat16hybridSearchvectorFilterModeRelated Issue
Closes #1119
Notes