Added a few updates to poetry and tested packages
This commit is contained in:
parent
35195f7f6c
commit
05967fe915
3 changed files with 11 additions and 9 deletions
|
|
@ -66,11 +66,11 @@ async def classify_documents(query:str, document_id:str, loader_settings:dict):
|
||||||
arguments_str = classifier_output.additional_kwargs['function_call']['arguments']
|
arguments_str = classifier_output.additional_kwargs['function_call']['arguments']
|
||||||
print("This is the arguments string", arguments_str)
|
print("This is the arguments string", arguments_str)
|
||||||
arguments_dict = json.loads(arguments_str)
|
arguments_dict = json.loads(arguments_str)
|
||||||
classfier_value = arguments_dict.get('summarizer', None)
|
# classfier_value = arguments_dict.get('summarizer', None)
|
||||||
|
|
||||||
print("This is the classifier value", classfier_value)
|
# print("This is the classifier value", classfier_value)
|
||||||
|
|
||||||
return classfier_value
|
return arguments_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -199,9 +199,9 @@ class Neo4jGraphDB(AbstractGraphDB):
|
||||||
# Create the user and memory components if they don't exist
|
# Create the user and memory components if they don't exist
|
||||||
user_memory_cypher = f"""
|
user_memory_cypher = f"""
|
||||||
MERGE (user:User {{userId: '{user_id}'}})
|
MERGE (user:User {{userId: '{user_id}'}})
|
||||||
MERGE (semantic:SemanticMemory {{name: 'SemanticMemory', userId: '{user_id}' }})
|
MERGE (semantic:SemanticMemory {{description: 'SemanticMemory', userId: '{user_id}' }})
|
||||||
MERGE (episodic:EpisodicMemory {{name: 'EpisodicMemory' , userId: '{user_id}'}})
|
MERGE (episodic:EpisodicMemory {{description: 'EpisodicMemory' , userId: '{user_id}'}})
|
||||||
MERGE (buffer:Buffer {{name: 'Buffer' , userId: '{user_id}' }})
|
MERGE (buffer:Buffer {{description: 'Buffer' , userId: '{user_id}' }})
|
||||||
MERGE (user)-[:HAS_SEMANTIC_MEMORY]->(semantic)
|
MERGE (user)-[:HAS_SEMANTIC_MEMORY]->(semantic)
|
||||||
MERGE (user)-[:HAS_EPISODIC_MEMORY]->(episodic)
|
MERGE (user)-[:HAS_EPISODIC_MEMORY]->(episodic)
|
||||||
MERGE (user)-[:HAS_BUFFER]->(buffer)
|
MERGE (user)-[:HAS_BUFFER]->(buffer)
|
||||||
|
|
|
||||||
|
|
@ -320,6 +320,8 @@ async def add_documents_to_graph_db(postgres_session: AsyncSession, user_id: str
|
||||||
neo4j_graph_db.update_document_node_with_namespace(user_id, vectordb_namespace=memory_name, document_id=doc_id)
|
neo4j_graph_db.update_document_node_with_namespace(user_id, vectordb_namespace=memory_name, document_id=doc_id)
|
||||||
else:
|
else:
|
||||||
classification = await classify_documents(doc_name, document_id =doc_id, loader_settings=loader_settings)
|
classification = await classify_documents(doc_name, document_id =doc_id, loader_settings=loader_settings)
|
||||||
|
|
||||||
|
logging.info("Classification is", str(classification))
|
||||||
neo4j_graph_db = Neo4jGraphDB(url=config.graph_database_url, username=config.graph_database_username,
|
neo4j_graph_db = Neo4jGraphDB(url=config.graph_database_url, username=config.graph_database_username,
|
||||||
password=config.graph_database_password)
|
password=config.graph_database_password)
|
||||||
rs = neo4j_graph_db.create_document_node_cypher(classification, user_id)
|
rs = neo4j_graph_db.create_document_node_cypher(classification, user_id)
|
||||||
|
|
@ -471,11 +473,11 @@ async def main():
|
||||||
"path": [".data"],
|
"path": [".data"],
|
||||||
"strategy": "SUMMARY",
|
"strategy": "SUMMARY",
|
||||||
}
|
}
|
||||||
await load_documents_to_vectorstore(session, user_id, loader_settings=loader_settings)
|
# await load_documents_to_vectorstore(session, user_id, loader_settings=loader_settings)
|
||||||
await user_query_to_graph_db(session, user_id, "I walked in the forest yesterday and added to my list I need to buy some milk in the store and get a summary from a classical book i read yesterday")
|
# await user_query_to_graph_db(session, user_id, "I walked in the forest yesterday and added to my list I need to buy some milk in the store and get a summary from a classical book i read yesterday")
|
||||||
await add_documents_to_graph_db(session, user_id, loader_settings=loader_settings)
|
await add_documents_to_graph_db(session, user_id, loader_settings=loader_settings)
|
||||||
|
|
||||||
ee = await user_context_enrichment(session, user_id, query="Tell me about the book I read yesterday")
|
# ee = await user_context_enrichment(session, user_id, query="Tell me about the book I read yesterday")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue