Skip to content

Devcrocod/langchain4j #476

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

Merged
merged 4 commits into from
Apr 19, 2025
Merged

Devcrocod/langchain4j #476

merged 4 commits into from
Apr 19, 2025

Conversation

devcrocod
Copy link
Contributor

Description

add langchain4j descriptor
parameter model defines a specific dependency:

%use langchain4j(model = "anthropic")

Type of change

  • Adding a new library descriptor
  • Fixing an error in an existing descriptor
  • Updating an outdated descriptor
  • Updating the library version

Checklist for new descriptors (remove if not applicable):

  • Description and link — Ensure that the description field accurately describes the library and that the link points to the current repository.
  • Properties — The properties field contains all versions of Maven dependecies used in the dependencies section.
  • Dependencies — The dependencies listed in the dependencies section use version variables correctly.
  • Renders (if applicable) — If the library includes classes for visualization, the renderers section has appropriate rendering rules.
  • Testing — Ensure that the descriptor works correctly in a Kotlin notebook.

Please note that we reserve the right to decline PRs that add new library descriptors base on considerations of quality, stability, or long-term support.

@devcrocod devcrocod requested a review from ileasile April 11, 2025 16:50
langchain4j.json Outdated
],
"link": "https://github.com/langchain4j/langchain4j",
"init": [
"when (\"$model\") {\n\"bedrock\" -> USE { dependencies(\"dev.langchain4j:langchain4j-bedrock:$v\") }\n\"anthropic\" -> USE { dependencies(\"dev.langchain4j:langchain4j-anthropic:$v\") }\n\"azure\" -> USE { dependencies(\"dev.langchain4j:langchain4j-azure-open-ai:$v\") }\n\"googleai\" -> USE { dependencies(\"dev.langchain4j:langchain4j-google-ai-gemini:$v\") }\n\"vertexai\" -> USE { dependencies(\"dev.langchain4j:langchain4j-vertex-ai-gemini:$v\") }\n\"huggingface\" -> USE { dependencies(\"dev.langchain4j:langchain4j-hugging-face:$v\") }\n\"ollama\" -> USE { dependencies(\"dev.langchain4j:langchain4j-ollama:$v\") }\n\"openai\" -> USE { dependencies(\"dev.langchain4j:langchain4j-open-ai:$v\") }\n\"openaiofficial\" -> USE { dependencies(\"dev.langchain4j:langchain4j-open-ai-official:$v\") }\nelse -> error(\"Not recognized dependency '$model'. Use follow models: `bedrock`, `anthropic`, `azure`, `googleai`, `vertexai`, `huggingface`, `ollama`, `openai`, `openaiofficial`\")\n}\nUSE { import(\"dev.langchain4j.model.$model.*\") }"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably define a map?

val modelToArtifact = mapOf ("bedrock" to "bedrock", "openaiofficial" to "open-ai-official", ...)

In this case there'll be just one USE call.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But even better to maintain these models in a separate integration library

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean creating a separate descriptor for each artifact?

I’d prefer not to do that, as it would significantly increase the number of descriptors

Copy link
Collaborator

@ileasile ileasile Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I mean putting this logic into an artifact (a single one). It could be placed in our internal maven repo. In this case you may add tests for the integration, add additional features easily and so on, so it's a more reliable approach. Descriptor then will stay the same but without this init code.

Integration classes accept options:
https://github.com/Kotlin/dataframe/blob/79900825169933d8b644c709a3d6601a29bf9fa6/dataframe-jupyter/src/main/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/Integration.kt#L64
So you may access model name from there.

Lets-plot integration underwent the same transformation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I understand.
Nevertheless, I’m not going to do it))

Unfortunately, at the moment I can’t guarantee long-term support for langchain4j, so I don’t think it’s worth creating a new entity, even if it simplifies integration with jupyter. However, if a stable version is released and Kotlin support becomes reliable, then we can easily add such an artifact — and the descriptor for users will remain the same

@ileasile ileasile merged commit 0d588e7 into master Apr 19, 2025
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.

2 participants