Skip to content

Commit 4c016a7

Browse files
[notebooks] add nemo guardrails notebook (#313)
1 parent 257382a commit 4c016a7

17 files changed

+384
-50
lines changed

.github/workflows/_run_e2e_tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,12 @@ jobs:
8282
if: ${{ inputs.run-notebooks }}
8383
env:
8484
ASTRA_DB_TOKEN: "${{ secrets[inputs.astradb-token-secret-name] }}"
85+
ASTRA_DB_APPLICATION_TOKEN: "${{ secrets[inputs.astradb-token-secret-name] }}"
8586
ASTRA_DB_ENDPOINT: "${{ steps.astra-db.outputs.db_endpoint }}"
87+
ASTRA_DB_API_ENDPOINT: "${{ steps.astra-db.outputs.db_endpoint }}"
8688
ASTRA_DB_ID: "${{ steps.astra-db.outputs.db_id }}"
87-
OPENAI_API_KEY: "${{ secrets.E2E_TESTS_OPEN_AI_KEY }}"
8889
OPEN_AI_KEY: "${{ secrets.E2E_TESTS_OPEN_AI_KEY }}"
90+
OPENAI_API_KEY: "${{ secrets.E2E_TESTS_OPEN_AI_KEY }}"
8991
LANGCHAIN_API_KEY: "${{ secrets.E2E_TESTS_LANGCHAIN_API_KEY }}"
9092
LLAMA_CLOUD_API_KEY: "${{ secrets.E2E_TESTS_LLAMA_CLOUD_API_KEY }}"
9193
GCLOUD_ACCOUNT_KEY_JSON: "${{ secrets.E2E_TESTS_GCLOUD_ACCOUNT_KEY_JSON }}"

examples/notebooks/FLARE.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@
8484
"from getpass import getpass\n",
8585
"\n",
8686
"# Enter your settings for Astra DB and OpenAI:\n",
87-
"os.environ[\"ASTRA_DB_ENDPOINT\"] = input(\"Enter you Astra DB API Endpoint: \")\n",
88-
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter you Astra DB Token: \")\n",
87+
"os.environ[\"ASTRA_DB_ENDPOINT\"] = input(\"Enter your Astra DB API Endpoint: \")\n",
88+
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter your Astra DB Token: \")\n",
8989
"os.environ[\"OPEN_AI_KEY\"] = getpass(\"Enter your OpenAI API Key: \")"
9090
]
9191
},

examples/notebooks/QA_with_cassio.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@
112112
"from getpass import getpass\n",
113113
"\n",
114114
"# Enter your settings for Astra DB and OpenAI:\n",
115-
"os.environ[\"ASTRA_DB_ID\"] = input(\"Enter you Astra DB ID: \")\n",
116-
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter you Astra DB Token: \")\n",
115+
"os.environ[\"ASTRA_DB_ID\"] = input(\"Enter your Astra DB ID: \")\n",
116+
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter your Astra DB Token: \")\n",
117117
"os.environ[\"OPEN_AI_KEY\"] = getpass(\"Enter your OpenAI API Key: \")"
118118
]
119119
},

examples/notebooks/RAG_with_cassio.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@
120120
"from getpass import getpass\n",
121121
"\n",
122122
"# Enter your settings for Astra DB and OpenAI:\n",
123-
"os.environ[\"ASTRA_DB_ID\"] = input(\"Enter you Astra DB ID: \")\n",
124-
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter you Astra DB Token: \")\n",
123+
"os.environ[\"ASTRA_DB_ID\"] = input(\"Enter your Astra DB ID: \")\n",
124+
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter your Astra DB Token: \")\n",
125125
"os.environ[\"OPEN_AI_KEY\"] = getpass(\"Enter your OpenAI API Key: \")"
126126
]
127127
},
@@ -467,7 +467,7 @@
467467
"name": "python",
468468
"nbconvert_exporter": "python",
469469
"pygments_lexer": "ipython3",
470-
"version": "3.11.7"
470+
"version": "3.11.2"
471471
}
472472
},
473473
"nbformat": 4,

examples/notebooks/advancedRAG.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@
7979
"import getpass\n",
8080
"import os\n",
8181
"\n",
82-
"os.environ[\"ASTRA_DB_ENDPOINT\"] = input(\"Enter you Astra DB API Endpoint: \")\n",
83-
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter you Astra DB Token: \")\n",
82+
"os.environ[\"ASTRA_DB_ENDPOINT\"] = input(\"Enter your Astra DB API Endpoint: \")\n",
83+
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter your Astra DB Token: \")\n",
8484
"os.environ[\"OPEN_AI_KEY\"] = getpass(\"Enter your OpenAI API Key: \")"
8585
]
8686
},

examples/notebooks/astradb.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@
162162
},
163163
"outputs": [],
164164
"source": [
165-
"os.environ[\"ASTRA_DB_ENDPOINT\"] = input(\"Enter you Astra DB API Endpoint: \")\n",
166-
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter you Astra DB Token: \")"
165+
"os.environ[\"ASTRA_DB_ENDPOINT\"] = input(\"Enter your Astra DB API Endpoint: \")\n",
166+
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter your Astra DB Token: \")"
167167
]
168168
},
169169
{
@@ -765,8 +765,8 @@
765765
},
766766
"outputs": [],
767767
"source": [
768-
"os.environ[\"ASTRA_DB_ID\"] = input(\"Enter you Astra DB ID: \")\n",
769-
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter you Astra DB Token: \")"
768+
"os.environ[\"ASTRA_DB_ID\"] = input(\"Enter your Astra DB ID: \")\n",
769+
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter your Astra DB Token: \")"
770770
]
771771
},
772772
{

examples/notebooks/langchain-unstructured-astra.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373
"\n",
7474
"os.environ[\"UNSTRUCTURED_API_KEY\"] = getpass(\"Enter your Unstructured API Key:\")\n",
7575
"os.environ[\"UNSTRUCTURED_API_URL\"] = getpass(\"Enter your Unstructured API URL:\")\n",
76-
"os.environ[\"ASTRA_DB_ENDPOINT\"] = input(\"Enter you Astra DB API Endpoint: \")\n",
77-
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter you Astra DB Token: \")\n",
76+
"os.environ[\"ASTRA_DB_ENDPOINT\"] = input(\"Enter your Astra DB API Endpoint: \")\n",
77+
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter your Astra DB Token: \")\n",
7878
"os.environ[\"OPENAI_API_KEY\"] = getpass(\"Enter your OpenAI API Key: \")"
7979
]
8080
},
@@ -443,7 +443,7 @@
443443
"Your answer:\n",
444444
"\"\"\"\n",
445445
"\n",
446-
"llm = ChatOpenAI(model=\"gpt-3.5-turbo-16k\", streaming=False, temperature=0)\n",
446+
"llm = ChatOpenAI(model=\"gpt-3.5-turbo\", streaming=False, temperature=0)\n",
447447
"\n",
448448
"chain = (\n",
449449
" {\"context\": astra_db_store.as_retriever(), \"question\": RunnablePassthrough()}\n",

examples/notebooks/langchain_evaluation.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@
7878
"from getpass import getpass\n",
7979
"\n",
8080
"# Enter your settings for Astra DB and OpenAI:\n",
81-
"os.environ[\"ASTRA_DB_ENDPOINT\"] = input(\"Enter you Astra DB API Endpoint: \")\n",
82-
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter you Astra DB Token: \")\n",
81+
"os.environ[\"ASTRA_DB_ENDPOINT\"] = input(\"Enter your Astra DB API Endpoint: \")\n",
82+
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter your Astra DB Token: \")\n",
8383
"os.environ[\"OPEN_AI_KEY\"] = getpass(\"Enter your OpenAI API Key: \")"
8484
]
8585
},
@@ -643,7 +643,7 @@
643643
"name": "python",
644644
"nbconvert_exporter": "python",
645645
"pygments_lexer": "ipython3",
646-
"version": "3.11.7"
646+
"version": "3.11.2"
647647
}
648648
},
649649
"nbformat": 4,

examples/notebooks/langchain_multimodal_gemini.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@
103103
"from getpass import getpass\n",
104104
"\n",
105105
"# Enter your settings for Astra DB:\n",
106-
"os.environ[\"ASTRA_DB_ENDPOINT\"] = input(\"Enter you Astra DB Endpoint: \")\n",
107-
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter you Astra DB Token: \")"
106+
"os.environ[\"ASTRA_DB_ENDPOINT\"] = input(\"Enter your Astra DB Endpoint: \")\n",
107+
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter your Astra DB Token: \")"
108108
]
109109
},
110110
{
@@ -136,7 +136,7 @@
136136
},
137137
"outputs": [
138138
{
139-
"name": "stdin",
139+
"name": "stdout",
140140
"output_type": "stream",
141141
"text": [
142142
"Enter Google JSON credentials file: ········\n"

examples/notebooks/llama-astra.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@
7979
"from getpass import getpass\n",
8080
"\n",
8181
"# Enter your settings for Astra DB and OpenAI:\n",
82-
"os.environ[\"ASTRA_DB_ENDPOINT\"] = input(\"Enter you Astra DB API Endpoint: \")\n",
83-
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter you Astra DB Token: \")\n",
82+
"os.environ[\"ASTRA_DB_ENDPOINT\"] = input(\"Enter your Astra DB API Endpoint: \")\n",
83+
"os.environ[\"ASTRA_DB_TOKEN\"] = getpass(\"Enter your Astra DB Token: \")\n",
8484
"os.environ[\"OPEN_AI_KEY\"] = getpass(\"Enter your OpenAI API Key: \")"
8585
]
8686
},

0 commit comments

Comments
 (0)