forked from langchain4j/langchain4j
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate ollama to jackson (langchain4j#1072)
## Issue Closes langchain4j#1042 ## Change Migrate Ollama module from Gson to Jackson. <img width="999" alt="image" src="https://github.com/langchain4j/langchain4j/assets/77151639/723e622a-506f-47ae-9f98-56e761ae69ed"> Note that there are three things confused me(these issues exist in original ollama module): 1. I observe that some tests with inputTokenCount Assertion (such as `assertThat(tokenUsage.inputTokenCount()).isEqualTo(35)`) failed because of the differencet count of input tokens. I don't know whether it's because Ollama's update. Now I correct it 2. `should_propagate_failure_to_handler_onError` in `Streaming{xxx}ModelIT` failed in my local because `NullPointerException` do not have any message. Is it a problem in my local environment? 3. Somtimes if I run tests **individually**, all tests will pass. But if I run them in the same time(such as using command line rather than IDE), they will failed due to some strange reasons(e.g. input token usage will be null). I think Maybe it's a network problem or `Testcontainers`'s problem. I'm not sure if these problems are due to my local environment, so if you have any suggestions or solutions, please let me know! ## General checklist <!-- Please double-check the following points and mark them like this: [X] --> - [x] There are no breaking changes - [ ] 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 - [x] I have manually run all the unit and integration tests in the [core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core) and [main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j) modules, and they are all green <!-- Before adding documentation and example(s) (below), please wait until the PR is reviewed and approved. --> - [ ] I have added/updated the [documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs) - [ ] I have added an example in the [examples repo](https://github.com/langchain4j/langchain4j-examples) (only for "big" features)
- Loading branch information
Showing
19 changed files
with
143 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
langchain4j-ollama/src/main/java/dev/langchain4j/model/ollama/ChatRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
langchain4j-ollama/src/main/java/dev/langchain4j/model/ollama/ChatResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
langchain4j-ollama/src/main/java/dev/langchain4j/model/ollama/CompletionRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
langchain4j-ollama/src/main/java/dev/langchain4j/model/ollama/CompletionResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
langchain4j-ollama/src/main/java/dev/langchain4j/model/ollama/EmbeddingRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
langchain4j-ollama/src/main/java/dev/langchain4j/model/ollama/EmbeddingResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
langchain4j-ollama/src/main/java/dev/langchain4j/model/ollama/Message.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
langchain4j-ollama/src/main/java/dev/langchain4j/model/ollama/ModelsListResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
langchain4j-ollama/src/main/java/dev/langchain4j/model/ollama/OllamaModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
langchain4j-ollama/src/main/java/dev/langchain4j/model/ollama/OllamaModelCard.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
langchain4j-ollama/src/main/java/dev/langchain4j/model/ollama/OllamaModelDetails.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.