Closed chenggangqcg closed 3 months ago
Can you give me your OS, etc?
macos pyOpenSSL version is 22.0.0 Python 3.10.10
update my pyOpenSSL to 24.1.0, fixed. thanks
while I run:
1 import cognee
2
3 cognee.config.llm_api_key = "sk-XXX"
4 cognee.config.llm_endpoint = "https://XXX"
5
6 cognee.config.set_graphistry_username = "XXX"
7 cognee.config.set_graphistry_password = "XXX"
8
9 text = """Natural language processing (NLP) is an interdisciplinary
10 subfield of computer science and information retrieval"""
11
12 cognee.add(text) # Add a new piece of information
13
14 cognee.cognify() # Use LLMs and cognee to create knowledge
15
16 search_results = cognee.search("SIMILARITY", {'query': 'Tell me about NLP'}) # Query cognee for the knowledge
17
18 for result_text in search_results[0]:
19 print(result_text)
/Users/doudou/project/cognee/test.py:12: RuntimeWarning: coroutine 'add' was never awaited
cognee.add(text) # Add a new piece of information
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/Users/doudou/project/cognee/test.py:14: RuntimeWarning: coroutine 'cognify' was never awaited
cognee.cognify() # Use LLMs and cognee to create knowledge
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
File "/Users/doudou/project/cognee/test.py", line 18, in
We did a release to remove dspy. Best use fresh env to run cognee As for the problem, run it as an async function and await.
I used the lastest version v0.1.13, still got this error
We've got tests building and running a simple pipeline, they passed from what I got. I will ask @borisarzentar to look into it. Thanks for raising the issue!
while I run:
1 import cognee 2 3 cognee.config.llm_api_key = "sk-XXX" 4 cognee.config.llm_endpoint = "https://XXX" 5 6 cognee.config.set_graphistry_username = "XXX" 7 cognee.config.set_graphistry_password = "XXX" 8 9 text = """Natural language processing (NLP) is an interdisciplinary 10 subfield of computer science and information retrieval""" 11 12 cognee.add(text) # Add a new piece of information 13 14 cognee.cognify() # Use LLMs and cognee to create knowledge 15 16 search_results = cognee.search("SIMILARITY", {'query': 'Tell me about NLP'}) # Query cognee for the knowledge 17 18 for result_text in search_results[0]: 19 print(result_text)
Got the error:
/Users/doudou/project/cognee/test.py:12: RuntimeWarning: coroutine 'add' was never awaited cognee.add(text) # Add a new piece of information RuntimeWarning: Enable tracemalloc to get the object allocation traceback /Users/doudou/project/cognee/test.py:14: RuntimeWarning: coroutine 'cognify' was never awaited cognee.cognify() # Use LLMs and cognee to create knowledge RuntimeWarning: Enable tracemalloc to get the object allocation traceback Traceback (most recent call last): File "/Users/doudou/project/cognee/test.py", line 18, in for result_text in search_results[0]: TypeError: 'coroutine' object is not subscriptable sys:1: RuntimeWarning: coroutine 'search' was never awaited
@chenggangqcg add
, cognify
and search
are asynchronous functions, they need to be awaited, like await cognee.add(text)
, await cognee.cognify()
and search_results = await cognee.search(....)
Got it;
The sample is copied from the Readme in the repo. Maybe you should changed it.
Thanks!
Done
Python 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:12:31) [Clang 14.0.6 ] on darwin Type "help", "copyright", "credits" or "license" for more information.