Skip to content

Commit

Permalink
Merge branch 'main' into revisit-content-and-fix-rerank
Browse files Browse the repository at this point in the history
  • Loading branch information
omarmahamid authored Jan 27, 2025
2 parents 8070e86 + ca5011a commit 2c7b3be
Show file tree
Hide file tree
Showing 254 changed files with 7,504 additions and 3,856 deletions.
14 changes: 11 additions & 3 deletions .github/langchain4j-github-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,30 @@ triage:
- '*-azure-*/**'
- id: gemini
labels: [Gemini]
title: "gemini|vertex"
title: "gemini|vertex|google"
notify: [glaforge]
notifyInPullRequest: true
files:
- '*-vertex-*/**'
- '*-google-*/**'
- id: elasticsearch
labels: [Elasticsearch]
title: "elasticsearch"
notify: [dadoonet]
notifyInPullRequest: true
files:
- '*-elasticsearch-*/**'
- 'langchain4j-elasticsearch/**'
- id: mistral
labels: [Mistral]
title: "mistral"
notify: [czelabueno]
notifyInPullRequest: true
files:
- '*-mistral-*/**'
- 'langchain4j-mistral-ai/**'
- id: mcp
labels: [MCP]
title: "mcp"
notify: [jmartisk]
notifyInPullRequest: true
files:
- 'langchain4j-mcp/**'
2 changes: 2 additions & 0 deletions .github/workflows/comment-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
env:
# https://docs.github.com/en/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ jobs:
run: |
mvn -B -U -T8C test javadoc:aggregate \
${{ matrix.mvn_opts }}
- name: Setup JBang
uses: jbangdev/setup-jbang@main
- name: Integration test with JDK ${{ matrix.java_version }}
## The step or job will only run if the `experimental` variable
## in the matrix is false (not set to true)
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/nightly_jdk17.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
project_id: ${{ secrets.GCP_PROJECT_ID }}
credentials_json: ${{ secrets.GCP_CREDENTIALS_JSON }}

- name: Setup JBang
uses: jbangdev/setup-jbang@main
- name: Build with JDK ${{ matrix.java_version }}
run: |
## compile and verify javadocs on ALL modules
Expand Down Expand Up @@ -84,7 +86,6 @@ jobs:
CI_DELAY_SECONDS_AZURE_OPENAI: 1
CI_DELAY_SECONDS_BEDROCK: 2
CI_DELAY_SECONDS_GITHUB_MODELS: 7
CI_DELAY_SECONDS_GOOGLE_AI_GEMINI: 5
CI_DELAY_SECONDS_VERTEX_AI_GEMINI: 12
CI_DELAY_SECONDS_VOYAGE_AI: 22

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/nightly_jdk21.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
project_id: ${{ secrets.GCP_PROJECT_ID }}
credentials_json: ${{ secrets.GCP_CREDENTIALS_JSON }}

- name: Setup JBang
uses: jbangdev/setup-jbang@main
- name: Build with JDK ${{ matrix.java_version }}
run: |
## compile and verify javadocs on ALL modules
Expand Down Expand Up @@ -84,7 +86,6 @@ jobs:
CI_DELAY_SECONDS_AZURE_OPENAI: 1
CI_DELAY_SECONDS_BEDROCK: 2
CI_DELAY_SECONDS_GITHUB_MODELS: 7
CI_DELAY_SECONDS_GOOGLE_AI_GEMINI: 5
CI_DELAY_SECONDS_VERTEX_AI_GEMINI: 12
CI_DELAY_SECONDS_VOYAGE_AI: 22

Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/receive-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ jobs:
# Execute recipes
- name: Apply OpenRewrite recipes
run: |
mvn --activate-profiles openrewrite \
-Dspotless.check.skip=true \
org.openrewrite.maven:rewrite-maven-plugin:run
mvn --activate-profiles openrewrite -Dspotless.check.skip=true rewrite:run
# Apply spotless
- name: Apply Spotless
run: |
mvn spotless:apply
# Capture the diff
- name: Create patch
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Thank you for investing your time and effort in contributing to our project, we

# General guidelines

- For new integrations, please consider adding it in [community repo](https://github.com/langchain4j/langchain4j-community) first.
- If you want to contribute a bug fix or a new feature that isn't listed in the [issues](https://github.com/langchain4j/langchain4j/issues) yet, please open a new issue for it. We will prioritize is shortly.
- Follow [Google's Best Practices for Java Libraries](https://jlbp.dev/)
- Keep the code compatible with Java 17.
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Here's how:
Since early 2023, the community has been building numerous LLM-powered applications,
identifying common abstractions, patterns, and techniques. LangChain4j has refined these into practical code.
Our toolbox includes tools ranging from low-level prompt templating, chat memory management, and function calling
to high-level patterns like AI Services and RAG.
to high-level patterns like Agents and RAG.
For each abstraction, we provide an interface along with multiple ready-to-use implementations based on common techniques.
Whether you're building a chatbot or developing a RAG with a complete pipeline from data ingestion to retrieval,
LangChain4j offers a wide variety of options.
Expand All @@ -50,6 +50,8 @@ the core functionality is in place, allowing you to start building LLM-powered a
## Documentation
Documentation can be found [here](https://docs.langchain4j.dev).

The documentation chatbot (experimental) can be found [here](https://chat.langchain4j.dev/).


## Getting Started
Getting started guide can be found [here](https://docs.langchain4j.dev/get-started).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-parent</artifactId>
<version>1.0.0-alpha1</version>
<version>1.0.0-alpha2-SNAPSHOT</version>
<relativePath>../../langchain4j-parent/pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-parent</artifactId>
<version>1.0.0-alpha1</version>
<version>1.0.0-alpha2-SNAPSHOT</version>
<relativePath>../../langchain4j-parent/pom.xml</relativePath>
</parent>

Expand Down
25 changes: 25 additions & 0 deletions docs/docs/integrations/document-loaders/classpath.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
sidebar_position: 3
---

# Classpath

## Maven Dependency

```xml
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j</artifactId>
<version>1.0.0-alpha1</version>
</dependency>
```


## APIs

- `ClassPathSource` / `ClassPathDocumentLoader`

## Examples

- [ClassPathSourceTests](https://github.com/langchain4j/langchain4j/blob/main/langchain4j/src/test/java/dev/langchain4j/data/document/source/ClassPathSourceTests.java)
- [ClassPathDocumentLoaderTest](https://github.com/langchain4j/langchain4j/blob/main/langchain4j/src/test/java/dev/langchain4j/data/document/loader/ClassPathDocumentLoaderTest.java)
2 changes: 1 addition & 1 deletion docs/docs/integrations/document-loaders/file-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sidebar_position: 3

## APIs

- `FileSystemDocumentLoader`
- `FileSystemSource` / `FileSystemDocumentLoader`


## Examples
Expand Down
38 changes: 29 additions & 9 deletions docs/docs/integrations/embedding-models/dashscope.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,74 @@ sidebar_position: 5

# DashScope

https://dashscope.aliyun.com/
[DashScope](https://dashscope.aliyun.com/) is a platform developed by [Alibaba Cloud](https://www.alibabacloud.com/).
It provides an interface for model visualization, monitoring, and debugging, particularly when working with AI/ML
models in production environments. The platform allows users to visualize performance metrics, track model behavior, and
identify potential issues early on in the deployment cycle.

[Qwen](https://tongyi.aliyun.com/) models are a series of generative AI models developed
by [Alibaba Cloud](https://www.alibabacloud.com/). The Qwen family of models are specifically designed for tasks like
text generation, summarization, question answering, and various NLP tasks.

You can refer
to [DashScope Document](https://help.aliyun.com/zh/model-studio/getting-started/?spm=a2c4g.11186623.help-menu-2400256.d_0.6655453aLIyxGp)
for more details. LangChain4j integrates with DashScope by
Using [DashScope Java SDK](https://help.aliyun.com/zh/dashscope/java-sdk-best-practices?spm=a2c4g.11186623.0.0.272a1507Ne69ja)

## Maven Dependency

:::note
Since `1.0.0-alpha1`, `langchain4j-dashscope` has migrated to `langchain4j-community` and is renamed to `langchain4j-community-dashscope`.
Since `1.0.0-alpha1`, `langchain4j-dashscope` has migrated to `langchain4j-community` and is renamed to
`langchain4j-community-dashscope`.
:::

`0.36.2` and previous:
Before `1.0.0-alpha1`:

```xml

<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-dashscope</artifactId>
<version>1.0.0-alpha1</version>
<version>${previous version here}</version>
</dependency>
```

`1.0.0-alpha1` and later:

```xml

<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-community-dashscope</artifactId>
<version>1.0.0-alpha1</version>
<version>${latest version here}</version>
</dependency>
```

Or, you can use BOM to manage dependencies consistently:

```xml

<dependencyManagement>
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-community-bom</artifactId>
<version>1.0.0-alpha1</version>
<version>${latest version here}</version>
<typ>pom</typ>
<scope>import</scope>
</dependency>
</dependencyManagement>
```

## APIs
## Configurable Parameters

- `QwenEmbeddingModel`
`QwenEmbeddingModel` has following parameters to configure when you initialize it:

| Property | Description | Default Value |
|-----------|------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|
| baseUrl | The URL to connect to. You can use HTTP or websocket to connect to DashScope | https://dashscope.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding |
| apiKey | The API Key | |
| modelName | The model to use. | text-embedding-v2 |

## Examples

- [QwenEmbeddingModelIT](https://github.com/langchain4j/langchain4j/blob/main/langchain4j-dashscope/src/test/java/dev/langchain4j/model/dashscope/QwenEmbeddingModelIT.java)
- [QwenEmbeddingModelIT](https://github.com/langchain4j/langchain4j-community/blob/main/models/langchain4j-community-dashscope/src/test/java/dev/langchain4j/community/model/dashscope/QwenEmbeddingModelIT.java)
71 changes: 69 additions & 2 deletions docs/docs/integrations/embedding-models/qianfan.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,88 @@ sidebar_position: 16

# Qianfan

[百度智能云千帆大模型](https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application)
![image](https://github.com/langchain4j/langchain4j/assets/95265298/600f8006-4484-4a75-829c-c8c16a3130c2)

## Maven Dependency

You can use DashScope with LangChain4j in plain Java or Spring Boot applications.

### Plain Java

:::note
Since `1.0.0-alpha1`, `langchain4j-qianfan` has migrated to `langchain4j-community` and is renamed to `langchain4j-community-qianfan`.
:::

Before `1.0.0-alpha1`:

```xml
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-qianfan</artifactId>
<version>1.0.0-alpha1</version>
<version>${previous version here}</version>
</dependency>
```

`1.0.0-alpha1` and later:

```xml
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-community-qianfan</artifactId>
<version>${latest version here}</version>
</dependency>
```

### Spring Boot

:::note
Since `1.0.0-alpha1`, `langchain4j-qianfan-spring-boot-starter` has migrated to `langchain4j-community` and is renamed
to `langchain4j-community-qianfan-spring-boot-starter`.
:::

Before `1.0.0-alpha1`:

```xml

<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-qianfan-spring-boot-starter</artifactId>
<version>${previous version here}</version>
</dependency>
```

`1.0.0-alpha1` and later:

```xml

<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-community-qianfan-spring-boot-starter</artifactId>
<version>${latest version here}</version>
</dependency>
```

Or, you can use BOM to manage dependencies consistently:

```xml

<dependencyManagement>
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-community-bom</artifactId>
<version>${latest version here}</version>
<typ>pom</typ>
<scope>import</scope>
</dependency>
</dependencyManagement>
```

## APIs

- `QianfanEmbeddingModel`


## Examples

- [QianfanEmbeddingModelIT](https://github.com/langchain4j/langchain4j/blob/main/langchain4j-qianfan/src/test/java/dev/langchain4j/model/qianfan/QianfanEmbeddingModelIT.java)
- [QianfanEmbeddingModelIT](https://github.com/langchain4j/langchain4j-community/blob/main/models/langchain4j-community-qianfan/src/test/java/dev/langchain4j/community/model/qianfan/QianfanEmbeddingModelIT.java)
Loading

0 comments on commit 2c7b3be

Please sign in to comment.