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

Java example gpt4all #253

Merged
merged 30 commits into from
Jul 24, 2023
Merged

Java example gpt4all #253

merged 30 commits into from
Jul 24, 2023

Conversation

Zevleg
Copy link
Contributor

@Zevleg Zevleg commented Jul 17, 2023

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)

Zevleg added 17 commits July 11, 2023 11:18
…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
Copy link
Contributor

@victorcrrd victorcrrd left a 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 :)

@raulraja raulraja changed the title Java exmaple gpt4all Java example gpt4all Jul 19, 2023
Copy link
Contributor

@raulraja raulraja left a 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:

  1. xef-core has no dependencies and is the base building blocks for other langs
  2. Integrations are developed in Kotlin multiplatform. For example xef-openai, xef-gpt4all with proper annotations support like @JvmInline etc.
  3. Functions like promptStreaming: Flow<String> currently declared in core if they were to be ported over to Java in that case the adapter promptStreaming: Publisher<String> lives in the xef-java module.
  4. Users that want to use something like gpt4all in Java all they have to do is bring as dependencies xef-java and xef-gpt4all. Since promptStreaming: Pubisher<String> is declared in xef-java and xef-gpt4all provides Chat model impl then they can just use the function passing in the model or in whichever this function is exposed in xef-java

examples/java/build.gradle.kts Outdated Show resolved Hide resolved
gpt4all-kotlin/build.gradle.kts Outdated Show resolved Hide resolved
java/build.gradle.kts Outdated Show resolved Hide resolved
raulraja
raulraja previously approved these changes Jul 24, 2023
Copy link
Contributor

@raulraja raulraja left a 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 !

@Zevleg Zevleg merged commit dc0aa2f into main Jul 24, 2023
@Zevleg Zevleg deleted the Java_exmaples_d_gpt4all branch July 24, 2023 17:00
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.

4 participants