Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Oracle document store classes #38

Closed
wants to merge 1 commit into from
Closed

Conversation

hackerdave
Copy link
Collaborator

Issue

Closes #

Change

Add Oracle document store classes

General checklist

  • There are no breaking changes
  • [ x] I have added unit and integration tests for my change
  • [ x] I have manually run all the unit and integration tests in the module I have added/changed, and they are all green
  • I have manually run all the unit and integration tests in the core and main modules, and they are all green

Checklist for adding new maven module

  • [x ] I have added my new module in the root pom.xml and langchain4j-bom/pom.xml

Checklist for adding new embedding store integration

  • I have added a {NameOfIntegration}EmbeddingStoreIT that extends from either EmbeddingStoreIT or EmbeddingStoreWithFilteringIT
  • I have added a {NameOfIntegration}EmbeddingStoreRemovalIT that extends from EmbeddingStoreWithRemovalIT

Checklist for changing existing embedding store integration

  • I have manually verified that the {NameOfIntegration}EmbeddingStore works correctly with the data persisted using the latest released version of LangChain4j

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions could not be made:

  • langchain4j-core/src/test/java/dev/langchain4j/store/embedding/filter/comparison/IsNotEqualToTest.java
    • lines 9-10
    • lines 31-32
    • lines 44-44
    • lines 53-53
    • lines 61-61
    • lines 69-69

void testFile() {
String pref = "{\"file\": \"" + dotenv.get("DEMO_DS_PDF_FILE") + "\"}";
List<Document> docs = loader.loadDocuments(pref);
assertThat(docs.size()).isEqualTo(1);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assertThat(docs.size()).isEqualTo(1);
assertThat(docs).hasSize(1);

textSegments.add(TextSegment.from("goodbye world"));
textSegments.add(TextSegment.from("1,2,3"));
Response<List<Embedding>> resp3 = embedder.embedAll(textSegments);
assertThat(resp3.content().size()).isEqualTo(3);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assertThat(resp3.content().size()).isEqualTo(3);
assertThat(resp3.content()).hasSize(3);

textSegments.add(TextSegment.from("goodbye world"));
textSegments.add(TextSegment.from("1,2,3"));
Response<List<Embedding>> resp3 = embedder.embedAll(textSegments);
assertThat(resp3.content().size()).isEqualTo(3);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assertThat(resp3.content().size()).isEqualTo(3);
assertThat(resp3.content()).hasSize(3);


documents.addAll(loadDocuments(owner, table, column, pref));
} else {
throw new RuntimeException("Invalid preference");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add more information in here, and it's probably more a InvalidParameterException: https://docs.oracle.com/javase/8/docs/api/java/security/InvalidParameterException.html

throw new RuntimeException("Invalid preference");
}
} catch (IOException | RuntimeException ex) {
String message = ex.getCause() != null ? ex.getCause().getMessage() : ex.getMessage();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to catch the RuntimeException, and I think we should re-throw the exception if we can't recover from the IOException: https://www.baeldung.com/java-exceptions

Copy link
Owner

@psilberk psilberk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good. But please take a look at the comments for exception handling. I think it can be applied in other parts of the code.

@hackerdave hackerdave closed this Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants