-
Notifications
You must be signed in to change notification settings - Fork 15
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
Java example gpt4all #253
Java example gpt4all #253
Conversation
…ava_exmaples_d_web_search
…ava_exmaples_d_web_search
…-functional/xef into Java_exmaples_d_gpt4all
…ava_exmaples_d_gpt4all
…ava_exmaples_d_gpt4all # Conflicts: # examples/java/src/main/java/com/xebia/functional/xef/java/auto/BreakingNews.java # examples/java/src/main/java/com/xebia/functional/xef/java/auto/DivergentTasks.java # examples/java/src/main/java/com/xebia/functional/xef/java/auto/Markets.java # examples/java/src/main/java/com/xebia/functional/xef/java/auto/MealPlan.java # examples/java/src/main/java/com/xebia/functional/xef/java/auto/Weather.java # java/src/main/java/com/xebia/functional/xef/java/auto/AIScope.java
…ava_exmaples_d_gpt4all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments. I don't know about the use of KotlinPort
, so I will let others review that :)
examples/java/src/main/java/com/xebia/functional/xef/java/auto/gpt4all/Chat.java
Outdated
Show resolved
Hide resolved
gpt4all-kotlin/src/jvmMain/kotlin/com/xebia/functional/gpt4all/port/KotlinPort.kt
Outdated
Show resolved
Hide resolved
java/src/main/java/com/xebia/functional/xef/java/auto/AIScope.java
Outdated
Show resolved
Hide resolved
gpt4all-kotlin/src/jvmMain/kotlin/com/xebia/functional/gpt4all/port/KotlinPort.kt
Outdated
Show resolved
Hide resolved
examples/java/src/main/java/com/xebia/functional/xef/java/auto/gpt4all/Chat.java
Outdated
Show resolved
Hide resolved
examples/java/src/main/java/com/xebia/functional/xef/java/auto/gpt4all/Chat.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments regarding dependencies we need to agree on before merging this.
We need to all get on the same page about what role each module serves and how dependencies between modules should be organized.
In my understanding, the goals when it comes to implementing something like this are:
xef-core
has no dependencies and is the base building blocks for other langs- Integrations are developed in Kotlin multiplatform. For example
xef-openai
,xef-gpt4all
with proper annotations support like @JvmInline etc. - Functions like
promptStreaming: Flow<String>
currently declared in core if they were to be ported over to Java in that case the adapterpromptStreaming: Publisher<String>
lives in thexef-java
module. - Users that want to use something like
gpt4all
in Java all they have to do is bring as dependenciesxef-java
andxef-gpt4all
. SincepromptStreaming: Pubisher<String>
is declared inxef-java
andxef-gpt4all
providesChat
model impl then they can just use the function passing in the model or in whichever this function is exposed inxef-java
examples/java/src/main/java/com/xebia/functional/xef/java/auto/gpt4all/Chat.java
Outdated
Show resolved
Hide resolved
examples/java/src/main/java/com/xebia/functional/xef/java/auto/gpt4all/Chat.java
Outdated
Show resolved
Hide resolved
gpt4all-kotlin/src/jvmMain/kotlin/com/xebia/functional/gpt4all/port/KotlinPort.kt
Outdated
Show resolved
Hide resolved
java/src/main/java/com/xebia/functional/xef/java/auto/AIScope.java
Outdated
Show resolved
Hide resolved
…ava_exmaples_d_gpt4all
…ava_exmaples_d_gpt4all # Conflicts: # java/src/main/java/com/xebia/functional/xef/java/auto/AIScope.java
examples/java/src/main/java/com/xebia/functional/xef/java/auto/gpt4all/Chat.java
Outdated
Show resolved
Hide resolved
…ava_exmaples_d_gpt4all
…ava_exmaples_d_gpt4all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending fix for conversationId
, looks great @Zevleg !
I haven't could implement the use of Flow in Java, it seems that Java doesn't support .onCompletion and you have to send a FlowCollector and a Continuation to use .collect(), so because of that I implemented a kotlinPort to use Flow in kotlin and getting the answer in Java.
Ticket Java Example (GPT4ALL)