Commit Graph

470 Commits

Author SHA1 Message Date
LangChain4j e871ad0607
Merge branch 'main' into cache_openai_responses_in_integration_tests 2024-01-26 23:34:44 +01:00
Guillaume Laforge ccee079793
Update Vertex AI embedding to allow a batch size of 250 (#556) 2024-01-26 22:55:42 +01:00
Lane eb4b6f2af8
Qianfan (Baidu Wenxin ERNIE Bot) integration (#499)
Baidu ERNIE Bot big model, the most perfect model in China at present;

As far as I know, many people are currently using this model;

Because the parameters of the Wenxin model are different from those of
the chatgpt, I have added a new set of entry and exit parameters;
2024-01-26 16:32:09 +01:00
Eddú Meléndez Gonzales 669e603f7d
Update localstack version to 3.1.0 (#550)
`OpenSearchEmbeddingStoreAwsIT` uses `latest` but this is a development
tag version that was used to unblock the IT, the fix is now part of
version `3.1.0`. Also, `AmazonS3DocumentLoaderIT` uses an old version.
Let's unified and use most recent LocalStack version.
2024-01-26 16:30:20 +01:00
LangChain4j 3e6a0d559b
Cohere Rerank integration (#539)
Integrating [Cohere Rerank
API](https://docs.cohere.com/docs/rerank-guide) as a `ScoringModel`
2024-01-26 16:30:00 +01:00
LangChain4j 14fb985de0
Foundation for advanced RAG (#538)
So far, LangChain4j had only a simple (a.k.a., naive) RAG
implementation: a single `Retriever` was invoked on each interaction
with the LLM, and all retrieved `TextSegments` were appended to the end
of the `UserMessage`. This approach was very limiting.

This PR introduces support for much more advanced RAG use cases. The
design and mental model are inspired by [this
article](https://blog.langchain.dev/deconstructing-rag/) and [this
paper](https://arxiv.org/abs/2312.10997), making it advisable to read
the article.

This PR introduces a `RetrievalAugmentor` interface responsible for
augmenting a `UserMessage` with relevant content before sending it to
the LLM. The `RetrievalAugmentor` can be used with both `AiServices` and
`ConversationalRetrievalChain`, as well as stand-alone.

A default implementation of `RetrievalAugmentor`
(`DefaultRetrievalAugmentor`) is provided with the library and is
suggested as a good starting point. However, users are not limited to it
and can have more freedom with their own custom implementations.

`DefaultRetrievalAugmentor` decomposes the entire RAG flow into more
granular steps and base components:
- `QueryTransformer`
- `QueryRouter`
- `ContentRetriever` (the old `Retriever` is now deprecated)
- `ContentAggregator`
- `ContentInjector`

This modular design aims to separate concerns and simplify development,
testing, and evaluation. Most (if not all) currently known and proven
RAG techniques can be represented as one or multiple base components
listed above.

Here is how the decomposed RAG flow can be visualized:

![advanced-rag](https://github.com/langchain4j/langchain4j/assets/132277850/b699077d-dabf-4768-a241-3fcd9ab0286c)

This mental and software model aims to simplify the thinking, reasoning,
and implementation of advanced RAG flows.

Each base component listed above has a sensible and simple default
implementation configured in `DefaultRetrievalAugmentor` by default but
can be overridden by more sophisticated implementations (provided by the
library out-of-the-box) as well as custom ones. The list of
implementations is expected to grow over time as we discover new
techniques and implement existing proven ones.

This PR also introduces out-of-the-box support for the following proven
RAG techniques:
- Query expansion
- Query compression
- Query routing using LLM
- [Reciprocal Rank
Fusion](https://learn.microsoft.com/en-us/azure/search/hybrid-search-ranking)
- Re-ranking ([Cohere Rerank](https://docs.cohere.com/docs/reranking)
integration is coming in a [separate
PR](https://github.com/langchain4j/langchain4j/pull/539)).
2024-01-26 16:25:24 +01:00
jiangsier-xyz 5980f67150
Add Qwen multi-modal models implementation (#537)
1. Add Qwen multi-modal models implementation, support for image and
text information.

Example of key input fragment:
```json
"messages": [
    {
        "role": "user",
        "content": [
            {"image": "https://dashscope.oss-cn-beijing.aliyuncs.com/images/dog_and_girl.jpeg"},
            {"text": "What animal is in the picture?"}
        ]
    }
]
```

Example of key output fragment:
```json
"output": {
    "choices": [
        {
            "finish_reason": null,
            "message": {
                "role": "assistant",
                "content": [
                    {
                        "text": "The picture shows a dog sitting on the beach with its owner."
                    }
                ]
            }
        }
    ]
}
```

Note: The dashscope sdk supports local file URL starting with file://...

2. Add new optional parameters: baseUrl, maxTokens
2024-01-26 16:09:49 +01:00
dependabot[bot] e2c3442d32
Bump com.google.guava:guava from 30.1-jre to 32.0.0-jre in /langchain4j-qdrant (#547)
Bumps [com.google.guava:guava](https://github.com/google/guava) from
30.1-jre to 32.0.0-jre.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/google/guava/releases">com.google.guava:guava's
releases</a>.</em></p>
<blockquote>
<h2>32.0.0</h2>
<h3>Maven</h3>
<pre lang="xml"><code>&lt;dependency&gt;
  &lt;groupId&gt;com.google.guava&lt;/groupId&gt;
  &lt;artifactId&gt;guava&lt;/artifactId&gt;
  &lt;version&gt;32.0.0-jre&lt;/version&gt;
  &lt;!-- or, for Android: --&gt;
  &lt;version&gt;32.0.0-android&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>
<h3>Jar files</h3>
<ul>
<li><a
href="https://repo1.maven.org/maven2/com/google/guava/guava/32.0.0-jre/guava-32.0.0-jre.jar">32.0.0-jre.jar</a></li>
<li><a
href="https://repo1.maven.org/maven2/com/google/guava/guava/32.0.0-android/guava-32.0.0-android.jar">32.0.0-android.jar</a></li>
</ul>
<p>Guava requires <a
href="https://github.com/google/guava/wiki/UseGuavaInYourBuild#what-about-guavas-own-dependencies">one
runtime dependency</a>, which you can download here:</p>
<ul>
<li><a
href="https://repo1.maven.org/maven2/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar">failureaccess-1.0.1.jar</a></li>
</ul>
<h3>Javadoc</h3>
<ul>
<li><a
href="http://guava.dev/releases/32.0.0-jre/api/docs/">32.0.0-jre</a></li>
<li><a
href="http://guava.dev/releases/32.0.0-android/api/docs/">32.0.0-android</a></li>
</ul>
<h3>JDiff</h3>
<ul>
<li><a href="http://guava.dev/releases/32.0.0-jre/api/diffs/">32.0.0-jre
vs. 31.1-jre</a></li>
<li><a
href="http://guava.dev/releases/32.0.0-android/api/diffs/">32.0.0-android
vs. 31.1-android</a></li>
<li><a
href="http://guava.dev/releases/32.0.0-android/api/androiddiffs/">32.0.0-android
vs. 32.0.0-jre</a></li>
</ul>
<h3>Changelog</h3>
<h4>Security fixes</h4>
<ul>
<li>Reimplemented <code>Files.createTempDir</code> and
<code>FileBackedOutputStream</code> to further address CVE-2020-8908 (<a
href="https://redirect.github.com/google/guava/issues/4011">#4011</a>)
and CVE-2023-2976 (<a
href="https://redirect.github.com/google/guava/issues/2575">#2575</a>).
(feb83a1c8f)</li>
</ul>
<p>While CVE-2020-8908 was officially closed when we deprecated
<code>Files.createTempDir</code> in <a
href="https://github.com/google/guava/releases/tag/v30.0">Guava
30.0</a>, we've heard from users that even recent versions of Guava have
been listed as vulnerable in <em>other</em> databases of security
vulnerabilities. In response, we've reimplemented the method (and the
very rarely used <code>FileBackedOutputStream</code> class, which had a
similar issue) to eliminate the insecure behavior entirely. This change
could technically affect users in a number of different ways (discussed
under &quot;Incompatible changes&quot; below), but in practice, the only
problem users are likely to encounter is with Windows. If you are using
those APIs under Windows, you should skip 32.0.0 and go straight to <a
href="https://github.com/google/guava/releases/tag/v32.0.1">32.0.1</a>
which fixes the problem. (Unfortunately, we didn't think of the Windows
problem until after the release. And while we <a
href="https://github.com/google/guava#important-warnings">warn that
<code>common.io</code> in particular may not work under Windows</a>, we
didn't intend to regress support.) Sorry for the trouble.</p>
<h4>Incompatible changes</h4>
<p>Although this release bumps Guava's major version number, it makes
<strong>no binary-incompatible changes to the <code>guava</code>
artifact</strong>.</p>
<p>One change could cause issues for Widows users, and a few other
changes could cause issues for users in more usual situations:</p>
<ul>
<li><strong>The new implementations of <code>Files.createTempDir</code>
and <code>FileBackedOutputStream</code> <a
href="https://redirect.github.com/google/guava/issues/6535">throw an
exception under Windows</a>.</strong> This is fixed in <a
href="https://github.com/google/guava/releases/tag/v32.0.1">32.0.1</a>.
Sorry for the trouble.</li>
<li><code>guava-gwt</code> now <a
href="https://redirect.github.com/google/guava/issues/6627">requires</a>
GWT <a
href="https://github.com/gwtproject/gwt/releases/tag/2.10.0">2.10.0</a>.</li>
<li>This release makes a binary-incompatible change to a
<code>@Beta</code> API in the <strong>separate artifact</strong>
<code>guava-testlib</code>. Specifically, we changed the return type of
<code>TestingExecutors.sameThreadScheduledExecutor</code> to
<code>ListeningScheduledExecutorService</code>. The old return type was
a package-private class, which caused the Kotlin compiler to produce
warnings. (dafaa3e435)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/google/guava/commits">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.guava:guava&package-manager=maven&previous-version=30.1-jre&new-version=32.0.0-jre)](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>
2024-01-25 19:02:38 +01:00
LangChain4j bcc80e2cb7 Weaviate: split host and port 2024-01-25 18:56:55 +01:00
LangChain4j 7412a29076 Weaviate: add javadoc regarding port 2024-01-25 18:50:52 +01:00
LangChain4j 466cd392e3 Weaviate: update client version 2024-01-25 18:50:43 +01:00
Ignasi 74afef7667
Fix illegal group reference when the value contains $$ (#545)
Following [this answer](https://stackoverflow.com/a/20002683/1490806)
`Matcher.quoteReplacement` has to be used to avoid
`java.lang.IllegalArgumentException: Illegal group reference` whenever
the content contains `$$`
2024-01-25 18:35:50 +01:00
Anush 4d4f09f4e4
feat: langchain4j-qdrant (#542)
This PR introduces a new module `langchain4j-qdrant` to enable Qdrant -
https://qdrant.tech/ to be used as a vector database in Langchain4J.

Integration tests have been implemented by extending `EmbeddingStoreIT`
and using `org.testcontainers` to spawn a local Qdrant instance.
2024-01-25 18:32:16 +01:00
LangChain4j 18d9aa0dc6 Make EmbeddingStoreIT less strict to allow for slight precision degradation in vector values. See #542 2024-01-25 18:28:03 +01:00
LangChain4j 3441691de0
tiny improvements (#543) 2024-01-25 16:33:11 +01:00
dependabot[bot] a1aa184518
Bump com.jayway.jsonpath:json-path from 2.8.0 to 2.9.0 in /langchain4j-parent (#541)
Bumps
[com.jayway.jsonpath:json-path](https://github.com/jayway/JsonPath) from
2.8.0 to 2.9.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/jayway/JsonPath/releases">com.jayway.jsonpath:json-path's
releases</a>.</em></p>
<blockquote>
<h2>json-path-2.9.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Fix for <a
href="https://github.com/advisories/GHSA-pfh2-hfmq-phg5">CVE-2023-51074</a>.</li>
<li>update dependencies by <a
href="https://github.com/SingingBush"><code>@​SingingBush</code></a> in
<a
href="https://redirect.github.com/json-path/JsonPath/pull/965">json-path/JsonPath#965</a></li>
<li>JPMS: define Automatic-Module-Name as json.path by <a
href="https://github.com/SingingBush"><code>@​SingingBush</code></a> in
<a
href="https://redirect.github.com/json-path/JsonPath/pull/966">json-path/JsonPath#966</a></li>
<li>Bump json-smart version from 2.4.10 to 2.5.0 by <a
href="https://github.com/shoothzj"><code>@​shoothzj</code></a> in <a
href="https://redirect.github.com/json-path/JsonPath/pull/945">json-path/JsonPath#945</a></li>
<li>Fixed rendering error on <code>$..book[?(@.price &lt;=
$['expensive'])]</code> in README.md by <a
href="https://github.com/lulunac27a"><code>@​lulunac27a</code></a> in <a
href="https://redirect.github.com/json-path/JsonPath/pull/967">json-path/JsonPath#967</a></li>
<li>[build] Remove deprecated gradle convetion usage by <a
href="https://github.com/shoothzj"><code>@​shoothzj</code></a> in <a
href="https://redirect.github.com/json-path/JsonPath/pull/946">json-path/JsonPath#946</a></li>
<li>Check for the existence of the next significant bracket by <a
href="https://github.com/twobiers"><code>@​twobiers</code></a> in <a
href="https://redirect.github.com/json-path/JsonPath/pull/985">json-path/JsonPath#985</a></li>
<li>Update versions by <a
href="https://github.com/kallestenflo"><code>@​kallestenflo</code></a>
in <a
href="https://redirect.github.com/json-path/JsonPath/pull/987">json-path/JsonPath#987</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/lulunac27a"><code>@​lulunac27a</code></a> made
their first contribution in <a
href="https://redirect.github.com/json-path/JsonPath/pull/967">json-path/JsonPath#967</a></li>
<li><a href="https://github.com/twobiers"><code>@​twobiers</code></a>
made their first contribution in <a
href="https://redirect.github.com/json-path/JsonPath/pull/985">json-path/JsonPath#985</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/json-path/JsonPath/compare/json-path-2.8.0...json-path-2.9.0">https://github.com/json-path/JsonPath/compare/json-path-2.8.0...json-path-2.9.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="af7e516c69"><code>af7e516</code></a>
Release 2.9.0</li>
<li><a
href="af4dfcc17a"><code>af4dfcc</code></a>
Make PropertyPathToken public, closes <a
href="https://redirect.github.com/jayway/JsonPath/issues/955">#955</a></li>
<li><a
href="49b1151b11"><code>49b1151</code></a>
Update versions (<a
href="https://redirect.github.com/jayway/JsonPath/issues/987">#987</a>)</li>
<li><a
href="71a09c1193"><code>71a09c1</code></a>
Check for the existence of the next significant bracket (<a
href="https://redirect.github.com/jayway/JsonPath/issues/985">#985</a>)</li>
<li><a
href="900ebfe58f"><code>900ebfe</code></a>
Remove deprecated gradle usage (<a
href="https://redirect.github.com/jayway/JsonPath/issues/946">#946</a>)</li>
<li><a
href="946274d3cb"><code>946274d</code></a>
Fixed rendering error on <code>$..book[?(@.price &lt;=
$['expensive'])]</code> in README.md...</li>
<li><a
href="425bcb18a5"><code>425bcb1</code></a>
Bump json-smart version from 2.4.10 to 2.5.0 (<a
href="https://redirect.github.com/jayway/JsonPath/issues/945">#945</a>)</li>
<li><a
href="2d57ab3615"><code>2d57ab3</code></a>
JPMS: define Automatic-Module-Name as json.path (<a
href="https://redirect.github.com/jayway/JsonPath/issues/966">#966</a>)</li>
<li><a
href="1a57f7800b"><code>1a57f78</code></a>
update dependencies (<a
href="https://redirect.github.com/jayway/JsonPath/issues/965">#965</a>)</li>
<li><a
href="21de620794"><code>21de620</code></a>
Prepare next version</li>
<li>See full diff in <a
href="https://github.com/jayway/JsonPath/compare/json-path-2.8.0...json-path-2.9.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.jayway.jsonpath:json-path&package-manager=maven&previous-version=2.8.0&new-version=2.9.0)](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>
2024-01-25 16:21:53 +01:00
Georgios Andrianakis b4fa306ac2
Allow @SystemMessage to be placed on a class (#546)
This would be very useful for quarkus-langchain4j
and its @RegisterAiService annotation
(see https://github.com/quarkiverse/quarkus-langchain4j/discussions/246)
2024-01-25 11:12:08 +01:00
Crutcher Dunnavant 1c40471ae7
Testing and efficiency work on HierarchicalDocumentSplitter. (#524)
- reworked SegmentBuilder as a String concat mechanism; since we were
calling "build()" on it so often.
2024-01-25 11:11:53 +01:00
LangChain4j 9ac372f191 cosmetics 2024-01-25 10:50:00 +01:00
Carlos Zela Bueno b5f38829d0
Add support for Mistral AI open models (#514)
Mistral AI continues its mission to deliver the best open models to the
developer community. They are [growing
quickly](https://mistral.ai/news/mixtral-of-experts/) and it's very
helpful add support to Mistral AI models.
2024-01-25 10:27:59 +01:00
Eric Deandrea c7c4ee8eab
Allowing model builders to be extended and to be provided by `ServiceLoader`s (#531)
This is a small prototype based on discussions originating from
https://github.com/ai-for-java/openai4j/pull/13

The approach I took here is to allow for decorating the models/builders
with additional functionality without having to extend model classes or
builders. I did it for a single model in this prototype - the
`OpenAiChatModel`, but this pattern could be applied to all of the other
models across Langchain4J.

That doesn't mean you couldn't extend the model classes if you wanted to
use inheritance. I just try to avoid it and use composition instead.

I also added a test which shows how it would be used. Downstream
libraries (like Spring Boot or Quarkus) could use this mechanism to
extend/enhance with their own capabilities which aren't necessarily part
of the model.

Let me know what you think @geoand / @langchain4j !

Happy to continue conversation and see where we can bring this!
2024-01-25 09:55:02 +01:00
LangChain4j 3ac3ab8ded renamed OpenSearchEmbeddingStore ITs according to conventions 2024-01-25 09:42:14 +01:00
Hervé Boutemy 1214fe0579
enable Reproducible Builds (#528)
see https://maven.apache.org/guides/mini/guide-reproducible-builds.html
2024-01-25 09:31:38 +01:00
Julien Dubois 7f4225e171
Use the Jackson BOM to solve Jackson dependency errors (#523)
Using Azure OpenAI, on some Jackson mappings I'm getting the following
error:
```
Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/annotation/JsonTypeInfo$Value
```
This is because not all our Jackson dependencies are using the same
version. The intent of this commit is to fix this, by using the Jackson
BOM.
2024-01-24 15:23:18 +01:00
Eddú Meléndez Gonzales c3d08df273
Add IT for AWS OpenSearch using LocalStack & Testcontainers (#416) 2024-01-24 13:25:37 +01:00
Lize Raes 283107c8ce
add logging and model parameter tutorials to docu (#536)
Adding Model Parameter Setting tutorial and Logging explanation to
documentation
2024-01-24 08:28:45 +01:00
LangChain4j e7bee00598 fixed typo in DocumentSplitters 2024-01-19 17:54:32 +01:00
Crutcher Dunnavant f06c1136fa
Fix reflection bug that broke tests during coverage. (#519)
Coverage analysis injects tracking fields, which can show up in
`getDeclaredFields()`; this removes the field `__$hits$__` when present.
2024-01-17 17:48:36 +01:00
Crutcher Dunnavant 45f49e9e70
Coverage work on InMemoryEmbeddingStore. (#520) 2024-01-17 12:31:39 +01:00
LangChain4j f7d9a04442 fixed LogLevel NPE in openai4j 2024-01-17 09:58:17 +01:00
Crutcher Dunnavant 5730bc7f88
Default methods for ModerationModel. (#511) 2024-01-16 17:40:35 +01:00
Crutcher Dunnavant 74079bd095
Fix all jococo javadoc warnings in langchain4j-core. (#510)
A number of private constructors were added to namespace classes.
2024-01-16 17:29:07 +01:00
LangChain4j 51ed0c940e
added documentation link (#517) 2024-01-16 16:32:24 +01:00
Crutcher Dunnavant 2880fb023e
Unify langchang4j-core coverage to a 95% requirement. (#509) 2024-01-15 18:43:56 +01:00
Crutcher Dunnavant 9e251fd7a3
Tighten coverage ratchet. (#483) 2024-01-15 09:43:29 +01:00
Crutcher Dunnavant 423a4c65ea
StructuredPrompt refactor and tests. (#490)
- `ValidationUtils.ensureEq(v, fmt, args...)`
- moved annotation validator to
StructuredPrompt.Util.validateStructuredPrompt
- tests for DefaultStructuredPromptFactory
2024-01-15 09:34:16 +01:00
Crutcher Dunnavant 3f8f2cf31a
language.TokenCountEstimator tests. (#494) 2024-01-15 09:33:47 +01:00
Crutcher Dunnavant b1cd592a50
Response tests. (#493) 2024-01-15 09:33:39 +01:00
Crutcher Dunnavant d078d2f309
Moderation tests. (#492) 2024-01-15 09:33:31 +01:00
Crutcher Dunnavant 4cc88105c5
LanguageModel and StreamingLanguageModel tests. (#491) 2024-01-15 09:32:41 +01:00
Crutcher Dunnavant 43b3494e6e
Make PromptTemplateFactory.Input a FunctionalInterface. (#489)
Simplifies the (currently one) caller, and cleans up coverage analysis.
2024-01-15 09:22:49 +01:00
Crutcher Dunnavant fd4a50a6f1
ToolExecutionResultMessage tests. (#488) 2024-01-15 09:21:39 +01:00
Crutcher Dunnavant 1e97f84f41
ImageContent tests. (#487) 2024-01-15 09:21:31 +01:00
Crutcher Dunnavant dcefe574e8
SystemMessage tests. (#486) 2024-01-15 09:21:22 +01:00
Crutcher Dunnavant 37c04c632e
ServiceHelper.{loadService, loadFactoryService}() (#485) 2024-01-15 09:21:02 +01:00
Crutcher Dunnavant 57eb9be753
Flesh out RetryUtils with a policy mechanism. (#484)
- Backed `RetryUtils.withRetry()` with a `RetryPolicy`.
- added support for exponential backoff and request jitter.

default retry times are now:
* 500 * (1 + uniform(0.20))
* 750 * (1 + uniform(0.20))
* 1250 * (1 + uniform(0.20)
* (500 * pow(1.5, attempt - 1)) * (1 + uniform(0.20))
2024-01-15 09:10:35 +01:00
LangChain4j 56da237095 remove testcontainers cloud 2024-01-14 23:33:19 +01:00
LangChain4j 448f955201 fail at end 2024-01-14 23:32:55 +01:00
LangChain4j e53819ef6a fixed EmbeddingStoreTest 2024-01-14 23:09:34 +01:00
LangChain4j fbf493d0b9 fixed EmbeddingStoreTest 2024-01-14 22:49:10 +01:00