Commit Graph

276 Commits

Author SHA1 Message Date
deep-learning-dynamo f8871900be *EmbeddingStoreTest -> *EmbeddingStoreIT 2023-11-10 13:48:32 +01:00
deep-learning-dynamo 4f7b574d9c disabling ollama integration tests 2023-11-10 13:48:10 +01:00
deep-learning-dynamo e4d37614d3 disabling ollama integration tests 2023-11-10 13:47:58 +01:00
deep-learning-dynamo 0fd7805546 bedrock: minor 2023-11-10 13:47:13 +01:00
deep-learning-dynamo 9db71da992 pgvector: refactoring 2023-11-10 13:11:41 +01:00
deep-learning-dynamo 83e6456829 formatting 2023-11-10 13:11:41 +01:00
Pascal Vantrepote 286e95c047
Adding support for AWS Bedrock (#269) 2023-11-10 13:11:32 +01:00
Heezer b5313ee720
typo fix in VertexAI support (#268) 2023-11-10 12:04:58 +01:00
Julien Ruaux 3a002a6a74
Added Redis testcontainer and enabled tests (#265)
Added a Redis Stack testcontainer instance to the unit tests and enabled
the test suite
2023-11-10 11:16:00 +01:00
Artur 7c12b39a8c
Allow using another metadata key than text_segment (#260) 2023-11-10 10:17:59 +01:00
Georgios Andrianakis 95a00280d4
Introduce SPI for HuggingFace (#257)
# Changes

## Hugging Face


I introduced `HuggingFaceClientFactory` which can be used for
integrations to supply their own version of the Hugging Face HTTP
client.

The rationale is similar to what I have done in previous PRs
2023-11-10 09:00:54 +01:00
Georgios Andrianakis 21956f8142
Make AiServices swappable by external implementations (#248)
# Purpose

The idea here is that advanced integrations would be able to supply
their own version of `AiServices`. The use case I have
[implemented](https://github.com/geoand/quarkus-langchain4j/blob/master/core/runtime/src/main/java/io/quarkiverse/langchain4j/QuarkusAiServicesFactory.java)
using these SPIs allows Quarkus to do a lot of the work at build time
instead of runtime, while also using our preferred set of dependencies.

# Changes

## Json

Introduce and SPI that allows integrations to swap out a custom Json
implementation.

## ChatMessage Json SPI

Same idea as above but for the `ChatMessage` specifically

## InMemoryEmbeddingStore Json SPI

Same idea as above but for `InMemoryEmbeddingStore` specifically

## AiServices

This change builds on the previous two and is the actual meat of the
change. It makes the least possible changes to the project that will
allow for integrations to provide their own implementation of
AiServices.
Existing usages of AiServices via langchain4j see no change whatsoever. 

### Note

The SPI is deliberately under specified as I prefer at this very early
stage to place an additional burden on integrators (me in this case :))
where various parts need to be reimplemented, rather than trying to make
the SPI to specific which could cause problems when and if new
integrations come in the future.
I believe that if interest for such an integration manifests, we can all
work together to define the exact methods and types that will be needed
by everyone thus allowing for maximum code reuse.
2023-11-10 08:56:13 +01:00
ZYinNJU 677cf26bca
Ollama integration (#249)
@langchain4j Hi! I make some progress to integrate with Ollama, see
#244. Using `retrofit` to define REST API in [Ollama
doc](https://github.com/jmorganca/ollama/blob/main/docs/api.md#generate-a-completion).

Local test need local deployment of `Ollama`. Looking forward to get
your code review!

---------

Co-authored-by: Heezer <33568148+Heezer@users.noreply.github.com>
2023-11-07 21:39:40 +01:00
LangChain4j 56e5fa01ca
updated discord invite link 2023-11-07 19:01:48 +01:00
Joris Kuipers bc8ee67035
Add support for autocompletion of Boot configuration properties (#240)
By adding an optional dependency on the
spring-boot-configuration-processor, a
`META-INF/spring-configuration-metadata.json` file will be created for
all `@ConfigurationProperties`-annoted types to support autocompletion
within IDEs. Since nested beans are used, the bound fields for those
beans need to be annotated with `@NestedConfigurationProperty`. (purely
for this tool, this does not affect runtime behavior in any way)
2023-11-07 18:53:35 +01:00
kevin-wu-os dbc141a10f
PGVector: First E2E implementation (Java 8 Implementation) (#236)
# Summary

I use https://github.com/pgvector/pgvector-java/ to implement
`PgVectorEmbeddingStore`.

1. Insertion works as regular SQL as long as a table (with namespace as
table name) contains type `vector`.
2. Query is upon the enhanced SQL by vector extension. The SQL returned
results are the final result with passing `minScore` and `maxResults`.

# Caveat
* The implementation leaves responsibility of installing `vector`
extension to users.
* Only cosine similarity is used.
* Only ivfflat index is used.
2023-10-27 16:45:57 +02:00
deep-learning-dynamo 822469d4a0 fixed scopes 2023-10-27 14:18:14 +02:00
ZYinNJU a62c302464
add BOM to manage artifacts (#227)
see #217, it's a good way to manage artifacts.

Now users can use code below to import dependency:

```xml
    <dependencyManagement>
        <dependencies>
              <dependency>
                  <groupId>dev.langchain4j</groupId>
                  <artifactId>langchain4j-bom</artifactId>
                  <version>${langchain4j.version}</version>
                  <type>pom</type>
                  <scope>import</scope>
              </dependency>
        </dependencies>
    </dependencyManagement>
```
2023-10-27 14:18:04 +02:00
Jansen Ang 053a35d5a3
Add support for loading documents from s3 (#197)
Adding two separate loaders that load a single document or multiple
documents from S3 respectively. They also contain different parameters
to support different configurations. However, the document type is
dependent on the current parsers that langchain4j supports, but I am
planning to help in adding more parsers in the future.
2023-10-27 14:00:16 +02:00
Thomas Vitale 65ef6554b6
Include metadata for custom Spring Boot properties (#251)
Add the Spring Boot Configuration Processor dependency to the Spring
Boot starter to generate metadata
about the LangChain4J custom properties.

Fixes gh-250
2023-10-27 13:53:17 +02:00
Simon Verhoeven c2cb08648c
feat: in case a model like Vertex does not have a toolspecification do not use the generate method expecting one (#253)
resolves #252 252
2023-10-27 13:37:43 +02:00
deep-learning-dynamo d0067e9f91 updated openai4j to the latest version 2023-10-23 11:23:50 +02:00
Georgios Andrianakis 0eee7ec7d3
Make some aspects of the project swappable by external integrations (#235)
# Purpose

This purpose of this pull request is to make it possible for advanced
integrators to swap out some of the dependencies with others.

For a first iteration, I did not want to require current consumers of
this library to have to make any changes - for them this pull requests
changes nothing whatsoever.
This means that I did not do any sort of of changes to the structure or
name of the Maven modules. I believe that if we want to do that, if can
be done at a latter point.

# Changes

## Gson

All this change does is move Gson out of the model classes. This is
needed by integrations that plan to exclude Gson from the classpath, so
that the models can continue to be loaded without incurring ClassLoading
issues.

## Template SPI

I introduced `PromptTemplateFactory` which can be used for integrations
to supply their own version of the template engine.
Implementations are loaded using Java's ServiceLoader mechanism and if
none are found, the default `MustachePromptTemplateFactory` is used.

I have leveraged this SPI my Quarkus integration
[here](487711af4c/runtime/src/main/java/io/quarkiverse/langchain4j/QuarkusPromptTemplateFactory.java).

## Make OpenAiStreamingResponseBuilder thread-safe

This class needs to be thread safe because it is called when a streaming
result comes back
and there is no guarantee that this thread will be the same as the one
that initiated the request
2023-10-20 16:54:13 +02:00
deep-learning-dynamo e0d6b9dfd9 added a draft for contribution guidelines 2023-10-20 16:21:33 +02:00
marlukcz 9719d8233f
Add support for custom base url for OpenAI model in Spring Boot starter (#228) 2023-10-17 21:26:45 +02:00
deep-learning-dynamo f43cc8f4ca keep netty versions in sync 2023-10-17 21:16:18 +02:00
J b55f9e8a40
fix: remove high severity vulnerability in pinecone pom (#231)
Hi, this PR updates the pom of langchain4j-pinecone to remove a newly
discovered high severity [CVE-2023-44487
vulnerability](https://www.cve.org/CVERecord?id=CVE-2023-44487)
2023-10-17 21:11:29 +02:00
deep-learning-dynamo 5d5864d321 Azure OpenAI: increased default timeouts to 60 seconds 2023-10-17 20:59:30 +02:00
deep-learning-dynamo d90715fab5 OpenAI: added option to setup a custom Tokenizer, increased default timeouts to 60 seconds 2023-10-17 20:59:29 +02:00
Heezer 50635b1499
support of database name configuration for Milvus (#233) 2023-10-17 20:52:12 +02:00
deep-learning-dynamo 43917ee474 Vertex AI: embed in batches of 5 2023-10-09 15:38:41 +02:00
deep-learning-dynamo eef1796963 fixing build 2023-10-09 13:09:25 +02:00
deep-learning-dynamo 77d6855021 Elasticsearch and OpenSearch: made exception classes public 2023-10-09 12:17:24 +02:00
deep-learning-dynamo cf276e844c OpenSearch: reformatted code 2023-10-09 12:16:42 +02:00
deep-learning-dynamo 6f0c962108 removed redundant javadoc 2023-10-09 12:09:57 +02:00
deep-learning-dynamo fb8ec688ea OpenSearch: added Java 11 requirement, slight refactoring 2023-10-09 12:09:24 +02:00
Ricardo Ferreira 79b825df63
Add Support for OpenSearch as Embedding Store (#208)
This PR contains the implementation of an integration with
[OpenSearch](https://opensearch.org/). As one of the growing vector
databases in the open source world, adding support for it to this
project makes total sense. This implementation includes:

1. A complete implementation of the `EmbeddingStore` interface.
2. Unit tests for the major use cases a store must implement correctly.
3. Usage of [TestContainers](https://testcontainers.com/) to automate
the execution of backends.
2023-10-09 11:45:27 +02:00
Simon Verhoeven 4dc3e6d2b3
feat: upgrade Lombok to 1.8.30 for JDK21 compatibility (#211)
Using 1.8.28 results in 

` java: java.lang.NoSuchFieldError: Class
com.sun.tools.javac.tree.JCTree$JCImport does not have member field
'com.sun.tools.javac.tree.JCTree qualid'`
2023-10-09 10:02:14 +02:00
Simon Verhoeven d0399d023b
fix: remove unused imports (#209) 2023-10-09 09:48:00 +02:00
deep-learning-dynamo 0f09f4ff98 "Getting started" fixed to use OpenAI dep instead of generic one (#203) 2023-10-09 09:40:34 +02:00
Heezer cd36933a7e
"Getting started" fixed to use OpenAI dep instead of generic one (#203) 2023-10-09 09:38:46 +02:00
Cedrick Lunven 2a3b5406de
Astra and Cassandra Store fixes (#201)
- Change the order of the returned list for chat 
- Improve `AstraDbEmbeddingStoreTest.java` that could actually failed if
the env environment was not set and we do not want that
2023-10-09 09:22:32 +02:00
deep-learning-dynamo 1c7eb6edd1 skipping compliance check for langchain4j-cassandra due to "Public Domain" license of org.json:json 2023-10-09 09:13:00 +02:00
deep-learning-dynamo b822e68150 added another variation of Apache 2 license name to acceptable licenses 2023-10-09 08:58:02 +02:00
LangChain4j 6217922643
Added Twitter/X shield 2023-10-08 10:32:50 +02:00
LangChain4j ad737589c8
Added Discord link 2023-10-05 08:22:33 +02:00
deep-learning-dynamo 6c186d57b9 released 0.23.0 2023-09-29 14:45:06 +02:00
deep-learning-dynamo 315eab8641 released 0.23.0 2023-09-29 14:27:51 +02:00
deep-learning-dynamo 707edd13e3 fixed okhttp version conflicts 2023-09-29 12:07:50 +02:00
deep-learning-dynamo 8be53cf8d1 added "stop" parameter to OpenAiChatModel and OpenAiStreamingChatModel 2023-09-29 10:39:25 +02:00