https://github.com/daveshap/nexus
Stream of consciousness nexus REST microservice
https://github.com/daveshap/nexus
Last synced: 12 months ago
JSON representation
Stream of consciousness nexus REST microservice
- Host: GitHub
- URL: https://github.com/daveshap/nexus
- Owner: daveshap
- License: mit
- Created: 2020-10-12T12:07:13.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-09-04T10:00:25.000Z (almost 4 years ago)
- Last Synced: 2025-04-07T20:44:05.926Z (about 1 year ago)
- Language: Python
- Size: 729 KB
- Stars: 19
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nexus REST Microservice
Stream of Consciousness REST microservice. Nexus of thought for artificial cognition.
- Rapid prototyping. Not for full-scale operations (yet)
- Biomimetic. Models human recall (associative and temporal memory)
Still a work in progress. Will be optimized for scale in the future. New endpoints will be added for different types of recall.

## TODO List
1. Firm up required endpoints (I think we're closing in on this)
2. Integrate blockchain for security
3. Integrate semantic search for speed
4. Integrate knowledge graph for speed
# Add message
- URL: `/add`
- Method: `POST`
### What it does:
- Add a memory to the nexus
- Save JSON payload to `/logs` directory for indexing/storage
- Timestamp and UUID added by Nexus service
- Content and vector are required, others are optional
### Example payload:
```json
{
"content": "I see a man sitting on a bench",
"vector": [0,0,0,1,1,1],
"microservice": "vision",
"model": "YOLO_v5",
}
```
### Response
- Returns `200` if successful
- Return `500` and error message if unsuccessful
# Semantic search
- URL: `/search`
- Method: `POST`
### What it does:
- Accepts semantic vector and count
- Uses `np.dot` product to find similar vectors
- Returns *n* number of top results
### Example payload:
```json
{
"vector": [0,0,0,1,1,1],
"count": 6,
}
```
### Example response:
- Response is a list of dictionaries.
```json
[
{"content": "I see a man on a bench"},
{"content": "I hear a police siren"},
]
```
# Match results
- URL: `/match`
- Method: `/post`
### What it does:
- Accepts a field and value
- Returns all logs with `field` that matches `value`
- Can be used to fetch all records with specific values, such as all messages created by certain model, or specific UUID
### Example payload:
```json
{
"field": "UUID",
"value": "b1be5ea3-5ec4-489b-9bb8-24f005a35a7d",
}
```
### Example response:
- Response is a list of dictionaries.
```json
[
{"content": "I see a man on a bench"},
]
```
# Bounded search
- URL: `/bound`
- Method: `/post`
### What it does:
- Accepts a `lower_bound` and `upper_bound`
- Returns all logs with timestamp between lower and upper bound
- Fetch all memories in a given time window
### Example payload:
```json
{
"lower_bound": 123.456,
"upper_bound": 456.789,
}
```
### Example response:
- Response is a list of dictionaries.
```json
[
{"content": "I see a man on a bench"},
]
```
# Recent messages
- URL: `/recent`
- Method: `/post`
### What it does:
- Returns all most recent memories
- Limited to *n* seconds
### Example payload:
```json
{
"seconds": 30,
}
```
### Example response:
- Response is a list of dictionaries.
```json
[
{"content": "I see a man on a bench"},
{"content": "I hear a police siren"},
]
```