Skip to content

Commit

Permalink
exclude embeddings
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Jul 26, 2023
1 parent 3df6afe commit 09b5af3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
18 changes: 12 additions & 6 deletions easytask/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,16 @@ def create_task(goal, plan=None, steps=None):

def list_tasks():
debug = os.environ.get("DEBUG", False)
memories = get_memories("task", filter_metadata={"status": "in progress"})
memories = get_memories(
"task", filter_metadata={"status": "in progress"}, include_embeddings=False
)
log("Found {} tasks".format(len(memories)), log=debug)
return memories


def search_tasks(search_term):
# return tasks whose goal is most relevant to the search term
memories = search_memory("task", search_term)
memories = search_memory("task", search_term, include_embeddings=False, include_distances=False)
log("Found {} tasks".format(len(memories)), log=debug)
return memories

Expand Down Expand Up @@ -130,7 +132,7 @@ def cancel_task(task):
# Get Last Created Task
def get_last_created_task():
# return the task with the most recent created_at date
tasks = get_memories("task")
tasks = get_memories("task", include_embeddings=False)
sorted_tasks = sorted(
tasks, key=lambda x: x["metadata"]["created_at"], reverse=True
)
Expand All @@ -141,7 +143,7 @@ def get_last_created_task():
# Get Last Updated Task
def get_last_updated_task():
# return the task with the most recent updated_at date
tasks = get_memories("task")
tasks = get_memories("task", include_embeddings=False)
sorted_tasks = sorted(
tasks, key=lambda x: x["metadata"]["updated_at"], reverse=True
)
Expand All @@ -150,7 +152,9 @@ def get_last_updated_task():


def get_current_task():
memory = get_memories("task", filter_metadata={"current": True})
memory = get_memories(
"task", filter_metadata={"current": True}, include_embeddings=False
)
if len(memory) > 0:
log("Current task: {}".format(memory[0]), log=debug)
return memory[0]
Expand All @@ -162,7 +166,9 @@ def get_current_task():
def set_current_task(task):
task_id = get_task_id

memories = get_memories("task", filter_metadata={"current": True})
memories = get_memories(
"task", filter_metadata={"current": True}, include_embeddings=False
)

for memory in memories:
update_memory("task", memory["id"], metadata={"current": False})
Expand Down
3 changes: 2 additions & 1 deletion easytask/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ def test_list_tasks():
task = setup()
tasks = list_tasks()
assert isinstance(tasks, list)
assert task in tasks
# check that the task document is in the list of tasks' docments
assert task['document'] in [task['document'] for task in tasks]
teardown()


Expand Down

0 comments on commit 09b5af3

Please sign in to comment.