Skip to content

Commit

Permalink
Reduce size of context, hack for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasilije1990 committed Jan 14, 2024
1 parent 3d6d0a0 commit db18bd8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,8 @@ async def user_context_enrichment(session, user_id:str, query:str, generative_re
query = translate_text(query, "sr", "en")
logging.info("Translated query is %s", str(query))

try:
if memory_type=='PublicMemory':


neo4j_graph_db = Neo4jGraphDB(url=config.graph_database_url, username=config.graph_database_username,
password=config.graph_database_password)
Expand Down Expand Up @@ -457,14 +458,16 @@ async def user_context_enrichment(session, user_id:str, query:str, generative_re
observation=query, params=postgres_id[0], search_type="summary_filter_by_object_name")
logging.info("Result is", str(results))


search_context = ""

for result in results['data']['Get'][namespace_id]:
# Assuming 'result' is a dictionary and has keys like 'source', 'text'
source = result['source']
text = result['text']
search_context += f"Document source: {source}, Document text: {text} \n"
except:

else:
search_context = "No relevant documents found"

context = f""" You are a memory system that uses cognitive architecture to enrich the
Expand Down Expand Up @@ -706,7 +709,7 @@ class GraphQLQuery(BaseModel):

# await attach_user_to_memory(user_id=user_id, labels=['sr'], topic="PublicMemory")

return_ = await user_context_enrichment(user_id=user_id, query="hi how are you", session=session, memory_type="SemanticMemory", generative_response=False)
return_ = await user_context_enrichment(user_id=user_id, query="what should the size of a staircase in an apartment building be", session=session, memory_type="PublicMemory", generative_response=False)
print(return_)
# aa = await relevance_feedback("I need to understand how to build a staircase in an apartment building", "PublicMemory")
# print(aa)
Expand Down

0 comments on commit db18bd8

Please sign in to comment.