Commit Graph

248 Commits

Author SHA1 Message Date
LangChain4j ba7fabaa50
graal: cleanup (#297) 2023-11-19 12:59:24 +01:00
janglada 949bc25f63
Graal Integration for Local JS and Python Execution (#263)
This PR introduces GraalVM integration to enable local execution of
JavaScript and Python scripts by Langchain4j agents.
Major updates include:

-  New langchain4j-graal module for encapsulating integration logic.
-  Necessary infrastructure for invoking GraalVM and executing scripts.
-  Unit tests to validate the integration.
2023-11-19 09:19:48 +01:00
deep-learning-dynamo 903b3fb1ac reducing duplication of *EmbeddingStoreIT 2023-11-18 21:28:32 +01:00
deep-learning-dynamo bd802c352d reducing duplication of *EmbeddingStoreIT 2023-11-18 21:12:34 +01:00
deep-learning-dynamo 6aed16ab81 reducing duplication of *EmbeddingStoreIT 2023-11-18 20:17:59 +01:00
deep-learning-dynamo 09022d4a32 reducing duplication of *EmbeddingStoreIT 2023-11-18 20:15:46 +01:00
deep-learning-dynamo e0dc387cef reducing duplication of *EmbeddingStoreIT 2023-11-18 20:09:45 +01:00
deep-learning-dynamo 7c5cade3c0 reducing duplication of *EmbeddingStoreIT 2023-11-18 20:02:21 +01:00
deep-learning-dynamo e467beb64a reducing duplication of *EmbeddingStoreIT 2023-11-18 19:20:26 +01:00
deep-learning-dynamo 00c6068de3 reducing duplication of *EmbeddingStoreIT 2023-11-18 18:29:44 +01:00
deep-learning-dynamo 16f60dbef9 reducing duplication of *EmbeddingStoreIT 2023-11-18 16:23:29 +01:00
deep-learning-dynamo 9897d65a54 cleanup 2023-11-18 16:23:26 +01:00
LangChain4j ff998ac82d
build most modules with jdk 8 (#295)
Since we target java 8, CI build was updated to run most modules using
java 8, then modules requiring java 11 separately with java 11
2023-11-18 15:07:11 +01:00
deep-learning-dynamo 61e6a4bef0 added another variation of apache 2 license naming 2023-11-18 11:44:38 +01:00
aphethean1 09629a4111
Feature/elastic search restclient constructor (#291)
This PR addresses issue
https://github.com/langchain4j/langchain4j/issues/290
2023-11-18 11:24:12 +01:00
Eddú Meléndez Gonzales 111c213c06
Cleanup Testcontainers deps (#292)
* Update testcontainers version to 1.19.2
* Remove duplicated entries in dependencyManagement section
* Import testcontainers-bom
2023-11-18 10:20:16 +01:00
Aashish 2fb4d33530
Update README.md (#281)
Modified readme to make commiters name a clickable link
2023-11-15 00:01:10 +01:00
LangChain4j 968588f574
released 0.24.0 2023-11-12 19:11:30 +01:00
deep-learning-dynamo 21dfc8b317 released 0.24.0 2023-11-12 18:58:31 +01:00
deep-learning-dynamo 5e1bc74901 benedictstrube: Adding Memory Id to Tool Method Call 2023-11-12 10:07:10 +01:00
ZYinNJU 864eeeeb05
add bedrock bom (#278)
Hi! It seems like new `langchain4j-bedrock` module is not included in
`langchain4j-bom`, so I add it.
2023-11-12 08:59:12 +01:00
Jansen Ang 8398ccb8a6
fix: add properties for s3 loader integration tests to fix failing tests when credentials are absent (#275) 2023-11-10 17:52:27 +01:00
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