fix: prevent dataset_name leaking into OpenAI requests
Signed-off-by: Babar Ali <148423037+Babarali2k21@users.noreply.github.com>
This commit is contained in:
parent
b339529621
commit
0f7db86342
2 changed files with 25 additions and 3 deletions
|
|
@ -192,9 +192,7 @@ class CogneeClient:
|
||||||
|
|
||||||
with redirect_stdout(sys.stderr):
|
with redirect_stdout(sys.stderr):
|
||||||
results = await self.cognee.search(
|
results = await self.cognee.search(
|
||||||
query_type=SearchType[query_type.upper()],
|
query_type=SearchType[query_type.upper()], query_text=query_text, top_k=top_k
|
||||||
query_text=query_text,
|
|
||||||
top_k=top_k
|
|
||||||
)
|
)
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
|
||||||
24
run_cognee.py
Normal file
24
run_cognee.py
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
import asyncio
|
||||||
|
import cognee
|
||||||
|
|
||||||
|
DATASET = "sheet6_demo"
|
||||||
|
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
# optional clean slate
|
||||||
|
await cognee.prune.prune_data()
|
||||||
|
await cognee.prune.prune_system(metadata=True)
|
||||||
|
|
||||||
|
await cognee.add("Cognee turns documents into AI memory.", dataset_name=DATASET)
|
||||||
|
|
||||||
|
# IMPORTANT: use datasets=[...] (not dataset_name=...)
|
||||||
|
await cognee.cognify(datasets=[DATASET])
|
||||||
|
|
||||||
|
results = await cognee.search(query_text="What does Cognee do?", datasets=[DATASET])
|
||||||
|
|
||||||
|
for r in results:
|
||||||
|
print(r.get("search_result"))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
asyncio.run(main())
|
||||||
Loading…
Add table
Reference in a new issue