-
Notifications
You must be signed in to change notification settings - Fork 3
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
2,001 changed files
with
82 additions
and
347,627 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
## This is a script to be able to rewind anything I am looking at on my computer and view it again. |
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,58 @@ | ||
import pickle | ||
import time | ||
|
||
# AI Component | ||
def process_command(command): | ||
if command == "rewind to 10 minutes ago": | ||
return "rewind_to_10_minutes_ago" | ||
elif command == "restore to last snapshot": | ||
return "restore_to_last_snapshot" | ||
else: | ||
return "unknown_command" | ||
|
||
# Vector Database Simulation | ||
class VectorDatabase: | ||
def __init__(self): | ||
self.db = {} | ||
|
||
def add_snapshot(self, timestamp, snapshot): | ||
self.db[timestamp] = snapshot | ||
|
||
def get_snapshot(self, timestamp): | ||
return self.db.get(timestamp) | ||
|
||
# Snapshotting | ||
def capture_snapshot(): | ||
snapshot = {"files": ["file1.txt", "file2.txt"], "processes": ["process1", "process2"]} | ||
return pickle.dumps(snapshot) | ||
|
||
# Restoring | ||
def restore_snapshot(snapshot_data): | ||
snapshot = pickle.loads(snapshot_data) | ||
print("Restoring snapshot:", snapshot) | ||
|
||
# Main Function | ||
def main(): | ||
db = VectorDatabase() | ||
|
||
while True: | ||
command = input("Enter command: ") | ||
action = process_command(command) | ||
|
||
if action == "rewind_to_10_minutes_ago": | ||
snapshot = capture_snapshot() | ||
timestamp = time.time() - 600 # 10 minutes ago | ||
db.add_snapshot(timestamp, snapshot) | ||
print("Snapshot taken and stored.") | ||
|
||
elif action == "restore_to_last_snapshot": | ||
last_timestamp = max(db.db.keys()) | ||
snapshot_data = db.get_snapshot(last_timestamp) | ||
restore_snapshot(snapshot_data) | ||
print("Restored to last snapshot.") | ||
|
||
else: | ||
print("Unknown command.") | ||
|
||
if __name__ == "__main__": | ||
main() |
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,23 @@ | ||
## This is just a placeholder for now | ||
|
||
import chromadb | ||
# setup Chroma in-memory, for easy prototyping. Can add persistence easily! | ||
client = chromadb.Client() | ||
|
||
# Create collection. get_collection, get_or_create_collection, delete_collection also available! | ||
collection = client.create_collection("all-my-documents") | ||
|
||
# Add docs to the collection. Can also update and delete. Row-based API coming soon! | ||
collection.add( | ||
documents=["This is document1", "This is document2"], # we handle tokenization, embedding, and indexing automatically. You can skip that and add your own embeddings as well | ||
metadatas=[{"source": "notion"}, {"source": "google-docs"}], # filter on these! | ||
ids=["doc1", "doc2"], # unique for each doc | ||
) | ||
|
||
# Query/search 2 most similar results. You can also .get by id | ||
results = collection.query( | ||
query_texts=["This is a query document"], | ||
n_results=2, | ||
# where={"metadata_field": "is_equal_to_this"}, # optional filter | ||
# where_document={"$contains":"search_string"} # optional filter | ||
) |
Oops, something went wrong.
274783a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
stableagents – ./
stableagents-stableagents.vercel.app
stableagents.com
www.stableagents.com
agents.community
lightapi.com
stableactions.com
stableagents-early-version.vercel.app
actions.community
stableagents-git-main-stableagents.vercel.app