Skip to content

Commit b2781e2

Browse files
Merge branch 'main' into 2024-05-29-adp-updates
2 parents 7973324 + 75ffd28 commit b2781e2

File tree

13 files changed

+481
-0
lines changed

13 files changed

+481
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Copyright (c) 2024 Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Low Code Modular RAG-based Knowledge Search Engine using OCI Generative AI, OCI Vector Search, and Oracle Integration Cloud
2+
3+
In this article, we'll explore how to enable an enterprise-grade RAG-based Knowledge Search Engine with a low-code approach.
4+
5+
You’ll learn how to use Oracle Integration Cloud to integrate and orchestrate business chanels like a Web Application built in Oracle Visual Builder, productivity channels like OCI Object Storage, local large and small language models (LLMs), and vector databases to ingest live data into the RAG-based Knowledge Search Engine store.
6+
7+
You'll use Oracle Cloud Infrastructure (OCI) Document Understanding to extract information from different document types. Leverage OCI Generative AI for document summarization, generation and synthesis of answers to questions on documents. Use OCI DB Cloud Service 23AI for Document Extraction, Vector Search and Embedding (using ONNX local models to the DB) capabilities , and apply local OCI Data Science models for better answers from advanced RAG.
8+
9+
Reviewed: 30.05.2024
10+
11+
# When to use this asset?
12+
13+
See the README document in the /files folder.
14+
15+
# How to use this asset?
16+
17+
See the README document in the /files folder.
18+
19+
# License
20+
21+
Copyright (c) 2024 Oracle and/or its affiliates.
22+
23+
Licensed under the Universal Permissive License (UPL), Version 1.0.
24+
25+
See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Low Code Modular RAG-based Knowledge Search Engine using OCI Generative AI, OCI Vector Search, and Oracle Integration Cloud
2+
3+
Reviewed: 30.05.2024
4+
5+
# Introduction
6+
7+
In this article, we'll explore how to enable an enterprise-grade RAG-based Knowledge Search Engine with a low-code approach.
8+
9+
You’ll learn how to use Oracle Integration Cloud to integrate and orchestrate business chanels like a Web Application built in Oracle Visual Builder, productivity channels like OCI Object Storage, local large and small language models (LLMs), and vector databases to ingest live data into the RAG-based Knowledge Search Engine store.
10+
11+
You'll use Oracle Cloud Infrastructure (OCI) Document Understanding to extract information from different document types. Leverage OCI Generative AI for document summarization, generation and synthesis of answers to questions on documents. Use OCI DB Cloud Service 23AI for Document Extraction, Vector Search and Embedding (using ONNX local models to the DB) capabilities , and apply local OCI Data Science models for better answers from advanced RAG.
12+
13+
# Prerequisites
14+
15+
Before getting started, make sure you have access to the following Oracle Cloud Infrastructure (OCI) services:
16+
17+
- OCI Generative AI Service (GenAI)
18+
- OCI Document Understanding Service
19+
- Oracle Integration Cloud (OIC) with Visual Builder(VBCS) enabled
20+
- OCI Object Storage
21+
- OCI Base Database Cloud Service (23ai)
22+
- OCI Data Science
23+
24+
And also, make sure you have access to the following Meta services:
25+
26+
- Whats App Business Account
27+
28+
# Solution Architecture
29+
30+
In this section, we'll dive into the building blocks of the solution architecture.
31+
<img src="./images/5_low-code-modular-rag-knowledge-search-engine-arch.png"></img>
32+
33+
We've built the application using Oracle Visual Builder (as part of OIC), and it smoothly runs through Oracle Integration Cloud as the main, low-code orchestration tool. OCI Document Understanding is there to handle the document extraction, OCI Base Database Cloud Service 23ai for document extraction, local embeddings using onnx models within Oracle 23ai, Generative AI for answer synthesis and OCI Data Science as the Reranker model for advance RAG:
34+
35+
1. Document Evaluation Tool App interface built using VBCS:
36+
37+
- A low-code or no-code approach for the Data Loader and Query Engine flows of your LLM Application with Oracle Integration visual orchestration tools and native adapters for different Social, Productivity and Business Data Channels (users input to the LLM App Engine, either documents, images, business data or queries) and Sources (source of the data used by the LLM App Engine), as well as native adapters to the different OCI Services used by the LLM App Engine (OCI Generative AI REST APIs, Vector Databases or Stores, Oracle Cloud Infrastructure Language REST APIs, Oracle Cloud Infrastructure Data Science Custom Model REST Endpoints and more). This helps to quickly set up your LLM Application Business Flows
38+
39+
2. An event-driven pattern to decouple the Document, Image and Business Data Channels and Sources as well as the Query Channels from the Data Loader and Query Engine modules of the LLM App Engine using the OCI Streaming Service (Oracle managed Kafka Service) and the native adapter we have for this OCI Service in Oracle Integration. This helps to enable a scalable and performant LLM application.
40+
41+
3. A private connection to 3rd party cloud, on-premises apps, systems, and so on, using the Oracle Integration Connectivity Agent, which is the key enabler for hybrid and multicloud integration architectures, specially in an LLM Application where documents, images, business data, query from users can come from those systems and you want to keep the transit for documents and data private and secured. This helps to improve the security of the end-to-end LLM Flow, keeping the traffic within private networks.
42+
43+
4. The possibility to use local LLM models within Oracle 23ai in OCI Base Database Cloud service and dedicate cluster for OCI Generative AI service (orchestrating OCI Base Database Cloud service 23ai ONNX models, OCI Generative AI Model Endpoints or OCI Data Science Model Endpoints using Oracle Integration cloud native adapters and with the connectivity agent for private models).
44+
45+
5. A flexible approach to plug or unplug your own User Interface (UI) for your LLM Application with the LLM APP Engine (in this case whatsapp for uploading documents), or a low-code approach to build the UI either using Visual App Builder under Oracle Integration (using Visual Builder Web App for the Q&A UI)
46+
47+
48+
49+
# Application Flow in Detail
50+
51+
In this application:
52+
53+
**Step1.**
54+
55+
# Code
56+
57+
58+
59+
# Conclusion
60+
61+
62+
### Authors
63+
64+
<a href="https://github.com/jcgocol">@jcgocol</a>, <a href="https://github.com/bobpeulen">@bobpeulen</a>
65+
66+
67+
# License
68+
69+
Copyright (c) 2024 Oracle and/or its affiliates.
70+
71+
Licensed under the Universal Permissive License (UPL), Version 1.0.
72+
73+
See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details.
74+
Loading
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM fnproject/fn-java-fdk-build:jdk17-1.0-latest as build-stage
2+
WORKDIR /function
3+
ENV MAVEN_OPTS -Dhttp.proxyHost= -Dhttp.proxyPort= -Dhttps.proxyHost= -Dhttps.proxyPort= -Dhttp.nonProxyHosts= -Dmaven.repo.local=/usr/share/maven/ref/repository
4+
ADD pom.xml /function/pom.xml
5+
RUN ["mvn", "package", "dependency:copy-dependencies", "-DincludeScope=runtime", "-DskipTests=true", "-Dmdep.prependGroupId=true", "-DoutputDirectory=target", "--fail-never"]
6+
ADD src /function/src
7+
RUN ["mvn", "package"]
8+
FROM fnproject/fn-java-fdk:jre17-1.0.187
9+
WORKDIR /function
10+
COPY --from=build-stage /function/target/*.jar /function/app/
11+
CMD ["com.example.HelloAIFunction::handleRequest"]
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Copyright (c) 2024 Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<!--
2+
Copyright (c) 2024 Oracle and/or its affiliates.
3+
4+
The Universal Permissive License (UPL), Version 1.0
5+
6+
Subject to the condition set forth below, permission is hereby granted to any
7+
person obtaining a copy of this software, associated documentation and/or data
8+
(collectively the "Software"), free of charge and under any and all copyright
9+
rights in the Software, and any and all patent rights owned or freely
10+
licensable by each licensor hereunder covering either (i) the unmodified
11+
Software as contributed to or provided by such licensor, or (ii) the Larger
12+
Works (as defined below), to deal in both
13+
14+
(a) the Software, and
15+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
16+
one is included with the Software (each a "Larger Work" to which the Software
17+
is contributed by such licensors),
18+
19+
without restriction, including without limitation the rights to copy, create
20+
derivative works of, display, perform, and distribute the Software and make,
21+
use, sell, offer for sale, import, export, have made, and have sold the
22+
Software and the Larger Work(s), and to sublicense the foregoing rights on
23+
either these or other terms.
24+
25+
This license is subject to the following condition:
26+
The above copyright notice and either this complete permission notice or at
27+
a minimum a reference to the UPL must be included in all copies or
28+
substantial portions of the Software.
29+
30+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36+
SOFTWARE.
37+
-->
38+
39+
## Functions overview
40+
[Document functions-overview](files/Fn.pdf)
41+
42+
### Author
43+
<a href="https://github.com/mikarinneoracle">mikarinneoracle</a>
44+
45+
# A Java AI featured function with local dev and then building and deploying to OCI Functions
46+
47+
This is an example how I'm locally developing and testing OCI Functions on my mac with Apple silicon that uses mainly ARM architecture and then building and deploying the same to Functions in OCI.
48+
49+
<p>
50+
51+
This example is based on the <a href="../java-helloworld-with-local-dev-and-oci-functions">java-helloworld-with-local-dev-and-oci-functions</a> and hence building and deploying is exactly the same but this time uses <code>OCI SDK</code> and <code>OCI Generative AI services</code> to produce the function output instead of just a simple "Hello World".
52+
53+
<p>
54+
55+
To do the OCI SDK authentication and authorization to use the GenAI services the function uses two options:
56+
<ul>
57+
<li>IAM regular <b>user auth</b> for the local dev and test on mac</li>
58+
<li><b>InstancePrincipal</b> auth for the OCI Function by passing config key <code>AUTH_INSTANCE_PRINCIPAL</code> with any value (then not being null)</li>
59+
</ul>
60+
61+
<p>
62+
IAM user option will work on both cases above, as local and as OCI Function.
63+
64+
<p>
65+
66+
Testing with curl (or pasting the APi Gateway url to a browser):
67+
68+
<p>
69+
70+
<pre>
71+
curl https://n3yu.....ghhi.apigateway.eu-frankfurt-1.oci.customer-oci.com/
72+
What happened today 05/31/2024 100 years ago ?
73+
74+
May 31, 2024 is May 31, 1924. Here are some events that occurred on this date:
75+
...
76+
</pre>
77+
78+
## License
79+
80+
Copyright (c) 2024 Oracle and/or its affiliates.
81+
82+
Licensed under the Universal Permissive License (UPL), Version 1.0.
83+
84+
See [LICENSE](LICENSE) for more details.
85+
86+
ORACLE AND ITS AFFILIATES DO NOT PROVIDE ANY WARRANTY WHATSOEVER, EXPRESS OR IMPLIED, FOR ANY SOFTWARE, MATERIAL OR CONTENT OF ANY KIND CONTAINED OR PRODUCED WITHIN THIS REPOSITORY, AND IN PARTICULAR SPECIFICALLY DISCLAIM ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. FURTHERMORE, ORACLE AND ITS AFFILIATES DO NOT REPRESENT THAT ANY CUSTOMARY SECURITY REVIEW HAS BEEN PERFORMED WITH RESPECT TO ANY SOFTWARE, MATERIAL OR CONTENT CONTAINED OR PRODUCED WITHIN THIS REPOSITORY. IN ADDITION, AND WITHOUT LIMITING THE FOREGOING, THIRD PARTIES MAY HAVE POSTED SOFTWARE, MATERIAL OR CONTENT TO THIS REPOSITORY WITHOUT ANY REVIEW. USE AT YOUR OWN RISK.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
schema_version: 20180708
2+
name: helloaifunc
3+
version: 0.0.1
4+
runtime: java
5+
build_image: fnproject/fn-java-fdk-build:jdk17-1.0.187
6+
run_image: fnproject/fn-java-fdk:jre17-1.0.187
7+
cmd: com.example.HelloAIFunction::handleRequest
8+
timeout: 120
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.example</groupId>
8+
<artifactId>Helloaifunc</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.source>17</maven.compiler.source>
13+
<maven.compiler.target>17</maven.compiler.target>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>com.fnproject.fn</groupId>
20+
<artifactId>api</artifactId>
21+
<version>1.0.187</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>com.fnproject.fn</groupId>
25+
<artifactId>runtime</artifactId>
26+
<version>1.0.187</version>
27+
</dependency>
28+
<dependency>
29+
<groupId>com.fnproject.fn</groupId>
30+
<artifactId>testing-core</artifactId>
31+
<version>1.0.187</version>
32+
</dependency>
33+
<dependency>
34+
<groupId>junit</groupId>
35+
<artifactId>junit</artifactId>
36+
<version>4.12</version>
37+
<scope>test</scope>
38+
</dependency>
39+
<dependency>
40+
<groupId>com.fasterxml.jackson.core</groupId>
41+
<artifactId>jackson-annotations</artifactId>
42+
<version>2.17.1</version>
43+
</dependency>
44+
<dependency>
45+
<groupId>com.oracle.oci.sdk</groupId>
46+
<artifactId>oci-java-sdk-core</artifactId>
47+
<version>3.37.2</version>
48+
</dependency>
49+
<dependency>
50+
<groupId>com.oracle.oci.sdk</groupId>
51+
<artifactId>oci-java-sdk-common</artifactId>
52+
<version>3.37.2</version>
53+
</dependency>
54+
<dependency>
55+
<groupId>com.oracle.oci.sdk</groupId>
56+
<artifactId>oci-java-sdk-generativeai</artifactId>
57+
<version>3.37.2</version>
58+
</dependency>
59+
<dependency>
60+
<groupId>com.oracle.oci.sdk</groupId>
61+
<artifactId>oci-java-sdk-generativeaiinference</artifactId>
62+
<version>3.37.2</version>
63+
</dependency>
64+
<dependency>
65+
<groupId>com.oracle.oci.sdk</groupId>
66+
<artifactId>oci-java-sdk-common-httpclient-jersey3</artifactId>
67+
<scope>runtime</scope>
68+
<version>3.37.2</version>
69+
</dependency>
70+
</dependencies>
71+
72+
</project>

0 commit comments

Comments
 (0)