forkhroy / prvt-langchain4j

0 stars 0 forks source link

langchain4j-oracle/src/main/java/dev/langchain4j/model/oracle/OracleEmbeddingModel.java #3

Open forkhroy opened 1 month ago

forkhroy commented 1 month ago
  1. We need to provide an another method to load an onnx model to db from a local directory, not from a db directory.
  2. I see 'embedAll' and 'embedTexts', both handle plural cases, any function for a single case, e.g query text?
  3. Also, why the class name has 'Model' at the end, e.g. 'OracleEmbeddingModel'?
hackerdave commented 3 weeks ago
  1. I think load_onnx_model only accepts from a DB directory alias?

We could internally create a DB directory alias to load from any path but I believe the path would have to be on the server

  1. We extend from DimensionAwareEmbeddingModel so we just need to define embedAll. In the test there is a singular version which then calls embedAll.

    Response<Embedding> resp = embedder.embed("hello world");
    assertThat(resp.content().dimension()).isGreaterThan(1);
    
    TextSegment segment = TextSegment.from("hello world");
    Response<Embedding> resp2 = embedder.embed(segment);
    assertThat(resp2.content().dimension()).isGreaterThan(1);
    
    List<TextSegment> textSegments = new ArrayList<>();
    textSegments.add(TextSegment.from("hello world"));
    textSegments.add(TextSegment.from("goodbye world"));
    textSegments.add(TextSegment.from("1,2,3"));
    Response<List<Embedding>> resp3 = embedder.embedAll(textSegments);
  2. This is their naming convention to end in EmbeddingModel like LanguageModel

https://github.com/langchain4j/langchain4j/blob/main/langchain4j-ollama/src/main/java/dev/langchain4j/model/ollama/OllamaEmbeddingModel.java