Context
LangChain is the most widely used LLM framework. Many users will want to plug NoUse into an existing LangChain chain or agent.
Task
Create `examples/langchain_example.py` showing how to use NoUse as a context injector in a LangChain pipeline.
Suggested approach
```python
from langchain_openai import ChatOpenAI
from langchain_core.messages import SystemMessage, HumanMessage
import nouse
brain = nouse.attach()
llm = ChatOpenAI(model="gpt-4.1-mini")
question = "Explain the relationship between attention and memory in transformers."
context = brain.query(question).context_block()
messages = [
SystemMessage(content=context),
HumanMessage(content=question),
]
response = llm.invoke(messages)
print(response.content)
```
Notes
- Keep it minimal — the pattern is the point, not the chain depth
- A comment explaining where NoUse fits (context injector before the LLM call) is more valuable than boilerplate
Context
LangChain is the most widely used LLM framework. Many users will want to plug NoUse into an existing LangChain chain or agent.
Task
Create `examples/langchain_example.py` showing how to use NoUse as a context injector in a LangChain pipeline.
Suggested approach
```python
from langchain_openai import ChatOpenAI
from langchain_core.messages import SystemMessage, HumanMessage
import nouse
brain = nouse.attach()
llm = ChatOpenAI(model="gpt-4.1-mini")
question = "Explain the relationship between attention and memory in transformers."
context = brain.query(question).context_block()
messages = [
SystemMessage(content=context),
HumanMessage(content=question),
]
response = llm.invoke(messages)
print(response.content)
```
Notes