Added embeddings as an option, added different types of text search
This commit is contained in:
parent
e34e771b4c
commit
ba43c37511
4 changed files with 8 additions and 67 deletions
|
|
@ -5,12 +5,12 @@
|
|||
### Description
|
||||
|
||||
|
||||
Initial code lets you do three operations:
|
||||
RAG test manager can be used via API (inprogress) or via the CLI
|
||||
|
||||
Make sure to run scripts/create_database.py
|
||||
|
||||
|
||||
|
||||
1. Add to memory
|
||||
2. Retrieve from memory
|
||||
3. Structure the data to schema
|
||||
4. Load to a database
|
||||
|
||||
#How to use
|
||||
|
||||
|
|
|
|||
|
|
@ -383,7 +383,7 @@ async def start_test(data, test_set=None, user_id=None, params=None, job_id=None
|
|||
|
||||
print(test_result_collection)
|
||||
|
||||
add_entity(session, TestOutput(id=test_id, user_id=user_id, content=str(test_result_collection)))
|
||||
add_entity(session, TestOutput(id=test_id, user_id=user_id, test_results=str(test_result_collection)))
|
||||
|
||||
async def main():
|
||||
|
||||
|
|
|
|||
|
|
@ -248,9 +248,9 @@ class WeaviateVectorDB(VectorDB):
|
|||
return client.batch.delete_objects(
|
||||
class_name=namespace,
|
||||
where={
|
||||
"path": ["user_id"],
|
||||
"path": ["version"],
|
||||
"operator": "Equal",
|
||||
"valueText": self.user_id,
|
||||
"valueText": "1.0",
|
||||
},
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -345,62 +345,3 @@ if __name__ == "__main__":
|
|||
|
||||
asyncio.run(main())
|
||||
|
||||
# Check for existing user
|
||||
# existing_user = session.query(User).filter_by(id=user_id).first()
|
||||
#
|
||||
# if existing_user:
|
||||
# self.memory_id = existing_user.memory_id
|
||||
# existing_memories_classes = session.query(Memory).filter_by(id=user_id).first()
|
||||
# self.memory_instances = []
|
||||
#
|
||||
# for memory in existing_memories_classes:
|
||||
# instance = DynamicBaseMemory(memory, user_id, self.memory_id, index_name, db_type, namespace)
|
||||
# self.memory_instances.append(instance)
|
||||
# else:
|
||||
# self.memory_id = str(uuid.uuid4())
|
||||
# new_user = User(id=user_id, memory_id=self.memory_id) # Adjust as per your User model
|
||||
# session.add(new_user)
|
||||
# session.commit()
|
||||
# memory_classes = ['Memory', 'SemanticMemory', 'EpisodicMemory']
|
||||
# self.memory_instances = []
|
||||
#
|
||||
# for memory in memory_classes:
|
||||
# instance = DynamicBaseMemory(memory, user_id, self.memory_id, index_name, db_type, namespace)
|
||||
# self.memory_instances.append(instance)
|
||||
# # fix this so it uploads relationships between memories
|
||||
# session.add(Memory(id=self.memory_id, user_id=user_id))
|
||||
# session.commit()
|
||||
#
|
||||
# if existing_user:
|
||||
# attributes_list = session.query(Memory.attributes_list).filter_by(id=self.memory_id).scalar()
|
||||
# attributes_list = ast.literal_eval(attributes_list)
|
||||
# for attr in attributes_list:
|
||||
# self.memory_class.add_attribute(attr)
|
||||
# methods_list = session.query(Memory.methods_list).filter_by(id=self.memory_id).scalar()
|
||||
# methods_list = ast.literal_eval(methods_list)
|
||||
# for class_instance in self.memory_instances:
|
||||
# # , self.episodic_buffer_class]:
|
||||
# for method in methods_list:
|
||||
# class_instance.add_method(method)
|
||||
# else:
|
||||
# attributes_list = ['user_id', 'index_name', 'db_type', 'knowledge_source', 'knowledge_type', 'memory_id',
|
||||
# 'long_term_memory', 'short_term_memory', 'namespace']
|
||||
# for attr in attributes_list:
|
||||
# self.memory_class.add_attribute(attr)
|
||||
# # if old user, fetch attributes from memory table and load them like above
|
||||
# # if new user, load methods from a list
|
||||
# methods_list = ['async_create_long_term_memory', 'async_init', 'add_memories', "fetch_memories",
|
||||
# 'async_create_short_term_memory',
|
||||
# '_create_buffer_context', '_get_task_list', '_run_main_buffer',
|
||||
# '_available_operations', '_provide_feedback']
|
||||
# session.add(Memory(id=self.memory_id, user_id=user_id, methods_list=str(methods_list),
|
||||
# attributes_list=str(attributes_list)))
|
||||
# session.commit()
|
||||
# # if old user, load methods from db
|
||||
# # if new user, use class inherintance like bellow
|
||||
# for class_instance in self.memory_instances:
|
||||
# # , self.episodic_buffer_class]:
|
||||
# for method in methods_list:
|
||||
# class_instance.add_method(method)
|
||||
|
||||
# # Safely convert string representation to a list
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue