-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #744 from humcqc/role_serialization
Ollama Role serialization in lower case, fix issue with Ollama 0.2.5
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
model-providers/ollama/runtime/src/main/java/io/quarkiverse/langchain4j/ollama/Role.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
21 changes: 21 additions & 0 deletions
21
...ntime/src/main/java/io/quarkiverse/langchain4j/ollama/runtime/jackson/RoleSerializer.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.quarkiverse.langchain4j.ollama.runtime.jackson; | ||
|
||
import java.io.IOException; | ||
import java.util.Locale; | ||
|
||
import com.fasterxml.jackson.core.JsonGenerator; | ||
import com.fasterxml.jackson.databind.SerializerProvider; | ||
import com.fasterxml.jackson.databind.ser.std.StdSerializer; | ||
|
||
import io.quarkiverse.langchain4j.ollama.Role; | ||
|
||
public class RoleSerializer extends StdSerializer<Role> { | ||
public RoleSerializer() { | ||
super(Role.class); | ||
} | ||
|
||
@Override | ||
public void serialize(Role role, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { | ||
jsonGenerator.writeString(role.toString().toLowerCase(Locale.ROOT)); | ||
} | ||
} |