|
63 | 63 |
|
64 | 64 | # private configs |
65 | 65 | CONFIG_PROFILE = "DEFAULT" |
66 | | -COMPARTMENT_OCID = "ocid1.compartment.oc1..yourcompartmentid" |
| 66 | +COMPARTMENT_OCID = "ocid1.compartment.oc1..yourcompartment" |
67 | 67 | oci_config = oci.config.from_file("~/.oci/config", CONFIG_PROFILE) |
68 | 68 | COHERE_API_KEY = oci_config['security_token_file'] |
69 | 69 |
|
@@ -134,6 +134,7 @@ def split_in_chunks(all_pages): |
134 | 134 | splits = post_process(splits) |
135 | 135 |
|
136 | 136 | print(f"Splitted the pdf in {len(splits)} chunks...") |
| 137 | + print("Size of splits: " + str(text_splitter.__sizeof__()) + "bytes") |
137 | 138 |
|
138 | 139 | return splits |
139 | 140 |
|
@@ -252,7 +253,7 @@ def build_llm(llm_type): |
252 | 253 | llm = OCIGenAI( |
253 | 254 | model_id="cohere.command", |
254 | 255 | service_endpoint="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com", |
255 | | - compartment_id="ocid1.compartment.oc1..yourcompartmentid", |
| 256 | + compartment_id="ocid1.compartment.oc1..yourCompartment", |
256 | 257 | model_kwargs={"max_tokens": 200}, |
257 | 258 | auth_type='SECURITY_TOKEN', |
258 | 259 | ) |
@@ -284,13 +285,14 @@ def initialize_rag_chain(): |
284 | 285 |
|
285 | 286 | # 3. Load embeddings model |
286 | 287 | embedder = create_cached_embedder() |
287 | | - |
| 288 | + print("Size of splits---: " + str(document_splits.__sizeof__()) + "bytes") |
288 | 289 | # 4. Create a Vectore Store and store embeddings |
289 | 290 | vectorstore = create_vector_store(VECTOR_STORE_NAME, document_splits, embedder) |
290 | 291 |
|
291 | 292 | # 5. Create a retriever |
292 | 293 | # increased num. of docs to 5 (default to 4) |
293 | 294 | # added optionally a reranker |
| 295 | + |
294 | 296 | retriever = create_retriever(vectorstore) |
295 | 297 |
|
296 | 298 | # 6. Build the LLM |
|
0 commit comments