Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve some statements and promote some code effiency #63

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/memary/agent/base_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def locate(self, query: str) -> str:

reverse_geocode_result = self.gmaps.reverse_geocode((lattitude, longitude))
formatted_address = reverse_geocode_result[0]["formatted_address"]
return "Your address is" + formatted_address
return "Your address is " + formatted_address

def vision(self, query: str, img_url: str) -> str:
"""Uses computer vision to process the image specified by the image url and answers the question based on the CV results"""
Expand Down Expand Up @@ -285,7 +285,7 @@ def _change_llm_message_chat(self) -> dict:
llm_message_chat["messages"].append(
{
"role": "user",
"content": "Knowledge Entity Store:" + str(top_entities),
"content": "Knowledge Entity Store: " + str(top_entities),
}
)
llm_message_chat["messages"].extend(
Expand Down
2 changes: 1 addition & 1 deletion src/memary/agent/chat_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def add_chat(self, role: str, content: str, entities: Optional[List[str]] = None
Args:
role (str): 'system' or 'user'
content (str): content of the chat
entities (Optional[List[str]], optional): entities from Memory systems. Defaults to None.
entities (Optional[List[str]]): entities from Memory systems. Defaults to None.
"""
# Add a chat to the agent's memory.
self._add_contexts_to_llm_message(role, content)
Expand Down
9 changes: 3 additions & 6 deletions src/memary/agent/data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,9 @@ def __init__(self, system_persona_txt, user_persona_txt, past_chat_json, model):

def __str__(self):
llm_message_str = f"System Persona: {self.system_persona}\nUser Persona: {self.user_persona}\n"
for context in self.contexts:
llm_message_str += f"{str(context)},"
for memory in self.llm_message["memory_stream"]:
llm_message_str += f"{str(memory)},"
for entity in self.llm_message["knowledge_entity_store"]:
llm_message_str += f"{str(entity)},"
llm_message_str += ','.join(str(context) for context in self.contexts)
llm_message_str += ','.join(str(memory) for memory in self.llm_message["memory_stream"])
llm_message_str += ','.join(str(entity) for entity in self.llm_message["knowledge_entity_store"])
return llm_message_str

def _init_persona_to_messages(self):
Expand Down
2 changes: 1 addition & 1 deletion src/memary/memory/entity_knowledge_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def add_memory(self, memory_stream: list[MemoryItem]):
Args:
memory_stream (list): list of MemoryItem
"""
knowledge_meory = self._convert_memory_to_knowledge_memory(
knowledge_memory = self._convert_memory_to_knowledge_memory(
memory_stream)
self._update_knowledge_memory(knowledge_meory)

Expand Down
2 changes: 1 addition & 1 deletion streamlit_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def get_models(llm_models, vision_models):
edges = [] # (node1, node2, [relationships])
fill_graph(nodes, edges, cypher_query)

st.subheader("Knoweldge Graph")
st.subheader("Knowledge Graph")
st.code("# Current Cypher Used\n" + cypher_query)
st.write("")
st.text("Subgraph:")
Expand Down