You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Use Azure Cosmos DB Mongo vCore with Langchain in Java.
2
+
3
+
This sample provides a demo showcasing the usage of the RAG pattern for integrating Azure Open AI services with custom data in Azure Cosmos DB MongoDB vCore, using langchain framework for java (https://github.com/langchain4j/langchain4j).
4
+
5
+
### Prerequisites
6
+
7
+
- Azure Cosmos DB Monogo Account
8
+
- Connection string
9
+
- Azure Open AI Service
10
+
- Deploy text-davinci-003 model for Embeding
11
+
- Deploy gpt-35-turbo model for Chat Completion
12
+
13
+
14
+
### Installation
15
+
```bash
16
+
mvn install
17
+
```
18
+
19
+
### Run
20
+
21
+
Before running the application, you need to set environment variables. Either export them in command line or set system variables:
22
+
23
+
```bash
24
+
export COSMOS_URI_HNSW="Cosmos DB MongoDB vCore connection string"
25
+
export AZURE_OPENAI_ENDPOINT="endpoint for your Azure OpenAI account"
26
+
export AZURE_OPENAI_APIKEY="key for your Azure OpenAI account"
27
+
export AZURE_OPENAI_CHATDEPLOYMENTID="deployment id for your Azure OpenAI chat embeddings"
28
+
export AZURE_OPENAI_EMBEDDINGDEPLOYMENTID="deployment is for your Azure OpenAI chat completions"
29
+
```
30
+
31
+
Then run the app:
32
+
33
+
```bash
34
+
mvn exec:java
35
+
```
36
+
37
+
## Getting Started
38
+
When you run the application for the first time, it will read and vectorize docs in the `PDF_docs` folder, and insert them into Cosmos DB MongoDB vCore vector store. To begin, just ask a question in command line.
0 commit comments