Skip to content

Commit

Permalink
build_RAG_with_milvus_and_cognee: run black
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhonglin-ryan committed Dec 4, 2024
1 parent 0236afe commit 063b7a2
Showing 1 changed file with 14 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@
"source": [
"import os\n",
"\n",
"os.environ['OPENAI_API_KEY'] = \"sk-***********\"\n",
"os.environ[\"OPENAI_API_KEY\"] = \"sk-***********\"\n",
"\n",
"os.environ[\"VECTOR_DB_PROVIDER\"] = \"milvus\"\n",
"os.environ[\"VECTOR_DB_URL\"]='./milvus.db'"
"os.environ[\"VECTOR_DB_URL\"] = \"./milvus.db\""
],
"metadata": {
"collapsed": false,
Expand Down Expand Up @@ -269,10 +269,8 @@
"source": [
"from cognee.api.v1.search import SearchType\n",
"\n",
"query_text = 'How is data stored in milvus?'\n",
"search_results = await cognee.search(\n",
" SearchType.SUMMARIES, query_text=query_text\n",
")\n",
"query_text = \"How is data stored in milvus?\"\n",
"search_results = await cognee.search(SearchType.SUMMARIES, query_text=query_text)\n",
"\n",
"print(search_results[0])"
],
Expand Down Expand Up @@ -309,10 +307,8 @@
"source": [
"from cognee.api.v1.search import SearchType\n",
"\n",
"query_text = 'How is data stored in milvus?'\n",
"search_results = await cognee.search(\n",
" SearchType.CHUNKS, query_text=query_text\n",
")"
"query_text = \"How is data stored in milvus?\"\n",
"search_results = await cognee.search(SearchType.CHUNKS, query_text=query_text)"
],
"metadata": {
"collapsed": false
Expand All @@ -334,14 +330,15 @@
"outputs": [],
"source": [
"def format_and_print(data):\n",
" print(\"ID:\", data['id'])\n",
" print(\"ID:\", data[\"id\"])\n",
" print(\"\\nText:\\n\")\n",
" paragraphs = data['text'].split(\"\\n\\n\")\n",
" paragraphs = data[\"text\"].split(\"\\n\\n\")\n",
" for paragraph in paragraphs:\n",
" print(paragraph.strip())\n",
" print() \n",
" print()\n",
"\n",
"format_and_print(search_results[0])\n"
"\n",
"format_and_print(search_results[0])"
],
"metadata": {
"collapsed": false
Expand Down Expand Up @@ -398,7 +395,7 @@
"cell_type": "code",
"outputs": [],
"source": [
"text = 'Milvus is a vector database and stores vectors'\n",
"text = \"Milvus is a vector database and stores vectors\"\n",
"\n",
"await cognee.add(text)\n",
"await cognee.cognify()"
Expand All @@ -424,10 +421,8 @@
"cell_type": "code",
"outputs": [],
"source": [
"query_text = 'Tell me about Milvus'\n",
"search_results = await cognee.search(\n",
" SearchType.INSIGHTS, query_text=query_text\n",
")\n",
"query_text = \"Tell me about Milvus\"\n",
"search_results = await cognee.search(SearchType.INSIGHTS, query_text=query_text)\n",
"\n",
"for result_text in search_results:\n",
" print(result_text)"
Expand Down

0 comments on commit 063b7a2

Please sign in to comment.