HamaWhiteGG / langchain-java

Java version of LangChain, while empowering LLM for Big Data.
Apache License 2.0
545 stars 106 forks source link

why use JDK17? #65

Closed wangmiao-1981 closed 9 months ago

wangmiao-1981 commented 1 year ago

Many enterprises are currently using JDK 8 in their production scenarios.

Using a higher version of JDK may limit the usage scenarios.

I suggest downgrading to JDK 8.

HamaWhiteGG commented 1 year ago

JDK 17 provides many new syntax features, especially the text blocks functionality. I use it to write prompts; otherwise, Java 8 string concatenation would be a nightmare for me.

image
wangmiao-1981 commented 1 year ago

I think that in many enterprise scenarios, JDK8 still holds a significant share. As I work on banking systems, I consider that the main systems in this field are JDK8-based. If langchain-java can maintain compatibility with JDK8, it would be easier to gain practical application scenarios.

u can try this prompt, it works well for me.

    role: "system",
    content: `

You are a senior JAVA engineer who is very familiar with the syntax differences between JDK17 and JDK8, and can proficiently convert code between the two. Please convert the following JDK17 code into JDK8 code. Do not provide suggestions, just convert the code. Remember to enclose the converted code in a code block with the md format. In handling multi-line strings, preserve the original formatting: `

image

image

HamaWhiteGG commented 1 year ago

I appreciate your suggestion, but I have decided to stick with JDK 17 because I value the future more.

scorego commented 1 year ago

You can integrate Scala with Java 8.

val speech = """Four score and
               |seven years ago""".stripMargin

https://www.oreilly.com/library/view/scala-cookbook/9781449340292/ch01s03.html

leonaemsears commented 11 months ago

Many enterprises are currently using JDK 8 in their production scenarios.

Using a higher version of JDK may limit the usage scenarios.

I suggest downgrading to JDK 8.

Hi, Did you manage to get the code working with JDK8 ? if so what changes did you make to have it build.

wangmiao-1981 commented 11 months ago

Yes, I am using this project under JDK8, with the main modifications focusing on JDK17's strings and a few features.

My approach is to directly compile this project with JDK8, and use GPT to resolve any errors that arise.

my prompt is : You are a senior JAVA engineer who is very familiar with the syntax differences between JDK17 and JDK8, and can proficiently convert code between the two. Please convert the following JDK17 code into JDK8 code. Do not provide suggestions, just convert the code. Remember to enclose the converted code in a code block with the md format. In handling multi-line strings, preserve the original formatting:

It works well for me.

For more details, you can refer to my previous email.

2023年10月2日 21:37,leonaemsears @.***> 写道:

Many enterprises are currently using JDK 8 in their production scenarios.

Using a higher version of JDK may limit the usage scenarios.

I suggest downgrading to JDK 8.

Hi, Did you manage to get the code working with JDK8 ? if so what changes did you make to have it build.

— Reply to this email directly, view it on GitHub https://github.com/HamaWhiteGG/langchain-java/issues/65#issuecomment-1743034056, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWRVRPCVYIBLZXVTBRLPWFTX5K7TLAVCNFSM6AAAAAA3CZCKMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBTGAZTIMBVGY. You are receiving this because you authored the thread.

HamaWhiteGG commented 11 months ago

Yes, I am using this project under JDK8, with the main modifications focusing on JDK17's strings and a few features. My approach is to directly compile this project with JDK8, and use GPT to resolve any errors that arise. my prompt is : You are a senior JAVA engineer who is very familiar with the syntax differences between JDK17 and JDK8, and can proficiently convert code between the two. Please convert the following JDK17 code into JDK8 code. Do not provide suggestions, just convert the code. Remember to enclose the converted code in a code block with the md format. In handling multi-line strings, preserve the original formatting: It works well for me. For more details, you can refer to my previous email. 2023年10月2日 21:37,leonaemsears @.***> 写道: Many enterprises are currently using JDK 8 in their production scenarios. Using a higher version of JDK may limit the usage scenarios. I suggest downgrading to JDK 8. Hi, Did you manage to get the code working with JDK8 ? if so what changes did you make to have it build. — Reply to this email directly, view it on GitHub <#65 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWRVRPCVYIBLZXVTBRLPWFTX5K7TLAVCNFSM6AAAAAA3CZCKMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBTGAZTIMBVGY. You are receiving this because you authored the thread.

Good prompt,Great Job!

HamaWhiteGG commented 11 months ago

@wangmiao-1981 I've created a JDK8 branch to support Java 8. Would you be willing to contribute your code? Let's learn and work together.

Currently, @Jashinck is contributing to the JDK8 branch, but it's still in progress. We can maintain Java 8 together.

https://github.com/HamaWhiteGG/langchain-java/tree/jdk8