Commit Graph

326 Commits

Author SHA1 Message Date
LangChain4j ab838417ba adding arm64 arch to the build 2023-12-23 21:57:39 +01:00
LangChain4j 757e27bf15 adding arm64 arch to the build 2023-12-23 21:49:08 +01:00
LangChain4j 7c7f6eccf6 adding arm64 arch to the build 2023-12-23 21:43:01 +01:00
LangChain4j 2d85024923
Pre-built ollama models (#419) 2023-12-23 18:48:24 +01:00
LangChain4j 95dee85bbb added links to the examples 2023-12-23 04:29:11 +01:00
LangChain4j b7a8f2dc64 updated news 2023-12-22 18:56:08 +01:00
LangChain4j 7e5e82b7b2 updated to 0.26.0-SNAPSHOT 2023-12-22 18:08:19 +01:00
LangChain4j 2a5308b794 released 0.25.0 2023-12-22 18:02:04 +01:00
LangChain4j b32518409b Weaviate: updated host in IT 2023-12-22 17:55:19 +01:00
LangChain4j 6550db969e Azure OpenAI: run ITs only when env variable is available 2023-12-22 17:54:15 +01:00
LangChain4j 11502be4a4
Fixed (#264) (#414) 2023-12-22 15:35:50 +01:00
LangChain4j d64f02fe24
Metadata: deprecated potentially confusing add/from/metadata(String, Object) methods (#413) 2023-12-22 15:15:32 +01:00
LangChain4j 0d5da6ef92
385 Metadata takes ownership of its construction Map<String, String> (#412) 2023-12-22 14:49:53 +01:00
LangChain4j b04a502a1d
Replace Mustache templates with simple implementation to reduce transitive dependencies (#408)
One can provide their own prompt template implementation via SPI if
needed.
2023-12-22 14:24:00 +01:00
LangChain4j b51f5f99da
fixed pinecone client CVEs (#409) 2023-12-22 14:02:40 +01:00
shalk(xiao kun) 28b28825f4
fix pinecone QueryRequest usage, upgrade from 0.2.1 to 0.6.0 (#406)
when i test langchain4j-pinecone, the pinecone server respone error Info
```
 The 'queries' parameter has been deprecated.
```
ref to
[this](https://community.pinecone.io/t/invalid-argument-the-queries-parameter-has-been-deprecated-java/3719)
, then i fixed it.
2023-12-22 13:26:47 +01:00
Julien Dubois f4d87e2e5a
Add support for the 3 authentication methods to Azure OpenAI (#375)
- Using a key to Azure OpenAI
- Using a key to non-Azure OpenAI
- Using Azure Active Directory to connect to Azure OpenAI
2023-12-22 13:20:20 +01:00
LangChain4j 9cf5826fc2
rename langchain4j-graal module (#405) 2023-12-22 13:11:57 +01:00
LangChain4j f185438d10
Support Google Vertex AI Gemini (#402)
This PR adds a basic support of Gemini (text).
Next time images and tools will be added.

---------

Co-authored-by: kuraleta <digital.kuraleta@gmail.com>
2023-12-22 10:19:52 +01:00
LangChain4j 6ca2790e53
OpenAI: added missing parameters (logit_bias, response_format, seed, user) (#374) 2023-12-21 12:20:45 +01:00
LangChain4j 7181633dcc
Ollama: add OllamaStreamingChatModel, "format" (json) and other parameters (#373)
- added `OllamaStreamingChatModel`
- added `format` parameter to all models, now can get valid JSON with
`format="json"`
- added `top_k`, `top_p`, `repeat_penalty`, `seed`, `num_predict`,
`stop` paramerters to all models
2023-12-21 12:14:11 +01:00
LangChain4j 798a4742ac
Removed Spring Boot starters (#361)
They are moved to a separate repo: https://github.com/langchain4j/langchain4j-spring
2023-12-21 09:31:37 +01:00
LangChain4j 08f0e69986 disabled expensive test 2023-12-20 18:23:21 +01:00
Julien Dubois d821ffa185
Azure OpenAI: add tests for GPT 4 (#371)
For the Chat API, we currently on do integration tests on GPT 3.5 Turbo,
this adds tests with GPT 4 as well.
2023-12-20 12:29:18 +01:00
Julien Dubois 80e35bd1fd
Add support for "stop" in Azure OpenAI (#372)
Fix #273
2023-12-20 12:07:24 +01:00
LangChain4j 0c4d33ad93
#365: handle enum arguments in tools properly (#367)
Fixes https://github.com/langchain4j/langchain4j/issues/365
2023-12-19 16:10:14 +01:00
Julien Dubois 76b6f29de6
Add image generation support with Azure OpenAI (#359)
This uses the same LangChain classes as
https://github.com/langchain4j/langchain4j/pull/298 by @Heezer

- langchain4j-core/src/main/java/dev/langchain4j/data/image/Image.java
-
langchain4j-core/src/main/java/dev/langchain4j/model/image/ImageModel.java

I copy/pasted those 2 files here as #298 isn't merged yet, and my goal
is that we use the same API in the end.
2023-12-19 15:49:12 +01:00
ZYinNJU 17edd7b50c
Integration with ChatGLM (#360)
support [chatglm](https://github.com/THUDM/ChatGLM-6B), which was
mentioned in #267 .

[chatglm2](https://github.com/THUDM/ChatGLM2-6B) and
[chatglm3](https://github.com/THUDM/ChatGLM3) api are compatible with
openai, so It is enough to support chatglm.

because chatglm does not have official docker image, so I don't know how
to use `Testcontainers` to do test. (I'm not familiar with
`Testcontainers`, so for now I have to copy test from the other modules,
lol). The test will update using `Testcontainers` after I learn about it
in few days.
2023-12-19 15:09:50 +01:00
Giuseppe Villani 968bb71891
Fix Neo4jEmbeddingStoreTest error (#368)
See
https://github.com/langchain4j/langchain4j/actions/runs/7259989386/job/19778223144


Changed to `MATCH (n:%s) RETURN n ORDER BY n.text` to make tests more
deterministic,
since rarely the sorting of "MATCH (n:%s) RETURN n" is not based on the
order of arrival of the `embeddingModel.embed(..)`.
2023-12-19 15:03:05 +01:00
LangChain4j b5c90c07e1
Removed generic AiMessage ctor (#370)
Removed generic AiMessage ctor to make it clear in which states
`AiMessage` can be (it can contain either `text` OR
`toolExecutionRequests`, but not both at the same time)
2023-12-19 13:18:48 +01:00
LangChain4j e1dddb33a2
bumped version to 0.25.0-SNAPSHOT (#369) 2023-12-19 13:03:48 +01:00
Alexey Titov cf4f2da604
OpenAI DALL·E support (#298)
Motivating generated picture 😄 ❤️ 

![image](https://github.com/langchain4j/langchain4j/assets/33568148/5f5463f0-8d43-47a3-8127-146340871132)
2023-12-19 11:37:11 +01:00
Fintan MacMahon 38049a197b
feat: add OllamaChatModel and its corresponding integration test (#323)
A new implementation of ChatLanguageModel, OllamaChatModel, is added to
handle interactions with the Ollama AI and has an associated integration
test. This includes necessary configurations and methods for message
generation. This increases the project's modularity and provides a more
convenient and encapsulated way of interfacing with the Ollama AI.
2023-12-18 18:11:32 +01:00
Giuseppe Villani c35a4e22ea
Fixes #241: Added support for Neo4j Vector Index (#282)
Fixes #241: Added support for Neo4j Vector Index

This commit brings support for Neo4j graph database in general, and uses
the vector index functionality, generally available since version 5.13.

Mostly aligned with the existing WeaviateEmbeddingStoreImpl
implementation and tests.
The tests have some additional Neo4j node assertion to check that the
nodes involved are correctly created.

The module creates indexes, i.e. `"CALL
db.index.vector.createNodeIndex(<indexName>, <label>,
<embeddingProperty>, <dimension>, <distanceType>)"`, if needed, for the
vector search .

The required configurations are:
- the Neo4j index dimension parameter
- the Neo4j Java Driver connection instance
- as an alternative to the Neo4j Java Driver, we can create a
`Neo4jEmbeddingStore.builder().withBasicAuth(<url>, <username>,
<password>)`, which will create a Driver connection instance under the
hood

It is possible to customize, via the builder:
- the index name (with default `langchain-embedding-index`)
- the Neo4j node label  (with default `Document`)
- the Neo4j property key which save the embeddings (with default
`embeddingProp`)
- the Neo4j index distanceType parameter
- the metadata prefix (with default `metadata.`)
- the text property key (with default `text`), which store the text
field of the `TextSegment.java`


Created an example PR as well, on `langchain4j-examples` repo:
https://github.com/langchain4j/langchain4j-examples/pull/23
2023-12-18 18:04:05 +01:00
Eric Deandrea c2ab781adb
Allow for specifying the organization id in the configuration (#364)
Allow the organizationId to be specified in the configuration. See
https://platform.openai.com/docs/api-reference/organization-optional

Right now there is no way to specify this.

I added a `.organizationId(System.getenv("OPENAI_ORGANIZATION_ID"))` to
the builders in a bunch of the tests. They should have no effect other
than if you want to run the tests to pass an organizationId, you can
just set the `OPENAI_ORGANIZATION_ID` environment variable. The
`OpenAiClient` won't do anything if the `organizationId` is `null`.

Happy for questions/comments.

Fixes #344
2023-12-18 16:54:46 +01:00
LangChain4j 3731f3326f
Extract document loaders and parsers into separate modules (#354)
- extract PDF, POI document parsers into separate modules
- extract and simplify S3 document loader into a separate module
2023-12-18 16:32:22 +01:00
LangChain4j 99faffe72e temporarily adding missing util method 2023-12-18 10:15:15 +01:00
LangChain4j b8f33aae67 Revert "excluded neo4j module from java 8 and 11 builds"
This reverts commit f5039b6eea.
2023-12-18 10:08:50 +01:00
LangChain4j f5039b6eea
excluded neo4j module from java 8 and 11 builds 2023-12-18 09:31:10 +01:00
Julien Dubois 52fdbaf6df
Update GitHub Actions versions (#357)
In the GitHub Actions workflow:

- Update actions/checkout to the latest version
- Update actions/setup-java to the latest version (Java 21 already works
but is undocumented, the next version it will be thanks to
https://github.com/actions/setup-java/pull/538 😀)
2023-12-15 15:24:22 +01:00
Julien Dubois 55a36c9f00
Migrate to the new Azure OpenAI 1.0.0-beta.6 SDK (#356)
Azure OpenAI 1.0.0-beta.6 is out:

- [x] Update to the new SDK
- [x] Add unit tests
- [x] Do integration tests on my account (as I have access to Azure
OpenAI)
2023-12-15 11:05:09 +01:00
Georgios Andrianakis b7b4c5389b
Remove quarkus module (#345)
This module is confusing people as its intent is not reflected by its
name.
Moreover, this module is simply a copy of the previous version of the
Azure OpenAI stuff that I will just copy in
quarkus-langchain4j-azure-openai
2023-12-14 16:48:02 +01:00
deep-learning-dynamo 3882133f6e moved EmbeddingStoreIngestor from langchain4j to langchain4j-core (#285) 2023-12-14 16:33:02 +01:00
deep-learning-dynamo 5971718145 formatting 2023-12-14 16:06:15 +01:00
deep-learning-dynamo 23cfb07597 improve InMemoryEmbeddingStore: refactor, reduce test duplication, optimized addAll 2023-12-14 16:05:46 +01:00
deep-learning-dynamo 42d5ef9c9e fix the thread safety issue in InMemoryEmbeddingStore. (#351): making sure it deserializes into thread safe list 2023-12-14 15:41:07 +01:00
lexluo09 f1575a9a65
fix the thread safety issue in InMemoryEmbeddingStore. (#351)
fix the thread safety issue in InMemoryEmbeddingStore.

Log and Stack trace:
```
java.util.ConcurrentModificationException: null
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:911)
at java.util.ArrayList$Itr.next(ArrayList.java:861)
at dev.langchain4j.store.embedding.inmemory.InMemoryEmbeddingStore.findRelevant(InMemoryEmbeddingStore.java:122)
at dev.langchain4j.store.embedding.EmbeddingStore.findRelevant(EmbeddingStore.java:67)
```

https://github.com/langchain4j/langchain4j/issues/350
2023-12-14 15:12:29 +01:00
Julien Dubois 38abd88853
Correctly configure Maven wrapper (#348)
Maven wrapper is currently having 2 issues:

- The executable doesn't have the executable bit
- The `.mvn` directory is ignored in Git

Fixing those allow to do `./mvnw package` directly in Codespaces.
2023-12-13 12:48:49 +01:00
Julien Dubois 7ca67e77a3
Add Dev Container support (#337)
Fix #324 

This comes with Java 21, which is not fully supported (see #335 ), but
that should eventually be solved anyway.

This will allow contributors to select "open in CodeSpaces" and work
more easily on the project, like here:

![Screenshot 2023-12-08 at 13 11
43](https://github.com/langchain4j/langchain4j/assets/316835/ecf67ec8-69f3-4b85-8e53-4d71773e6768)
![Screenshot 2023-12-08 at 13 12
35](https://github.com/langchain4j/langchain4j/assets/316835/db0fe7c8-1d1a-4ce9-96e8-7f0a5eeface1)
2023-12-12 19:36:45 +01:00
dependabot[bot] d025238cb0
Bump org.json:json from 20230618 to 20231013 in /langchain4j-cassandra (#341)
Bumps [org.json:json](https://github.com/douglascrockford/JSON-java)
from 20230618 to 20231013.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/douglascrockford/JSON-java/releases">org.json:json's
releases</a>.</em></p>
<blockquote>
<h2>20231013</h2>
<table>
<thead>
<tr>
<th>Pull Request</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/793">#793</a></td>
<td>Reverted <a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/761">#761</a></td>
</tr>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/792">#792</a></td>
<td>update the docs for release 20231013</td>
</tr>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/783">#783</a></td>
<td>optLong vs getLong inconsistencies</td>
</tr>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/782">#782</a></td>
<td>Fix XMLTest.testIndentComplicatedJsonObjectWithArrayAndWithConfig()
for Windows</td>
</tr>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/779">#779</a></td>
<td>add validity check for JSONObject constructors</td>
</tr>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/778">#778</a></td>
<td>Fix XMLTest.testIndentComplicatedJsonObjectWithArrayAndWithConfig()
for Windows</td>
</tr>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/776">#776</a></td>
<td>Update [JUnit to version 4.13.2</td>
</tr>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/774">#774</a></td>
<td>Removing unneeded synchronization</td>
</tr>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/773">#773</a></td>
<td>Add optJSONArray method to JSONObject with a default value</td>
</tr>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/772">#772</a></td>
<td>Disallow nested objects and arrays as keys in objects</td>
</tr>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/779">#779</a></td>
<td>Unit test cleanup</td>
</tr>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/769">#769</a></td>
<td>Addressed Java 17 compile warnings</td>
</tr>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/764">#764</a></td>
<td>Update CodeQL action version</td>
</tr>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/761">#761</a></td>
<td>Add module-info</td>
</tr>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/759">#759</a></td>
<td>JSON parsing should detect embedded </td>
</tr>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/753">#753</a></td>
<td>Updated new object methods</td>
</tr>
<tr>
<td><a
href="https://redirect.github.com/douglascrockford/JSON-java/issues/752">#752</a></td>
<td>Fixes possible unit test bug when compiling/testing on Windows</td>
</tr>
</tbody>
</table>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/stleary/JSON-java/blob/master/docs/RELEASES.md">org.json:json's
changelog</a>.</em></p>
<blockquote>
<p>20231013 First release with minimum Java version 1.8. Recent commits,
including fixes for CVE-2023-5072.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/douglascrockford/JSON-java/commits">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.json:json&package-manager=maven&previous-version=20230618&new-version=20231013)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/langchain4j/langchain4j/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: LangChain4j <langchain4j@gmail.com>
2023-12-12 19:22:31 +01:00