From 6b5ffd139fe441841f9b80ced28ea0da4351aef8 Mon Sep 17 00:00:00 2001 From: Vasilije <8619304+Vasilije1990@users.noreply.github.com> Date: Sat, 16 Mar 2024 10:56:03 +0100 Subject: [PATCH] Update docs --- README.md | 11 ++++++++ cognee - Get Started.ipynb | 2 ++ docs/index.md | 53 +++++++++++++++++++++++++++++++++++++- 3 files changed, 65 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 690cdb88c..b195d1999 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,17 @@ poetry add cognee Check out our demo notebook [here](cognee%20-%20Get%20Started.ipynb) +- Set OpenAI API Key as an environment variable +``` +import os + +# Setting an environment variable +os.environ['OPENAI_API_KEY'] = '' + + +``` + + - Add a new piece of information to storage ``` import cognee diff --git a/cognee - Get Started.ipynb b/cognee - Get Started.ipynb index bc350a136..e1f716a1f 100644 --- a/cognee - Get Started.ipynb +++ b/cognee - Get Started.ipynb @@ -539,6 +539,8 @@ } ], "source": [ + "from cognee import search\n", + "from cognee.api.v1.search.search import SearchType\n", "query_params = {\n", " SearchType.SIMILARITY: {'query': 'your search query here'}\n", "}\n", diff --git a/docs/index.md b/docs/index.md index 206de7162..e97a6a63b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -36,6 +36,57 @@ We leverage Neo4j to do the heavy lifting and dlt to load the data, and we've bu pip install -U cognee ``` +Set OpenAI API Key as an environment variable + + +``` +import os + +# Setting an environment variable +os.environ['OPENAI_API_KEY'] = '' + + +``` + +Import cognee and start using it + + +``` +import cognee +from os import listdir, path +from cognee import add + +data_path = path.abspath(".data") + +results = await add(data_path, "izmene") +for result in results: + print(result) + +``` + +Run the following command to see the graph. +Make sure to add your Graphistry credentials to .env beforehand + +``` +from cognee.utils import render_graph + +graph = await cognee.cognify("izmene") +graph_url = await render_graph(graph, graph_type = "networkx") +print(graph_url) +``` + + +Search the graph for a piece of information + +``` +from cognee import search +from cognee.api.v1.search.search import SearchType +query_params = { + SearchType.SIMILARITY: {'query': 'your search query here'} +} +out = await search(graph, query_params) +``` + [//]: # (You can also check out our [cookbook](./examples/index.md) to learn more about how to use cognee.) @@ -48,7 +99,7 @@ pip install -U cognee The question of using cognee is fundamentally a question of why to structure data inputs and outputs for your llm workflows. -1. **Cost effective** — With our upcoming opensource release, cognee will extend the capabilities of your LLMs without the need for expensive data processing tools. +1. **Cost effective** — cognee extends the capabilities of your LLMs without the need for expensive data processing tools. 2. **Self contained** — cognee runs as a library and is simple to use