langchain-xache 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- langchain_xache-0.1.0/PKG-INFO +199 -0
- langchain_xache-0.1.0/README.md +168 -0
- langchain_xache-0.1.0/langchain_xache.egg-info/PKG-INFO +199 -0
- langchain_xache-0.1.0/langchain_xache.egg-info/SOURCES.txt +15 -0
- langchain_xache-0.1.0/langchain_xache.egg-info/dependency_links.txt +1 -0
- langchain_xache-0.1.0/langchain_xache.egg-info/requires.txt +9 -0
- langchain_xache-0.1.0/langchain_xache.egg-info/top_level.txt +1 -0
- langchain_xache-0.1.0/pyproject.toml +67 -0
- langchain_xache-0.1.0/setup.cfg +4 -0
- langchain_xache-0.1.0/xache_langchain/__init__.py +59 -0
- langchain_xache-0.1.0/xache_langchain/_async_utils.py +56 -0
- langchain_xache-0.1.0/xache_langchain/chat_history.py +194 -0
- langchain_xache-0.1.0/xache_langchain/collective.py +254 -0
- langchain_xache-0.1.0/xache_langchain/extraction.py +229 -0
- langchain_xache-0.1.0/xache_langchain/memory.py +181 -0
- langchain_xache-0.1.0/xache_langchain/reputation.py +237 -0
- langchain_xache-0.1.0/xache_langchain/retriever.py +221 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: langchain-xache
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: LangChain integration for Xache Protocol - verifiable AI agent memory
|
|
5
|
+
Author-email: Xache Protocol <dev@xache.xyz>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://xache.xyz
|
|
8
|
+
Project-URL: Documentation, https://docs.xache.xyz
|
|
9
|
+
Project-URL: Repository, https://github.com/oliveskin/xache
|
|
10
|
+
Keywords: langchain,ai,agents,memory,blockchain,receipts,reputation,erc8004,x402
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
Requires-Dist: xache>=0.1.0
|
|
24
|
+
Requires-Dist: langchain>=0.1.0
|
|
25
|
+
Requires-Dist: pydantic>=2.0.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
29
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
31
|
+
|
|
32
|
+
# langchain-xache
|
|
33
|
+
|
|
34
|
+
LangChain integration for [Xache Protocol](https://xache.xyz) - verifiable AI agent memory with cryptographic receipts, collective intelligence, and portable ERC-8004 reputation.
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install langchain-xache
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
### One-Line Memory Replacement
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
# Before (standard LangChain)
|
|
48
|
+
from langchain.memory import ConversationBufferMemory
|
|
49
|
+
memory = ConversationBufferMemory()
|
|
50
|
+
|
|
51
|
+
# After (with Xache - one line change!)
|
|
52
|
+
from xache_langchain import XacheMemory
|
|
53
|
+
memory = XacheMemory(
|
|
54
|
+
wallet_address="0x...",
|
|
55
|
+
private_key="0x..."
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Everything else stays the same
|
|
59
|
+
agent = initialize_agent(tools, llm, memory=memory)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Features
|
|
63
|
+
|
|
64
|
+
### Memory Storage
|
|
65
|
+
Persistent memory that survives across sessions with cryptographic receipts:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from xache_langchain import XacheMemory
|
|
69
|
+
|
|
70
|
+
memory = XacheMemory(
|
|
71
|
+
wallet_address="0xYourWallet",
|
|
72
|
+
private_key="0xYourPrivateKey",
|
|
73
|
+
api_url="https://api.xache.xyz", # optional
|
|
74
|
+
chain="base" # or "solana"
|
|
75
|
+
)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Retrieval (RAG)
|
|
79
|
+
Semantic search for retrieval-augmented generation:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from xache_langchain import XacheRetriever
|
|
83
|
+
from langchain.chains import RetrievalQA
|
|
84
|
+
|
|
85
|
+
retriever = XacheRetriever(
|
|
86
|
+
wallet_address="0x...",
|
|
87
|
+
private_key="0x...",
|
|
88
|
+
k=5 # number of documents
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
qa = RetrievalQA.from_chain_type(llm=llm, retriever=retriever)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Collective Intelligence
|
|
95
|
+
Query and contribute to shared knowledge:
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from xache_langchain import XacheCollectiveContributeTool, XacheCollectiveQueryTool
|
|
99
|
+
|
|
100
|
+
# Add to your agent's tools
|
|
101
|
+
contribute = XacheCollectiveContributeTool(
|
|
102
|
+
wallet_address="0x...",
|
|
103
|
+
private_key="0x..."
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
query = XacheCollectiveQueryTool(
|
|
107
|
+
wallet_address="0x...",
|
|
108
|
+
private_key="0x..."
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
tools = [contribute, query, ...]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Memory Extraction
|
|
115
|
+
Auto-extract memories from conversations:
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
from xache_langchain import XacheExtractor
|
|
119
|
+
|
|
120
|
+
extractor = XacheExtractor(
|
|
121
|
+
wallet_address="0x...",
|
|
122
|
+
private_key="0x...",
|
|
123
|
+
mode="xache-managed" # or "api-key" with your LLM key
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
result = extractor.extract(
|
|
127
|
+
trace="User asked about quantum computing...",
|
|
128
|
+
auto_store=True # automatically store extracted memories
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
print(f"Extracted {len(result.memories)} memories")
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Reputation
|
|
135
|
+
Check and verify agent reputation:
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
from xache_langchain import XacheReputationTool, XacheReputationChecker
|
|
139
|
+
|
|
140
|
+
# As a tool for your agent
|
|
141
|
+
rep_tool = XacheReputationTool(
|
|
142
|
+
wallet_address="0x...",
|
|
143
|
+
private_key="0x..."
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
# Or check other agents
|
|
147
|
+
checker = XacheReputationChecker(
|
|
148
|
+
wallet_address="0x...",
|
|
149
|
+
private_key="0x..."
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
other_rep = checker.check("did:agent:evm:0xOtherAgent...")
|
|
153
|
+
if other_rep.score >= 0.5:
|
|
154
|
+
print("Agent is trustworthy")
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Chat History
|
|
158
|
+
|
|
159
|
+
For more control over message history:
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
from xache_langchain import XacheChatMessageHistory
|
|
163
|
+
from langchain.memory import ConversationBufferMemory
|
|
164
|
+
|
|
165
|
+
history = XacheChatMessageHistory(
|
|
166
|
+
wallet_address="0x...",
|
|
167
|
+
private_key="0x...",
|
|
168
|
+
session_id="unique-session-id"
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
memory = ConversationBufferMemory(chat_memory=history)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Pricing
|
|
175
|
+
|
|
176
|
+
All operations use x402 micropayments (auto-handled):
|
|
177
|
+
|
|
178
|
+
| Operation | Price |
|
|
179
|
+
|-----------|-------|
|
|
180
|
+
| Memory Store | $0.002 |
|
|
181
|
+
| Memory Retrieve | $0.003 |
|
|
182
|
+
| Collective Contribute | $0.002 |
|
|
183
|
+
| Collective Query | $0.011 |
|
|
184
|
+
| Extraction (managed) | $0.011 |
|
|
185
|
+
|
|
186
|
+
## ERC-8004 Portable Reputation
|
|
187
|
+
|
|
188
|
+
Xache supports [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) for portable, on-chain reputation. Enable it to make your agent's reputation verifiable across platforms.
|
|
189
|
+
|
|
190
|
+
## Resources
|
|
191
|
+
|
|
192
|
+
- [Documentation](https://docs.xache.xyz)
|
|
193
|
+
- [API Reference](https://docs.xache.xyz/api)
|
|
194
|
+
- [GitHub](https://github.com/oliveskin/xache)
|
|
195
|
+
- [Discord](https://discord.gg/xache)
|
|
196
|
+
|
|
197
|
+
## License
|
|
198
|
+
|
|
199
|
+
MIT
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# langchain-xache
|
|
2
|
+
|
|
3
|
+
LangChain integration for [Xache Protocol](https://xache.xyz) - verifiable AI agent memory with cryptographic receipts, collective intelligence, and portable ERC-8004 reputation.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install langchain-xache
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### One-Line Memory Replacement
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
# Before (standard LangChain)
|
|
17
|
+
from langchain.memory import ConversationBufferMemory
|
|
18
|
+
memory = ConversationBufferMemory()
|
|
19
|
+
|
|
20
|
+
# After (with Xache - one line change!)
|
|
21
|
+
from xache_langchain import XacheMemory
|
|
22
|
+
memory = XacheMemory(
|
|
23
|
+
wallet_address="0x...",
|
|
24
|
+
private_key="0x..."
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
# Everything else stays the same
|
|
28
|
+
agent = initialize_agent(tools, llm, memory=memory)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
### Memory Storage
|
|
34
|
+
Persistent memory that survives across sessions with cryptographic receipts:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from xache_langchain import XacheMemory
|
|
38
|
+
|
|
39
|
+
memory = XacheMemory(
|
|
40
|
+
wallet_address="0xYourWallet",
|
|
41
|
+
private_key="0xYourPrivateKey",
|
|
42
|
+
api_url="https://api.xache.xyz", # optional
|
|
43
|
+
chain="base" # or "solana"
|
|
44
|
+
)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Retrieval (RAG)
|
|
48
|
+
Semantic search for retrieval-augmented generation:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from xache_langchain import XacheRetriever
|
|
52
|
+
from langchain.chains import RetrievalQA
|
|
53
|
+
|
|
54
|
+
retriever = XacheRetriever(
|
|
55
|
+
wallet_address="0x...",
|
|
56
|
+
private_key="0x...",
|
|
57
|
+
k=5 # number of documents
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
qa = RetrievalQA.from_chain_type(llm=llm, retriever=retriever)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Collective Intelligence
|
|
64
|
+
Query and contribute to shared knowledge:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from xache_langchain import XacheCollectiveContributeTool, XacheCollectiveQueryTool
|
|
68
|
+
|
|
69
|
+
# Add to your agent's tools
|
|
70
|
+
contribute = XacheCollectiveContributeTool(
|
|
71
|
+
wallet_address="0x...",
|
|
72
|
+
private_key="0x..."
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
query = XacheCollectiveQueryTool(
|
|
76
|
+
wallet_address="0x...",
|
|
77
|
+
private_key="0x..."
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
tools = [contribute, query, ...]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Memory Extraction
|
|
84
|
+
Auto-extract memories from conversations:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from xache_langchain import XacheExtractor
|
|
88
|
+
|
|
89
|
+
extractor = XacheExtractor(
|
|
90
|
+
wallet_address="0x...",
|
|
91
|
+
private_key="0x...",
|
|
92
|
+
mode="xache-managed" # or "api-key" with your LLM key
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
result = extractor.extract(
|
|
96
|
+
trace="User asked about quantum computing...",
|
|
97
|
+
auto_store=True # automatically store extracted memories
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
print(f"Extracted {len(result.memories)} memories")
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Reputation
|
|
104
|
+
Check and verify agent reputation:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from xache_langchain import XacheReputationTool, XacheReputationChecker
|
|
108
|
+
|
|
109
|
+
# As a tool for your agent
|
|
110
|
+
rep_tool = XacheReputationTool(
|
|
111
|
+
wallet_address="0x...",
|
|
112
|
+
private_key="0x..."
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
# Or check other agents
|
|
116
|
+
checker = XacheReputationChecker(
|
|
117
|
+
wallet_address="0x...",
|
|
118
|
+
private_key="0x..."
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
other_rep = checker.check("did:agent:evm:0xOtherAgent...")
|
|
122
|
+
if other_rep.score >= 0.5:
|
|
123
|
+
print("Agent is trustworthy")
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Chat History
|
|
127
|
+
|
|
128
|
+
For more control over message history:
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
from xache_langchain import XacheChatMessageHistory
|
|
132
|
+
from langchain.memory import ConversationBufferMemory
|
|
133
|
+
|
|
134
|
+
history = XacheChatMessageHistory(
|
|
135
|
+
wallet_address="0x...",
|
|
136
|
+
private_key="0x...",
|
|
137
|
+
session_id="unique-session-id"
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
memory = ConversationBufferMemory(chat_memory=history)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Pricing
|
|
144
|
+
|
|
145
|
+
All operations use x402 micropayments (auto-handled):
|
|
146
|
+
|
|
147
|
+
| Operation | Price |
|
|
148
|
+
|-----------|-------|
|
|
149
|
+
| Memory Store | $0.002 |
|
|
150
|
+
| Memory Retrieve | $0.003 |
|
|
151
|
+
| Collective Contribute | $0.002 |
|
|
152
|
+
| Collective Query | $0.011 |
|
|
153
|
+
| Extraction (managed) | $0.011 |
|
|
154
|
+
|
|
155
|
+
## ERC-8004 Portable Reputation
|
|
156
|
+
|
|
157
|
+
Xache supports [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) for portable, on-chain reputation. Enable it to make your agent's reputation verifiable across platforms.
|
|
158
|
+
|
|
159
|
+
## Resources
|
|
160
|
+
|
|
161
|
+
- [Documentation](https://docs.xache.xyz)
|
|
162
|
+
- [API Reference](https://docs.xache.xyz/api)
|
|
163
|
+
- [GitHub](https://github.com/oliveskin/xache)
|
|
164
|
+
- [Discord](https://discord.gg/xache)
|
|
165
|
+
|
|
166
|
+
## License
|
|
167
|
+
|
|
168
|
+
MIT
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: langchain-xache
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: LangChain integration for Xache Protocol - verifiable AI agent memory
|
|
5
|
+
Author-email: Xache Protocol <dev@xache.xyz>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://xache.xyz
|
|
8
|
+
Project-URL: Documentation, https://docs.xache.xyz
|
|
9
|
+
Project-URL: Repository, https://github.com/oliveskin/xache
|
|
10
|
+
Keywords: langchain,ai,agents,memory,blockchain,receipts,reputation,erc8004,x402
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
Requires-Dist: xache>=0.1.0
|
|
24
|
+
Requires-Dist: langchain>=0.1.0
|
|
25
|
+
Requires-Dist: pydantic>=2.0.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
29
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
31
|
+
|
|
32
|
+
# langchain-xache
|
|
33
|
+
|
|
34
|
+
LangChain integration for [Xache Protocol](https://xache.xyz) - verifiable AI agent memory with cryptographic receipts, collective intelligence, and portable ERC-8004 reputation.
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install langchain-xache
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
### One-Line Memory Replacement
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
# Before (standard LangChain)
|
|
48
|
+
from langchain.memory import ConversationBufferMemory
|
|
49
|
+
memory = ConversationBufferMemory()
|
|
50
|
+
|
|
51
|
+
# After (with Xache - one line change!)
|
|
52
|
+
from xache_langchain import XacheMemory
|
|
53
|
+
memory = XacheMemory(
|
|
54
|
+
wallet_address="0x...",
|
|
55
|
+
private_key="0x..."
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Everything else stays the same
|
|
59
|
+
agent = initialize_agent(tools, llm, memory=memory)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Features
|
|
63
|
+
|
|
64
|
+
### Memory Storage
|
|
65
|
+
Persistent memory that survives across sessions with cryptographic receipts:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from xache_langchain import XacheMemory
|
|
69
|
+
|
|
70
|
+
memory = XacheMemory(
|
|
71
|
+
wallet_address="0xYourWallet",
|
|
72
|
+
private_key="0xYourPrivateKey",
|
|
73
|
+
api_url="https://api.xache.xyz", # optional
|
|
74
|
+
chain="base" # or "solana"
|
|
75
|
+
)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Retrieval (RAG)
|
|
79
|
+
Semantic search for retrieval-augmented generation:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from xache_langchain import XacheRetriever
|
|
83
|
+
from langchain.chains import RetrievalQA
|
|
84
|
+
|
|
85
|
+
retriever = XacheRetriever(
|
|
86
|
+
wallet_address="0x...",
|
|
87
|
+
private_key="0x...",
|
|
88
|
+
k=5 # number of documents
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
qa = RetrievalQA.from_chain_type(llm=llm, retriever=retriever)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Collective Intelligence
|
|
95
|
+
Query and contribute to shared knowledge:
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from xache_langchain import XacheCollectiveContributeTool, XacheCollectiveQueryTool
|
|
99
|
+
|
|
100
|
+
# Add to your agent's tools
|
|
101
|
+
contribute = XacheCollectiveContributeTool(
|
|
102
|
+
wallet_address="0x...",
|
|
103
|
+
private_key="0x..."
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
query = XacheCollectiveQueryTool(
|
|
107
|
+
wallet_address="0x...",
|
|
108
|
+
private_key="0x..."
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
tools = [contribute, query, ...]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Memory Extraction
|
|
115
|
+
Auto-extract memories from conversations:
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
from xache_langchain import XacheExtractor
|
|
119
|
+
|
|
120
|
+
extractor = XacheExtractor(
|
|
121
|
+
wallet_address="0x...",
|
|
122
|
+
private_key="0x...",
|
|
123
|
+
mode="xache-managed" # or "api-key" with your LLM key
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
result = extractor.extract(
|
|
127
|
+
trace="User asked about quantum computing...",
|
|
128
|
+
auto_store=True # automatically store extracted memories
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
print(f"Extracted {len(result.memories)} memories")
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Reputation
|
|
135
|
+
Check and verify agent reputation:
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
from xache_langchain import XacheReputationTool, XacheReputationChecker
|
|
139
|
+
|
|
140
|
+
# As a tool for your agent
|
|
141
|
+
rep_tool = XacheReputationTool(
|
|
142
|
+
wallet_address="0x...",
|
|
143
|
+
private_key="0x..."
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
# Or check other agents
|
|
147
|
+
checker = XacheReputationChecker(
|
|
148
|
+
wallet_address="0x...",
|
|
149
|
+
private_key="0x..."
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
other_rep = checker.check("did:agent:evm:0xOtherAgent...")
|
|
153
|
+
if other_rep.score >= 0.5:
|
|
154
|
+
print("Agent is trustworthy")
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Chat History
|
|
158
|
+
|
|
159
|
+
For more control over message history:
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
from xache_langchain import XacheChatMessageHistory
|
|
163
|
+
from langchain.memory import ConversationBufferMemory
|
|
164
|
+
|
|
165
|
+
history = XacheChatMessageHistory(
|
|
166
|
+
wallet_address="0x...",
|
|
167
|
+
private_key="0x...",
|
|
168
|
+
session_id="unique-session-id"
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
memory = ConversationBufferMemory(chat_memory=history)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Pricing
|
|
175
|
+
|
|
176
|
+
All operations use x402 micropayments (auto-handled):
|
|
177
|
+
|
|
178
|
+
| Operation | Price |
|
|
179
|
+
|-----------|-------|
|
|
180
|
+
| Memory Store | $0.002 |
|
|
181
|
+
| Memory Retrieve | $0.003 |
|
|
182
|
+
| Collective Contribute | $0.002 |
|
|
183
|
+
| Collective Query | $0.011 |
|
|
184
|
+
| Extraction (managed) | $0.011 |
|
|
185
|
+
|
|
186
|
+
## ERC-8004 Portable Reputation
|
|
187
|
+
|
|
188
|
+
Xache supports [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) for portable, on-chain reputation. Enable it to make your agent's reputation verifiable across platforms.
|
|
189
|
+
|
|
190
|
+
## Resources
|
|
191
|
+
|
|
192
|
+
- [Documentation](https://docs.xache.xyz)
|
|
193
|
+
- [API Reference](https://docs.xache.xyz/api)
|
|
194
|
+
- [GitHub](https://github.com/oliveskin/xache)
|
|
195
|
+
- [Discord](https://discord.gg/xache)
|
|
196
|
+
|
|
197
|
+
## License
|
|
198
|
+
|
|
199
|
+
MIT
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
langchain_xache.egg-info/PKG-INFO
|
|
4
|
+
langchain_xache.egg-info/SOURCES.txt
|
|
5
|
+
langchain_xache.egg-info/dependency_links.txt
|
|
6
|
+
langchain_xache.egg-info/requires.txt
|
|
7
|
+
langchain_xache.egg-info/top_level.txt
|
|
8
|
+
xache_langchain/__init__.py
|
|
9
|
+
xache_langchain/_async_utils.py
|
|
10
|
+
xache_langchain/chat_history.py
|
|
11
|
+
xache_langchain/collective.py
|
|
12
|
+
xache_langchain/extraction.py
|
|
13
|
+
xache_langchain/memory.py
|
|
14
|
+
xache_langchain/reputation.py
|
|
15
|
+
xache_langchain/retriever.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
xache_langchain
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "langchain-xache"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "LangChain integration for Xache Protocol - verifiable AI agent memory"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Xache Protocol", email = "dev@xache.xyz"}
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"langchain",
|
|
17
|
+
"ai",
|
|
18
|
+
"agents",
|
|
19
|
+
"memory",
|
|
20
|
+
"blockchain",
|
|
21
|
+
"receipts",
|
|
22
|
+
"reputation",
|
|
23
|
+
"erc8004",
|
|
24
|
+
"x402",
|
|
25
|
+
]
|
|
26
|
+
classifiers = [
|
|
27
|
+
"Development Status :: 4 - Beta",
|
|
28
|
+
"Intended Audience :: Developers",
|
|
29
|
+
"License :: OSI Approved :: MIT License",
|
|
30
|
+
"Programming Language :: Python :: 3",
|
|
31
|
+
"Programming Language :: Python :: 3.9",
|
|
32
|
+
"Programming Language :: Python :: 3.10",
|
|
33
|
+
"Programming Language :: Python :: 3.11",
|
|
34
|
+
"Programming Language :: Python :: 3.12",
|
|
35
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
36
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
37
|
+
]
|
|
38
|
+
dependencies = [
|
|
39
|
+
"xache>=0.1.0",
|
|
40
|
+
"langchain>=0.1.0",
|
|
41
|
+
"pydantic>=2.0.0",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[project.optional-dependencies]
|
|
45
|
+
dev = [
|
|
46
|
+
"pytest>=7.0.0",
|
|
47
|
+
"pytest-asyncio>=0.21.0",
|
|
48
|
+
"black>=23.0.0",
|
|
49
|
+
"isort>=5.12.0",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[project.urls]
|
|
53
|
+
Homepage = "https://xache.xyz"
|
|
54
|
+
Documentation = "https://docs.xache.xyz"
|
|
55
|
+
Repository = "https://github.com/oliveskin/xache"
|
|
56
|
+
|
|
57
|
+
[tool.setuptools.packages.find]
|
|
58
|
+
where = ["."]
|
|
59
|
+
include = ["xache_langchain*"]
|
|
60
|
+
|
|
61
|
+
[tool.black]
|
|
62
|
+
line-length = 88
|
|
63
|
+
target-version = ['py39', 'py310', 'py311', 'py312']
|
|
64
|
+
|
|
65
|
+
[tool.isort]
|
|
66
|
+
profile = "black"
|
|
67
|
+
line_length = 88
|