Skip to content

Commit 2bd6bc2

Browse files
committed
Address PR review feedback
1 parent fccad71 commit 2bd6bc2

21 files changed

Lines changed: 198 additions & 444 deletions

File tree

integrations/cognee/.gitignore

Lines changed: 0 additions & 163 deletions
This file was deleted.

integrations/cognee/CHANGELOG.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

integrations/cognee/README.md

Lines changed: 7 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,125 +1,14 @@
11
# cognee-haystack
22

3-
[![PyPI](https://img.shields.io/pypi/v/cognee-haystack.svg)](https://pypi.org/project/cognee-haystack/)
4-
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
3+
[![PyPI - Version](https://img.shields.io/pypi/v/cognee-haystack.svg)](https://pypi.org/project/cognee-haystack)
4+
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/cognee-haystack.svg)](https://pypi.org/project/cognee-haystack)
55

6-
A [Haystack](https://haystack.deepset.ai/) integration for [Cognee](https://github.com/topoteretes/cognee) — open-source memory for AI agents.
6+
[Cognee](https://www.cognee.ai/) integration for [Haystack](https://haystack.deepset.ai/) — open-source memory for AI agents.
77

8-
[Cognee](https://www.cognee.ai/) gives agents persistent, traceable memory by transforming raw data (e.g., unstructured documents, relational databases, etc.) into a knowledge engine that is both searchable by meaning and connected by relationships. Cognee uses an ECL (Extract, Cognify, Load) pipeline: vector search, knowledge graphs, with support for ontology-based entity grounding (e.g. OWL) and Pydantic-defined graph schemas.
8+
- [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/cognee/CHANGELOG.md)
99

10-
Cognee serves developers and teams building agentic systems where agents need to retain context across sessions, learn from user feedback, and operate in multi-tenant, data-isolated environments. Cognee is available as an open-source Python library (Apache 2.0), a self-hosted/on-prem subscription tier, and a managed cloud service (Cognee Cloud at platform.cognee.ai).
10+
---
1111

12+
## Contributing
1213

13-
## Installation
14-
15-
```bash
16-
pip install cognee-haystack
17-
```
18-
19-
To use the `CogneeMemoryStore` with Haystack's experimental Agent:
20-
21-
```bash
22-
pip install "cognee-haystack[memory]"
23-
```
24-
25-
## Components
26-
27-
### CogneeWriter
28-
29-
Adds Haystack Documents to Cognee's knowledge engine via `cognee.add()`, with optional automatic `cognee.cognify()`.
30-
31-
```python
32-
from haystack import Document, Pipeline
33-
from haystack_integrations.components.connectors.cognee import CogneeWriter
34-
35-
pipeline = Pipeline()
36-
pipeline.add_component("writer", CogneeWriter(dataset_name="my_data", auto_cognify=True))
37-
38-
docs = [Document(content="Cognee builds a structured memory from unstructured data.")]
39-
pipeline.run({"writer": {"documents": docs}})
40-
```
41-
42-
### CogneeCognifier
43-
44-
Standalone `cognee.cognify()` step — useful when you want to separate adding and processing.
45-
46-
```python
47-
from haystack_integrations.components.connectors.cognee import CogneeCognifier
48-
49-
cognifier = CogneeCognifier()
50-
cognifier.run() # {"cognified": True}
51-
```
52-
53-
### CogneeRetriever
54-
55-
Searches Cognee's memory and returns Haystack `Document` objects.
56-
57-
```python
58-
from haystack import Pipeline
59-
from haystack_integrations.components.connectors.cognee import CogneeRetriever
60-
61-
pipeline = Pipeline()
62-
pipeline.add_component("retriever", CogneeRetriever(search_type="GRAPH_COMPLETION", top_k=5))
63-
64-
result = pipeline.run({"retriever": {"query": "What is Cognee?"}})
65-
for doc in result["retriever"]["documents"]:
66-
print(doc.content)
67-
```
68-
69-
**Supported search types:** `GRAPH_COMPLETION`, `CHUNKS`, `SUMMARIES`, `INSIGHTS`, and others from Cognee's `SearchType` enum.
70-
71-
### CogneeMemoryStore
72-
73-
Memory backend for Haystack's experimental Agent, backed by Cognee.
74-
75-
```python
76-
from haystack.dataclasses import ChatMessage
77-
from haystack_integrations.components.connectors.cognee import CogneeMemoryStore
78-
79-
store = CogneeMemoryStore(search_type="GRAPH_COMPLETION", top_k=5)
80-
81-
# Store memories
82-
store.add_memories(messages=[
83-
ChatMessage.from_user("The project deadline is next Friday.")
84-
])
85-
86-
# Recall memories
87-
results = store.search_memories(query="When is the deadline?")
88-
```
89-
90-
## Configuration
91-
92-
Cognee uses environment variables for its LLM and storage configuration:
93-
94-
```bash
95-
export LLM_API_KEY="sk-..."
96-
```
97-
98-
See the [Cognee documentation](https://docs.cognee.ai/) for additional configuration options.
99-
100-
## Examples
101-
102-
See the [`examples/`](examples/) directory for runnable demos:
103-
104-
- **`demo_pipeline.py`** — Index documents and search with CogneeWriter + CogneeRetriever
105-
- **`demo_memory_agent.py`** — Use CogneeMemoryStore as a conversational memory backend
106-
107-
## Development
108-
109-
```bash
110-
cd integrations/cognee
111-
112-
# Format and lint
113-
hatch run fmt
114-
hatch run fmt-check
115-
116-
# Type checking
117-
hatch run test:types
118-
119-
# Run tests
120-
hatch run test:unit
121-
```
122-
123-
## License
124-
125-
Apache 2.0 — see [LICENSE](LICENSE) for details.
14+
Refer to the general [Contribution Guidelines](https://github.com/deepset-ai/haystack-core-integrations/blob/main/CONTRIBUTING.md).

0 commit comments

Comments
 (0)