Commit Graph

290 Commits

Author SHA1 Message Date
LangChain4j a91ea8ae4f FEATURE: Anthropic streaming with tools (#1795) 2024-09-23 11:59:07 +02:00
LangChain4j 84915ba03e Deprecated Json from langchain4j-core
langchain4j-core should not depend on Gson
2024-09-20 17:31:32 +02:00
Jack Green d72af43416
`dev.langchain4j.data.document.Metadata.Metadata()` creates redundant `Map` (#1801)
## Change
The [default constructor creates an empty
`HashMap`](abd98a8b0b/langchain4j-core/src/main/java/dev/langchain4j/data/document/Metadata.java (L56)),
just to pass it into another constructor [which wraps it another new
`HashMap`](abd98a8b0b/langchain4j-core/src/main/java/dev/langchain4j/data/document/Metadata.java (L75)).

This overhead can be removed.

## General checklist
- [X] There are no breaking changes
- [ ] I have added unit and integration tests for my change
- [ ] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [ ] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2024-09-20 12:07:32 +02:00
LangChain4j d66fa8554b Added listener on aws bedrock (#1805) 2024-09-20 11:41:58 +02:00
Claudio Silva Junior 8893a39276
Added listener on aws bedrock (#1805)
## Issue
Closes #1759

## Change
Added listener on aws bedrock


## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [x] There are no breaking changes
- [x] I have added unit and integration tests for my change
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [x] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2024-09-20 11:40:48 +02:00
LangChain4j 0b29cb21e6 Added ChatModelListener in anthropic model (#1791) 2024-09-19 11:44:28 +02:00
Claudio Silva Junior 6e191b794c
Added ChatModelListener in anthropic model (#1791)
## Issue
Closes #1757

## Change
Added ChatModelListener in anthropic model

## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [x] There are no breaking changes
- [x] I have added unit and integration tests for my change
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [ ] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2024-09-19 11:39:15 +02:00
Kais Neffati ca8c9b9d78
[BUG] ToolSpecifications misses object properties when object appears more than once #1735 (#1781)
## Issue
Closes #1735 

## Change
Fixed bug when ToolSpecifications misses object properties when object appears more than once

## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [X] There are no breaking changes
- [X] I have added unit and integration tests for my change
- [X] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [X] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2024-09-17 14:47:53 +02:00
LangChain4j 09d356fda4 Ollama chat model listener (#1765) 2024-09-17 11:14:00 +02:00
ZYinNJU 16f410c788
Ollama chat model listener (#1765)
## Issue
Closes #1756
Closes #1750

## Change
1. `OllamaChatModel` and `OllamaStreamingChatModel` support
`ChatListener`
2. Fix `OllamaStreamingLanguageModel` throws `EOFException` when the
response content is too long.

## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [x] There are no breaking changes
- [x] I have added unit and integration tests for my change
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [x] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2024-09-17 11:12:43 +02:00
Guillaume Laforge 6be0852b26
feat(Vertex AI Gemini) — listener support (streaming and non streaming) (#1779)
Fixes #1758

## Change

Add listener support to both Vertex AI Gemini streaming and non
streaming models.

## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [X] There are no breaking changes
- [ ] I have added unit and integration tests for my change
- [X] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [ ] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2024-09-16 17:30:37 +02:00
LangChain4j fa667f70e9 added StreamingChatModelListenerIT 2024-09-15 12:46:22 +02:00
LangChain4j 93187c000d added StreamingChatModelListenerIT 2024-09-15 12:37:56 +02:00
LangChain4j 13f71f3e90 added javadoc for ChatModelListenerIT 2024-09-15 11:38:47 +02:00
LangChain4j e0e57dd281 #886: Add support for Flux<String> in addition to TokenStream in AI service interfaces 2024-09-15 10:02:24 +02:00
Guillaume Laforge 858cc9c19d
Google AI Gemini — support for Enum structured output (#1741)
## Change

In addition to `application/json`, Gemini also supports `text/x.enum` as
a structured output format, which is great for classification.

This PR covers both Google Vertex AI Gemini and Google AI Gemini models.

A minor internal change to create the `GeminiService` at construction
time rather than on each request.

+ Observability (ChatLanguageModel) for Google AI Gemini


## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] There are no breaking changes
- [X] I have added unit and integration tests for my change
- [X] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [/] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2024-09-13 22:44:43 +02:00
Guillaume Laforge 421b4cd048
bug(Google AI Gemini) — fix mapping for tools with parameters with nested object structures (#1732)
* bug(Google AI Gemini) — fix mapping for tools with parameters with
nested object structures
* fix(JsonSchemas) — minor improvement to cover all cases of strings
2024-09-09 10:15:23 +02:00
LangChain4j 21d35e4434 changed version to 0.35.0-SNAPSHOT 2024-09-09 10:11:09 +02:00
LangChain4j b0a8e6f45b
Release 0.34.0 (#1711) 2024-09-05 16:49:39 +02:00
LangChain4j 0a9aba76e4 jacoco 2024-09-04 15:56:04 +02:00
LangChain4j a4dba81f53 #1363 — Add support for the Gemini AI model (#1695) 2024-09-04 15:51:59 +02:00
Guillaume Laforge 67898076d6
#1363 — Add support for the Gemini AI model (#1695)
## Issue
Closes #1363

## Change
New module for the Google AI Gemini

## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [x] There are no breaking changes
- [x] I have added unit and integration tests for my change
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [ ] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)

## Checklist for adding new model integration
- [x] I have added my new module in the
[BOM](https://github.com/langchain4j/langchain4j/blob/main/langchain4j-bom/pom.xml)
2024-09-04 15:39:15 +02:00
LangChain4j a2f44e0b00 OpenAI: Structured Outputs (#1590) 2024-09-02 12:00:12 +02:00
LangChain4j 875cd70adc fixing failing tests 2024-08-26 10:31:50 +02:00
LangChain4j cc7121a016 remove System.out.println() from tests 2024-08-26 09:52:40 +02:00
LangChain4j 46746f6611 mongodb: fixed failing tests 2024-08-23 15:49:39 +02:00
LangChain4j 23b927c938 fixed failing test 2024-08-23 10:30:46 +02:00
LangChain4j 3e6d50ee40
EmbeddingStoreIT: use awaitility (#1610)
## Change
Use awaitility in `EmbeddingStoreIT`

## General checklist
- [X] There are no breaking changes
- [X] I have added unit and integration tests for my change
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [x] I have manually run all the unit and integration tests in the
[core]
2024-08-22 16:17:53 +02:00
LangChain4j 2e47b126be [FEATURE] Adds SearchApi as WebSearchEngine and Tool (#1216) 2024-08-22 11:16:06 +02:00
Felipe Zambrin 99ed696f05
[FEATURE] Adds SearchApi as WebSearchEngine and Tool (#1216)
## Issue
Closes #1132 

## Change
Added SearchApi as a WebSearchEngine that also can be used as a tool.
Currently using Google Search as default engine. It also allows for new
engines to be implemented using the SearchApiRequestResponseHandler
interface, and adding it to the SearchApiEngine enum so the user can
choose which one to use.


## General checklist
- [X] There are no breaking changes
- [X] I have added unit and integration tests for my change
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [ ] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
- [X] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [X] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
* The example is in the docs, I will open a new PR to the examples repo
if it is ok

@algora-pbc /claim #1132
2024-08-22 11:05:39 +02:00
LangChain4j 4c35bf79dc 1505-feature-chroma-support-metadata-filtering (#1556)
Fixed merge conflict
2024-08-21 15:51:34 +02:00
Alexey Titov 4d328ca15f
1505-feature-chroma-support-metadata-filtering (#1556)
## Issue
Closes #1505

## Change
Chroma metadata filtering is supported now

## General checklist
- [X] There are no breaking changes
- [X] I have added unit and integration tests for my change
- [X] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [X] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
- [X] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [X] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features) -
https://github.com/langchain4j/langchain4j-examples/pull/99
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)

## Checklist for changing existing embedding store integration
<!-- Please double-check the following points and mark them like this:
[X] -->
- [X] I have manually verified that the
`{NameOfIntegration}EmbeddingStore` works correctly with the data
persisted using the latest released version of LangChain4j
2024-08-21 15:48:00 +02:00
LangChain4j 2e6d386f3f EmbeddingStoreWithRemovalIT: use awaitility 2024-08-20 12:16:54 +02:00
LangChain4j ae589e0c8d EmbeddingStoreWithRemovalIT: use awaitility 2024-08-20 11:58:20 +02:00
hrhrng ccd5370633
Feature 949 pinecone support metadata filter (#1601)
## Issue
Closes #949

## Change
Impeletement filter search in PineconeEmbeddingStore

## General checklist
- [X] There are no breaking changes
- [X] I have added unit and integration tests for my change
- [X] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [X] I have manually run all the unit and integration tests in the
[core]

## Checklist for changing existing embedding store integration
- [X] I have manually verified that the
`{NameOfIntegration}EmbeddingStore` works correctly with the data
persisted using the latest released version of LangChain4j
2024-08-20 10:28:08 +02:00
LangChain4j c5c146f9a0
OpenAI: Structured Outputs (#1590)
## Issue
Closes #1581

## Change
- OpenAI: added support for [Structured
Outputs](https://openai.com/index/introducing-structured-outputs-in-the-api/):
  - for tools
  - for json mode
- Introduced new (still experimental) `ChatLanguageModel` API (which
supports specifying json schema)

### OpenAI Structured Outputs for tools
To enable Structured Outputs feature for tools, set `.strictTools(true)`
when buidling the model:
```java
OpenAiChatModel.builder()
    ...
    .strictTools(true)
    .build(),
```
Please note that this will automatically make all tool parameters
mandatory (`required` in json schema)
and set `additionalProperties=false` for each `object` in json schema.
This is due to the current OpenAI limitations.

### OpenAI Structured Outputs for json mode
To enable Structured Outputs feature for json mode, set
`.responseFormat("json_schema")` and `.strictJsonSchema(true)` when
buidling the model:
```java
OpenAiChatModel.builder()
    ...
    .responseFormat("json_schema")
    .strictJsonSchema(true)
    .build(),
```
In this case `AiServices` will not append "You must answer strictly in
the following JSON format: ..." string to the end of the last
`UserMessage`, but will create a Json schema from the given POJO and
pass it to the LLM.
Please note that this works only when method return type is a POJO. If
the return type is something else, (like an enum or a `List<String>`),
the old behaviour is applied (with "You must answer strictly ..."). All
return types will be supported in the near future.

Please note that this feature is available now only for `gpt-4o-mini`
and `gpt-4o-2024-08-06` models.

### Experimental `ChatLanguageModel` API
This was drafted in
https://github.com/langchain4j/langchain4j/pull/1261, but now it has to
be rushed a bit in order to enable new Structured Outputs feature for
OpenAI.
A new method `ChatResponse chat(ChatRequest request)` was added into
`ChatLanguageModel` which allows to specify messages, tools and response
format (with json schema). In the future it will also support specifying
model parameters like temperature.

## Upcoming Changes
- Adopt new `ChatLanguageModel` API for Gemini
- Adopt new `ChatLanguageModel` API for Azure OpenAI (once available)
- Support Structured Outputs with all other method return types like
`List<Pojo>`
- Adopt new `JsonSchema` type for tools (instead of `ToolParameters`)

Reated changes in openai4j:
https://github.com/ai-for-java/openai4j/pull/33

## General checklist
- [X] There are no breaking changes
- [X] I have added unit and integration tests for my change
- [X] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [X] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2024-08-14 15:25:25 +02:00
Carlos Zela Bueno b246cfde70
[Bugfix 1458] Allowing web search results empty (#1570)
## Issue
Closes #1458

## Change

## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [X] There are no breaking changes
- [X] I have added unit and integration tests for my change
- [X] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [X] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2024-08-07 10:00:08 +02:00
PrimosK e535f0153d
re #1506 Enabling Maven (version) enforcer plugin in modules with no version conflicts (#1507)
## Issue

#1506

## Change

Enabled Maven Enforcer Plugin on modules without existing version
conflicts to ensure they remain conflict-free. The Maven Enforcer Plugin
will now cause the build to fail if new conflicts are introduced
guarding against these.

## Tests

`mvn clean test` passed
2024-08-06 15:21:25 +02:00
LangChain4j 267b947c63 cosmetics 2024-08-06 14:08:23 +02:00
Patrik Hörlin f2bf60029b
1465 : Ensuring trailing / in retrofit baseurl (#1519)
## Issue
Closes #1465

## Change
According to
[retrofit](https://github.com/square/retrofit/blob/trunk/retrofit%2Fsrc%2Fmain%2Fjava%2Fretrofit2%2FRetrofit.java#L564)
base urls should always end with `/`.

Added new utility method to ensure that a provided base url always ends
with a `/` and checked existing API classes so that they all start
**without** a `/`.

### Tests
I have added unit test for the new utility method but testing the actual
invocation of the method in the different builder classes is harder. The
existing Ollama test case spins up a temporary web server and I don't
want to replicate this to al lmodules since I suspect build times will
increase a lot etc.

Thoughts?

## General checklist
- [X] There are no breaking changes
- [X] I have added unit and integration tests for my change
- [X] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [X] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2024-08-06 13:52:30 +02:00
hrhrng efe12b1f62
fix bug: AiMessage text content is not copied when toolCalls are pres… (#1069)
## Issue
Closes #986


## Change
When OpenAI returns both content and tool_calls, keep them all instead
of just keeping the tool_calls.


## General checklist

- [x] There are no breaking changes
- [x] I have added unit and integration tests for my change
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [x] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
- [ ] I have added/updated the documentation
2024-08-06 12:00:06 +02:00
Devansh Rastogi 68903c3689
[FEATURE] Implemented removal methods for AzureAiSearchEmbeddingStore (#1563)
## Issue
Closes #1467 


## Change
- implemented remove(String id), removeAll(), removeAll(Collection ids),
removeAll(Filter filter) methods for AzureAiSearchEmbeddingStore.
- Added awaitUntilPersisted() after remove methods are called.
- Created ITs to test the changes


## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [x] There are no breaking changes
- [x] I have added unit and integration tests for my change
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [ ] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
2024-08-06 11:44:34 +02:00
LangChain4j 1cccfdfa65 changed version to 0.34.0-SNAPSHOT 2024-07-26 15:12:26 +02:00
Marvin Blessing f648f35e18
Fix DefaultPromptTemplateFactory RegExp for Android. (#1518)
## Issue
Closes #1075 #1212

## Change
Adjusted the regex according to the discussion in both issues. Tested
the change with a sample repository using an instrumentation test which
uses the DefaultPromptTemplateFactory. The test can be found
[here](5640a9743e/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.kt (L20)).

If a test is required in this repo please advice me on possible steps,
I'm not sure how to test it without setting up an Android environment.

## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [x] There are no breaking changes
- [ ] I have added unit and integration tests for my change
- [x] I have created an example Android repository verifying that the
change fixes the runtime error in Android
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [x] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2024-07-25 15:48:38 +02:00
LangChain4j 822f09cb1c
Release 0.33.0 (#1514) 2024-07-25 10:12:20 +02:00
LangChain4j 3355fd911b [Feature] Pinecone: support storing metadata and embedding removal (#1400) 2024-07-23 14:45:08 +02:00
ZYinNJU e848e6a882
[Feature] Pinecone: support storing metadata and embedding removal (#1400)
## Issue
Closes #1169
Fixes #1418

## Change
1. Refactor `PineconeEmbeddingStore`, update `pinecone-client` version
to latest.
2. Support storing metadata
3. Support embedding removal method (not include `removeAll(Filter filter)` because I
don't find a way to convert `Filter` to
`com.google.protobuf.StructStruct` :(, but I will try my best to work on
it, and will create a new PR if I complete it.)

## General checklist
- [ ] There are no breaking changes
- [x] I have added unit and integration tests for my change
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [x] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)

## Checklist for changing existing embedding store integration
- [x] I have manually verified that the
`{NameOfIntegration}EmbeddingStore` works correctly with the data
persisted using the latest released version of LangChain4j
2024-07-23 14:37:42 +02:00
Guillaume Laforge 44ac06355c
Adding support to audio, video, PDF file inputs for multimodal models (#1464)
**#1463 adding audio, video, rich format support for multimodal models**
2024-07-23 14:18:48 +02:00
LangChain4j 4f09db98b8
DefaultRetrievalAugmentor: process in the same thread when single query and single retriever, otherwise use executor and cache threads for 1 second (#1479)
## Issue
This PR partially fixes #1454

## Context
`DefaultRetrievalAugmentor` currently uses an `Executor` to parallelize
the processing (consider multiple `Query`s and/or multiple
`ContentRetriever`s).
The default `Executor` instance caches (non-daemon) threads for 60
seconds, so when the application is ready to shut down, it can hang for
another 60 seconds before it can actually exit.
For the majority of the use cases (single `Query` and single
`ContentRetriever`) there is no need to use an `Executor`, processing
can be done in the same thread without an `Executor`, thus there will be
no hanging.
For the rest of the use cases we can use the `Executor` to parallelize
the processing as before. But for default `Executor`, reduce the time
from 60 to 1 second, which makes "handing time" acceptable.
In any case, the user can always provide a custom instance of an
`Executor` and manage it externally.


## Change
- Changes in `DefaultRetrievalAugmentor`:
- When there is only a single `Query` and a single `ContentRetriever`
(majority of use cases), processing is done in the same thread
(`Executor` is not used at all)
- Otherwise, the `Executor`is used to parallelize query routing and
content retrieval. The default `Executor` now caches threads for 1
second (instead of 60 seconds)
  - Added javadoc and documentation
- Added documentation for
https://github.com/langchain4j/langchain4j/issues/1454



## General checklist
- [X] There are no breaking changes
- [X] I have added unit and integration tests for my change
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [x] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
- [X] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2024-07-23 11:49:53 +02:00
LangChain4j 8537e897ba
Fix split packages (#1433)
## Issue
Closes #1066

## Change
These are changes for each split package (each change was done in a
separate commit, so they can be reviewed in isolation):
- `dev.langchain4j.retriever` -> Moved `EmbeddingStoreRetriever` into
`langchain4j-core` module
- `dev.langchain4j.agent.tool` -> Moved `DefaultToolExecutor` and
`ToolExecutor` into `dev.langchain4j.service.tool` package
- `dev.langchain4j.classification` -> Moved `TextClassifier` into
`langchian4j` module
- `dev.langchain4j.chain` -> Moved `Chain` into `langchain4j` module
- `dev.langchain4j.model.embedding` -> [All in-process embedding models
should have unique package
name](https://github.com/langchain4j/langchain4j-embeddings/pull/33)
- `dev.langchain4j.model.output` -> Moved `OutputParser` and all it's
implementations into `dev.langchain4j.service.output` package of the
`langchain4j` module

More details can be found
[here](https://docs.google.com/spreadsheets/d/1U7f2MIfDgWA1tydPpzWpOGTHiBjBVZjsu0uZnXBT9qE/edit?usp=sharing).

## Breaking Changes
- All in-process ONNX model classes moved into their own unique
packages:
- `AllMiniLmL6V2EmbeddingModel` moved into
`dev.langchain4j.model.embedding.onnx.allminilml6v2`
- `AllMiniLmL6V2QuantizedEmbeddingModel` moved into
`dev.langchain4j.model.embedding.onnx.allminilml6v2q`
- `OnnxEmbeddingModel` moved into `dev.langchain4j.model.embedding.onnx`
package
  - etc
- `ToolExecutor` and `DefaultToolExecutor` moved into
`dev.langchain4j.service.tool` package
- Moved `OutputParser` and all it's implementations into
`dev.langchain4j.service.output` package of the `langchain4j` module
- Moved `Chain` into `langchain4j` module
- Moved `TextClassifier` into `langchian4j` module

## General checklist
- [ ] There are no breaking changes
- [ ] I have added unit and integration tests for my change
- [X] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [X] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
2024-07-19 12:59:59 +02:00