support for nondefault namespace; slight rewording in readme

pull/1218/head
Stefano Lottini 1 month ago
parent 1f681edd30
commit 290c8d7c9f

@ -142,13 +142,18 @@
"output_type": "stream",
"text": [
"Please enter your API Endpoint: https://01234567-89ab-cdef-0123-456789abcdef-us-east1.apps.astra.datastax.com\n",
"Please enter your Token ········\n"
"Please enter your Token: ········\n",
"Please enter your namespace. Leave empty for default: \n"
]
}
],
"source": [
"ASTRA_DB_API_ENDPOINT = input(\"Please enter your API Endpoint:\")\n",
"ASTRA_DB_APPLICATION_TOKEN = getpass(\"Please enter your Token\")"
"ASTRA_DB_APPLICATION_TOKEN = getpass(\"Please enter your Token:\")\n",
"\n",
"ASTRA_DB_KEYSPACE = input(\"Please enter your namespace. Leave empty for default:\")\n",
"if not ASTRA_DB_KEYSPACE:\n",
" ASTRA_DB_KEYSPACE = None"
]
},
{
@ -167,7 +172,7 @@
"outputs": [],
"source": [
"astra_db_client = DataAPIClient(token=ASTRA_DB_APPLICATION_TOKEN)\n",
"database = astra_db_client.get_database_by_api_endpoint(ASTRA_DB_API_ENDPOINT)"
"database = astra_db_client.get_database_by_api_endpoint(ASTRA_DB_API_ENDPOINT, namespace=ASTRA_DB_KEYSPACE)"
]
},
{
@ -246,18 +251,7 @@
"execution_count": 7,
"id": "6bf89454-9a55-4202-ab6b-ea15b2048f3d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'ok': 1}"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"client = openai.OpenAI(api_key=OPENAI_API_KEY)\n",
"embedding_model_name = \"text-embedding-3-small\"\n",
@ -796,7 +790,7 @@
"** end of logging\n",
"\n",
"A new generated quote:\n",
"- In politics, true virtue is the compass that guides a nation towards righteousness and prosperity.\n"
"- In politics, true virtue is the compass that guides us towards a better society.\n"
]
}
],
@ -830,7 +824,7 @@
"** end of logging\n",
"\n",
"A new generated quote:\n",
"The true measure of humanity lies in our treatment of animals, for in their eyes we see reflections of our own souls.\n"
"The true measure of humanity lies in our treatment of animals, for compassion towards all living beings reflects our moral essence.\n"
]
}
],

@ -8,8 +8,8 @@ These example notebooks demonstrate implementation of
the same GenAI standard RAG workload with different libraries and APIs.
To use [Astra DB](https://docs.datastax.com/en/astra/home/astra.html)
with its HTTP API interface, head to the "AstraPy" notebook (`astrapy`
is the Python client to interact with the database).
through its Data API interface, head to the "AstraPy" notebook (`astrapy`
is the Python client for the Data API).
If you prefer CQL access to the database (either with
[Astra DB](https://docs.datastax.com/en/astra-serverless/docs/vector-search/overview.html)

Loading…
Cancel
Save