-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
111 changed files
with
17,552 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# @ai16z/plugin-save-this | ||
# saveThisPlugin | ||
|
||
A plugin for Eliza that enables saving information from conversations as knowledge records. | ||
|
||
## Description | ||
|
||
The save-this plugin allows users to save important information from their conversations with Eliza for later reference. When a user starts a message with "save this", the plugin will process and store that information in the knowledge base, using the knowledge.set() method. | ||
|
||
This will create a document record in the memories table, with associated fragments for each message. The plugin will then provide a confirmation message to the user, such as "I've stored the information for you." | ||
|
||
In order to decide what to save, the action handler makes a generateText request to the llm with the last 7 messages. The prompt is carefully designed to extract the most relevant information from the conversation. | ||
|
||
## Installation | ||
|
||
```bash | ||
pnpm add @ai16z/plugin-save-this | ||
``` | ||
|
||
## Usage | ||
|
||
1. Import and register the plugin: | ||
|
||
```typescript | ||
import { saveThisPlugin } from '@ai16z/plugin-save-this'; | ||
|
||
|
||
2. Use in conversation: | ||
|
||
``` | ||
User: "save this: The meeting with John is scheduled for tomorrow at 2 PM" | ||
Eliza: "I've stored the information for you" | ||
``` | ||
## Configuration | ||
No additional configuration is required. The plugin uses Eliza's built-in knowledge storage system. | ||
### Triggering and use of State. | ||
Instead of an ACTION based trigger, the plugin uses the Provider to monitor for an explicit "save this" keyphrase at the beginning of a message. A typical action based trigger is not used, because I found that when multiple SAVE_MEMORY requests are done, eventually the LLM decides to start saving all messages to memory, and that is probably not what we want to do. | ||
If the "save this" keyphrase is found, the Provider will set a state variable to allow the action to proceed. So if the SAVE_THIS action is somehow triggered in another way, the handler aborts. | ||
## License | ||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
* | ||
|
||
!dist/** | ||
!package.json | ||
!readme.md | ||
!tsup.config.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import eslintGlobalConfig from "../../eslint.config.mjs"; | ||
|
||
export default [...eslintGlobalConfig]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "@ai16z/plugin-unreal", | ||
"version": "0.1.6", | ||
"main": "dist/index.js", | ||
"type": "module", | ||
"types": "dist/index.d.ts", | ||
"dependencies": { | ||
"@ai16z/eliza": "workspace:*", | ||
"@ai16z/adapter-postgres": "workspace:*", | ||
"tsup": "8.3.5" | ||
}, | ||
"scripts": { | ||
"build": "tsup --format esm --dts", | ||
"dev": "tsup --format esm --dts --watch", | ||
"lint": "eslint --fix --cache ." | ||
}, | ||
"peerDependencies": { | ||
"whatwg-url": "7.1.0" | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
packages/plugin-unreal/plugin-spreadsheet/INITIALIZATION.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Plugin Spreadsheet Initialization Flow | ||
|
||
## Overview | ||
This document describes the proper initialization flow for the Plugin Spreadsheet package, specifically focusing on the PropertyStorage system. | ||
|
||
## Initialization Chain | ||
|
||
1. **Plugin Creation** (`index.ts`) | ||
```typescript | ||
const storage = new MemoryPropertyStorage(); | ||
const service = new PropertyStorageService(storage); | ||
``` | ||
- MemoryPropertyStorage constructor is called | ||
- PropertyStorageService is created with the storage instance | ||
|
||
2. **Plugin Registration** | ||
- Plugin is registered with the Eliza runtime | ||
- Runtime calls initialize on the plugin | ||
- Plugin should initialize its services | ||
|
||
3. **Service Initialization** (`services.ts`) | ||
```typescript | ||
class PropertyStorageService { | ||
async initialize(runtime: IAgentRuntime) { | ||
// Should initialize the underlying storage | ||
await this.storage.initialize(runtime); | ||
} | ||
} | ||
``` | ||
- Service receives runtime during initialization | ||
- Service should pass runtime to storage layer | ||
|
||
4. **Storage Initialization** (`memory-storage.ts`) | ||
```typescript | ||
class MemoryPropertyStorage { | ||
initialize(runtime: AgentRuntime) { | ||
this.runtime = runtime; | ||
elizaLogger.info('MemoryPropertyStorage: Initializing with runtime', { | ||
hasRuntime: !!runtime, | ||
runtimeType: runtime?.constructor?.name, | ||
agentId: runtime?.agentId | ||
}); | ||
} | ||
} | ||
``` | ||
- Storage receives and stores runtime reference | ||
- Ready for operations like search | ||
|
||
## Common Issues | ||
|
||
1. **Missing Runtime** | ||
- Symptom: `StorageError: Runtime not initialized` | ||
- Cause: Operations attempted before proper initialization chain completion | ||
- Fix: Ensure service.initialize() is called and propagates to storage layer | ||
|
||
2. **Initialization Order** | ||
- The plugin must be fully initialized before any actions are handled | ||
- All search operations should check this.runtime exists before proceeding | ||
|
||
## Best Practices | ||
|
||
1. **Logging** | ||
- Use INFO level for initialization steps | ||
- Log runtime details during initialization for debugging | ||
- Log errors when runtime is missing | ||
|
||
2. **Error Handling** | ||
- Use StorageErrorCode.INTERNAL_ERROR for initialization issues | ||
- Provide clear error messages indicating initialization state | ||
|
||
3. **Runtime Validation** | ||
- Always check runtime exists before operations | ||
- Log detailed diagnostics when runtime is missing | ||
|
||
## Verification | ||
To verify proper initialization: | ||
1. Check logs for "MemoryPropertyStorage: Constructor called" | ||
2. Check logs for "MemoryPropertyStorage: Initializing with runtime" | ||
3. Verify runtime details are logged (hasRuntime, runtimeType, agentId) | ||
4. Test a simple search operation to confirm runtime is available |
Empty file.
93 changes: 93 additions & 0 deletions
93
packages/plugin-unreal/plugin-spreadsheet/design/1-system-overview.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# 1. System Overview | ||
|
||
## Architecture Overview | ||
|
||
```mermaid | ||
graph TD | ||
A[Eliza Plugin] --> B[Property Search Service] | ||
B --> C[Storage Interface] | ||
C --> D[Local Storage] | ||
C --> E[Cloud Storage] | ||
B --> F[Query Parser] | ||
F --> G[LLM Service] | ||
B --> H[NFT Market Service] | ||
H --> I[OpenSea API] | ||
``` | ||
|
||
## Core Components | ||
|
||
### 1. Property Search Service | ||
Central coordinator that manages: | ||
- Query processing | ||
- Storage selection | ||
- Result ranking | ||
- Market data integration | ||
|
||
### 2. Storage Interface | ||
Abstract interface supporting: | ||
- Vector similarity search | ||
- Structured filters | ||
- Batch operations | ||
|
||
### 3. Query Processing | ||
Multi-phase system: | ||
1. Query understanding (Eliza) | ||
2. Property search (Storage) | ||
3. Market enrichment (OpenSea) | ||
|
||
### 4. NFT Integration | ||
Provides: | ||
- Real-time pricing | ||
- Market analysis | ||
- Listing status | ||
|
||
## System Flow | ||
|
||
```mermaid | ||
sequenceDiagram | ||
participant U as User | ||
participant E as Eliza | ||
participant S as Storage | ||
participant M as Market | ||
U->>E: Natural language query | ||
E->>E: Parse query | ||
E->>S: Search properties | ||
E->>M: Get market data | ||
E->>E: Rank results | ||
E->>U: Return results | ||
``` | ||
|
||
## Key Features | ||
|
||
1. **Semantic Search** | ||
- Natural language queries | ||
- Vector similarity | ||
- Metadata filtering | ||
|
||
2. **Market Integration** | ||
- Real-time prices | ||
- Listing status | ||
- Price history | ||
|
||
3. **Flexible Storage** | ||
- Local development | ||
- Cloud scaling | ||
- Hybrid options | ||
|
||
## Next Steps | ||
|
||
1. **Implementation** | ||
- Start with storage abstraction | ||
- Add basic search | ||
- Integrate market data | ||
|
||
2. **Enhancement** | ||
- Improve query parsing | ||
- Add advanced filters | ||
- Optimize performance | ||
|
||
3. **Scale** | ||
- Deploy cloud service | ||
- Add caching | ||
- Monitor performance |
Oops, something went wrong.