Skip to content

Conversation

@sobychacko
Copy link
Contributor

This commit refactors the builder pattern implementation across all VectorStore implementations to make the EmbeddingModel a required constructor parameter rather than an optional builder method. Key changes include:

  • Move embeddingModel from being a builder method to a required constructor parameter
  • Make embeddingModel final in AbstractVectorStoreBuilder
  • Remove redundant validate() methods since EmbeddingModel validation now happens in constructor
  • Update all VectorStore builder instantiations to pass EmbeddingModel in builder creation
  • Add @nullable annotations to appropriate methods in VectorStore interface

This change improves the API design by:

  1. Enforcing that EmbeddingModel is provided at builder creation time
  2. Removing the possibility of forgotten EmbeddingModel configuration
  3. Simplifying the builder implementation by moving validation to construction
  4. Making the dependency on EmbeddingModel more explicit in the API

Breaking Changes:

  • VectorStore builders must now be created with an EmbeddingModel parameter
  • The embeddingModel() builder method has been removed from all implementations

This commit refactors the builder pattern implementation across all VectorStore
implementations to make the EmbeddingModel a required constructor parameter
rather than an optional builder method. Key changes include:

- Move embeddingModel from being a builder method to a required constructor parameter
- Make embeddingModel final in AbstractVectorStoreBuilder
- Remove redundant validate() methods since EmbeddingModel validation now happens
  in constructor
- Update all VectorStore builder instantiations to pass EmbeddingModel in builder
  creation
- Add @nullable annotations to appropriate methods in VectorStore interface

This change improves the API design by:
1. Enforcing that EmbeddingModel is provided at builder creation time
2. Removing the possibility of forgotten EmbeddingModel configuration
3. Simplifying the builder implementation by moving validation to construction
4. Making the dependency on EmbeddingModel more explicit in the API

Breaking Changes:
- VectorStore builders must now be created with an EmbeddingModel parameter
- The embeddingModel() builder method has been removed from all implementations
- Replace Document.getContent() with getText() across all vector store implementations
- Fix incorrect package declarations in package-info.java files
- Make builder constructors private and implement proper builder patterns
- Add @nullable annotations for better null safety
- Simplify PineconeVectorStore builder API by requiring essential parameters in factory method
- Make static Map fields final
- Clean up code and improve JavaDoc documentation

The changes focus on making the vector store APIs more consistent,
type-safe, and maintainable while following best practices for
builder patterns and null safety.
@markpollack markpollack self-assigned this Dec 20, 2024
@markpollack
Copy link
Member

merged in 1a6e79c

@markpollack markpollack added this to the 1.0.0-M5 milestone Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants