Skip to content

Commit 06bbe9e

Browse files
committed
python rag chatbot with Oracle Database 23ai v .1
1 parent f90572a commit 06bbe9e

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ MISSING
1717
## Notes/Issues
1818
Spring Boot 3.0 requires Java 17 as a minimum version.
1919

20+
2021
## URLs
2122
https://apexapps.oracle.com/pls/apex/r/dbpm/livelabs/view-workshop?wid=3874
2223

python-rag-chatbot/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
[**LangChain**](https://www.langchain.com/)
88

99

10-
10+
## TODO instructions
11+
12+
- setup ~/.oci/config
13+
- set yourcompartmentid
14+
- podman run -d --name 23ai -p 1521:1521 -e ORACLE_PWD=Welcome12345 -v oracle-volume:/Users/pparkins/oradata container-registry.oracle.com/database/free:latest
15+
- create/config vector tablespace and user
16+
- add oracle database info for use in init_rag_streamlit.py / init_rag_streamlit_exp.py
17+
- run run_oracle_bot.sh /run_oracle_bot_exp.sh
1118

1219

1320
## Documentation

python-rag-chatbot/init_rag.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
# private configs
5151
CONFIG_PROFILE = "DEFAULT"
52-
COMPARTMENT_OCID = "ocid1.compartment.oc1..aaaaaaaajdyhd7dqnix2avhlckbhhkkcl3cujzyuz6jzyzonadca3i66pqjq"
52+
COMPARTMENT_OCID = "ocid1.compartment.oc1..yourcompartmentid"
5353
oci_config = oci.config.from_file("~/.oci/config", CONFIG_PROFILE)
5454
COHERE_API_KEY = oci_config['security_token_file']
5555
DEBUG = True
@@ -155,7 +155,7 @@ def initialize_rag_chain():
155155

156156
llm = OCIGenAI(
157157
service_endpoint="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com",
158-
compartment_id="ocid1.compartment.oc1..aaaaaaaajdyhd7dqnix2avhlckbhhkkcl3cujzyuz6jzyzonadca3i66pqjq",
158+
compartment_id="ocid1.compartment.oc1..yourcompartmentid",
159159
model_kwargs={"max_tokens": 1000},
160160
auth_type='SECURITY_TOKEN',
161161
)

python-rag-chatbot/init_rag_streamlit_exp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363

6464
# private configs
6565
CONFIG_PROFILE = "DEFAULT"
66-
COMPARTMENT_OCID = "ocid1.compartment.oc1..aaaaaaaajdyhd7dqnix2avhlckbhhkkcl3cujzyuz6jzyzonadca3i66pqjq"
66+
COMPARTMENT_OCID = "ocid1.compartment.oc1..yourcompartmentid"
6767
oci_config = oci.config.from_file("~/.oci/config", CONFIG_PROFILE)
6868
COHERE_API_KEY = oci_config['security_token_file']
6969

@@ -252,7 +252,7 @@ def build_llm(llm_type):
252252
llm = OCIGenAI(
253253
model_id="cohere.command",
254254
service_endpoint="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com",
255-
compartment_id="ocid1.compartment.oc1..aaaaaaaajdyhd7dqnix2avhlckbhhkkcl3cujzyuz6jzyzonadca3i66pqjq",
255+
compartment_id="ocid1.compartment.oc1..yourcompartmentid",
256256
model_kwargs={"max_tokens": 200},
257257
auth_type='SECURITY_TOKEN',
258258
)

python-rag-chatbot/oci_llm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def _call(
9999
print(prompt)
100100
print()
101101

102-
print("Calling OCI genai...pankssssss")
102+
print("Calling OCI genai...")
103103
generate_text_response = self.generative_ai_client.generate_text(
104104
generate_text_detail
105105
)

0 commit comments

Comments
 (0)