Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
vyokky committed Mar 19, 2024
1 parent b3602b6 commit 46af9fb
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 23 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ufo/config/config_llm.yaml
ufo/rag/app_docs/*
learner/records.json
vectordb/docs/*
vectordb/experience/*

# Don't ignore the example files
!vectordb/docs/example/
Expand Down
11 changes: 5 additions & 6 deletions ufo/module/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,14 +375,13 @@ def rag_experience_retrieve(self):
:return: The retrieved examples and tips string.
"""

if self.experience_retriever:
# Retrieve experience examples. Only retrieve the examples that are related to the current application.

experience_docs = self.experience_retriever.retrieve(self.request, configs["RAG_EXPERIENCE_RETRIEVED_TOPK"],
filter=lambda x: self.app_root.lower() in [app.lower() for app in x["app_list"]])
# Retrieve experience examples. Only retrieve the examples that are related to the current application.
experience_docs = self.experience_retriever.retrieve(self.request, configs["RAG_EXPERIENCE_RETRIEVED_TOPK"],
filter=lambda x: self.app_root.lower() in [app.lower() for app in x["app_list"]])

if experience_docs:
examples = [doc.metadata.get("example", {}) for doc in experience_docs]
tips = [doc.metadata.get("Tips", "") for doc in experience_docs]

else:
examples = []
tips = []
Expand Down
9 changes: 4 additions & 5 deletions ufo/rag/retriever_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def __init__(self, app_name:str) -> None:
:appname: The name of the application.
"""
self.app_name = app_name
self.indexer_path = self.get_offline_indexer_path()
self.indexer = self.get_indexer()
indexer_path = self.get_offline_indexer_path()
self.indexer = self.get_indexer(indexer_path)


def get_offline_indexer_path(self):
Expand Down Expand Up @@ -93,7 +93,7 @@ def get_indexer(self, path: str):
db = FAISS.load_local(path, embeddings)
return db
except:
print_with_color("Error: Failed to load offline indexer from {path}.".format(path=path), "red")
print_with_color("Warning: Failed to load offline indexer from {path}.".format(path=path), "yellow")
return None


Expand All @@ -117,13 +117,12 @@ def get_indexer(self, db_path: str):
:param query: The query to create an indexer for.
"""


try:
embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-mpnet-base-v2")
db = FAISS.load_local(db_path, embeddings)
return db
except:
print_with_color("Error: Failed to load experience indexer from {path}.".format(path=db_path), "red")
print_with_color("Warning: Failed to load experience indexer from {path}.".format(path=db_path), "yellow")
return None


Expand Down
23 changes: 11 additions & 12 deletions vectordb/experience/experience.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
example0:
example:
Observation: The screenshot shows the Microsoft To Do application with the task
list visible. There is an option to add a new task, but no task related to learning
LLM is listed yet.
Thought: To fulfill the user's request, I need to add a new task titled 'Learn
LLM' using the 'Add a task' option.
Observation: The current screenshot shows that I am on the Microsoft To Do application.
The application is open and there is an edit block at the bottom for inputting
the task.
Thought: "I need to add a task of 'Learning LLM' to the edit block of 'Add a task\
\ in \u201CMy Day\u201D'."
ControlLabel: '19'
ControlText: "Add a task in \u201CMy Day\u201D"
Function: set_edit_text
Args:
text: Learn LLM
text: Learning LLM
Status: FINISH
Plan: <FINISH>
Comment: After setting the text for the new task, the task creation process is
complete.
Tips: '1. Ensure the task title is clear and specific to the learning goal.
Comment: After inputting the task, no further action is required as the user only
requested the creation of a to-do item.
Tips: '- Ensure the task description is clear and concise.
2. After creating the task, consider adding specific steps or details to help
organize the learning process.'
request: create a to do for learning LLM.
- After adding the task, you can set a reminder or due date if needed.'
request: Create 1 to do for learning LLM.
app_list:
- ApplicationFrameHost.exe
Binary file modified vectordb/experience/experience_db/index.faiss
Binary file not shown.
Binary file modified vectordb/experience/experience_db/index.pkl
Binary file not shown.

0 comments on commit 46af9fb

Please sign in to comment.