diff --git a/docs/core_docs/docs/integrations/document_loaders/web_loaders/oracleai.mdx b/docs/core_docs/docs/integrations/document_loaders/web_loaders/oracleai.mdx index c7ef4769bd75..6930b119b1e9 100644 --- a/docs/core_docs/docs/integrations/document_loaders/web_loaders/oracleai.mdx +++ b/docs/core_docs/docs/integrations/document_loaders/web_loaders/oracleai.mdx @@ -2,6 +2,9 @@ hide_table_of_contents: true --- +import Example from "@examples/document_loaders/oracleai"; +import CodeBlock from "@theme/CodeBlock"; + # Oracle AI This example goes over how to load documents using Oracle AI Vector Search. @@ -17,30 +20,7 @@ npm install @langchain/community @langchain/core oracledb ## Usage ### Connect to Oracle Database -You'll need to provide the username, password, hostname and service_name: - -```typescript -import oracledb from 'oracledb'; - -let connection: oracledb.Connection; - -// Replace the placeholders with your information -const username = ""; -const password = ""; -const dsn = "/"; - -try { - connection = await oracledb.getConnection({ - user: username, - password:password, - connectString: dsn - }); - console.log("Connection Successful"); -} catch (err) { - console.error('Connection failed:', err); - throw err; -} -``` +You'll need to set up an Oracle Database and connect to it providing your username, password, hostname and service_name: ### Load Documents As for loading documents, you have 3 options: @@ -50,24 +30,5 @@ As for loading documents, you have 3 options: When loading from the Oracle Database, you must provide the table's name, owner's name, and the name of the column to load. Optionally, you can provide extra column names to be included in the returned documents' metadata: -```typescript -import { OracleDocLoader, OracleLoadFromType } from "@langchain/community/document_loaders/web/oracleai"; - -/* -// Loading a local file (replace with the path of the file you want to load.) -const loader = new OracleDocLoader(connection, , OracleLoadFromType.FILE); - - -// Loading from a local directory (replace with the path of the directory you want to load from.) -const loader = new OracleDocLoader(connection, , OracleLoadFromType.DIR); -*/ - -// Loading from Oracle Database table (replace the placeholders with your information, optionally add a [metadata_cols] parameter to include columns as metadata.) -const loader = new OracleDocLoader(connection, , OracleLoadFromType.TABLE, , ); - -// Load the docs -const docs = loader.load(); -console.log("Number of docs loaded:", docs.length); -console.log("Document-0:", docs[0].page_content); // content -``` +{Example}