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
This repository provides LangChain components for various OCI services. It aims to replace and expand upon the existing LangChain OCI components found in the `langchain-community` package in the LangChain repository.
3
+
Welcome to the official repository for LangChain integration with [Oracle Cloud Infrastructure (OCI)](https://cloud.oracle.com/). This library provides native LangChain components for interacting with Oracle's AI services—combining support for **OCI Generative AI** and **OCI Data Science**.
4
4
5
5
## Features
6
6
7
7
-**LLMs**: Includes LLM classes for OCI services like [Generative AI](https://cloud.oracle.com/ai-services/generative-ai) and [ModelDeployment Endpoints](https://cloud.oracle.com/ai-services/model-deployment), allowing you to leverage their language models within LangChain.
8
8
-**Agents**: Includes Runnables to support [Oracle Generative AI Agents](https://www.oracle.com/artificial-intelligence/generative-ai/agents/), allowing you to leverage Generative AI Agents within LangChain and LangGraph.
9
9
-**More to come**: This repository will continue to expand and offer additional components for various OCI services as development progresses.
10
10
11
-
**Note**: This repository will replace all OCI integrations currently present in the `langchain-community` package. Users are encouraged to migrate to this repository as soon as possible.
11
+
> This project merges and replaces earlier OCI integrations from the `langchain-community` repository and unifies contributions from Oracle's GenAI and Data Science teams.
12
+
> All integrations in this package assume that you have the credentials setup to connect with oci services.
13
+
14
+
---
12
15
13
16
## Installation
14
17
15
-
You can install the `langchain-oracle` package from PyPI.
18
+
19
+
```bash
20
+
pip install -U langchain-oci
21
+
```
22
+
23
+
---
24
+
25
+
## Quick Start
26
+
27
+
This repository includes two main integration categories:
28
+
29
+
-[OCI Generative AI](#oci-generative-ai-examples)
30
+
-[OCI Data Science (Model Deployment)](#oci-data-science-model-deployment-examples)
31
+
32
+
33
+
---
34
+
35
+
## OCI Generative AI Examples
36
+
37
+
### 1. Use a Chat Model
38
+
39
+
`ChatOCIGenAI` class exposes chat models from OCI Generative AI.
40
+
41
+
```python
42
+
from langchain_oci import ChatOCIGenAI
43
+
44
+
llm = ChatOCIGenAI()
45
+
llm.invoke("Sing a ballad of LangChain.")
46
+
```
47
+
48
+
### 2. Use a Completion Model
49
+
`OCIGenAI` class exposes LLMs from OCI Generative AI.
50
+
51
+
```python
52
+
from langchain_oci import OCIGenAI
53
+
54
+
llm = OCIGenAI()
55
+
llm.invoke("The meaning of life is")
56
+
```
57
+
58
+
### 3. Use an Embedding Model
59
+
`OCIGenAIEmbeddings` class exposes embeddings from OCI Generative AI.
60
+
61
+
```python
62
+
from langchain_oci import OCIGenAIEmbeddings
63
+
64
+
embeddings = OCIGenAIEmbeddings()
65
+
embeddings.embed_query("What is the meaning of life?")
66
+
```
67
+
68
+
69
+
## OCI Data Science Model Deployment Examples
70
+
71
+
### 1. Use a Chat Model
72
+
73
+
You may instantiate the OCI Data Science model with the generic `ChatOCIModelDeployment` or framework specific class like `ChatOCIModelDeploymentVLLM`.
74
+
75
+
```python
76
+
from langchain_oci.chat_models import ChatOCIModelDeployment, ChatOCIModelDeploymentVLLM
77
+
78
+
# Create an instance of OCI Model Deployment Endpoint
Copy file name to clipboardExpand all lines: libs/oci/README.md
+57-50Lines changed: 57 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,21 @@ pip install -U langchain-oci
9
9
```
10
10
All integrations in this package assume that you have the credentials setup to connect with oci services.
11
11
12
-
## Chat Models
12
+
---
13
13
14
-
### OCI Generative AI
14
+
## Quick Start
15
+
16
+
This repository includes two main integration categories:
17
+
18
+
-[OCI Generative AI](#oci-generative-ai-examples)
19
+
-[OCI Data Science (Model Deployment)](#oci-data-science-model-deployment-examples)
20
+
21
+
22
+
---
23
+
24
+
## OCI Generative AI Examples
25
+
26
+
### 1. Use a Chat Model
15
27
16
28
`ChatOCIGenAI` class exposes chat models from OCI Generative AI.
17
29
@@ -22,9 +34,32 @@ llm = ChatOCIGenAI()
22
34
llm.invoke("Sing a ballad of LangChain.")
23
35
```
24
36
25
-
### OCI Data Science
37
+
### 2. Use a Completion Model
38
+
`OCIGenAI` class exposes LLMs from OCI Generative AI.
39
+
40
+
```python
41
+
from langchain_oci import OCIGenAI
42
+
43
+
llm = OCIGenAI()
44
+
llm.invoke("The meaning of life is")
45
+
```
26
46
27
-
You may also instantiate the OCI Data Science model with the generic `ChatOCIModelDeployment` or framework specific class like `ChatOCIModelDeploymentVLLM`.
47
+
### 3. Use an Embedding Model
48
+
`OCIGenAIEmbeddings` class exposes embeddings from OCI Generative AI.
49
+
50
+
```python
51
+
from langchain_oci import OCIGenAIEmbeddings
52
+
53
+
embeddings = OCIGenAIEmbeddings()
54
+
embeddings.embed_query("What is the meaning of life?")
55
+
```
56
+
57
+
58
+
## OCI Data Science Model Deployment Examples
59
+
60
+
### 1. Use a Chat Model
61
+
62
+
You may instantiate the OCI Data Science model with the generic `ChatOCIModelDeployment` or framework specific class like `ChatOCIModelDeploymentVLLM`.
28
63
29
64
```python
30
65
from langchain_oci.chat_models import ChatOCIModelDeployment, ChatOCIModelDeploymentVLLM
0 commit comments