test with a simple file
This commit is contained in:
parent
57e3e2ef90
commit
48d21c409a
2 changed files with 46 additions and 33 deletions
|
|
@ -192,35 +192,35 @@ async def process_text(chunk_collection: str, chunk_id: str, input_text: str, fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# if infrastructure_config.get_config()["connect_documents"] is True:
|
# if infrastructure_config.get_config()["connect_documents"] is True:
|
||||||
# db_engine = infrastructure_config.get_config()["database_engine"]
|
# db_engine = infrastructure_config.get_config()["database_engine"]
|
||||||
# relevant_documents_to_connect = db_engine.fetch_cognify_data(excluded_document_id = raw_document_id)
|
# relevant_documents_to_connect = db_engine.fetch_cognify_data(excluded_document_id = raw_document_id)
|
||||||
#
|
#
|
||||||
# list_of_nodes = []
|
# list_of_nodes = []
|
||||||
#
|
#
|
||||||
# relevant_documents_to_connect.append({
|
# relevant_documents_to_connect.append({
|
||||||
# "layer_id": document_id,
|
# "layer_id": document_id,
|
||||||
# })
|
# })
|
||||||
#
|
#
|
||||||
# for document in relevant_documents_to_connect:
|
# for document in relevant_documents_to_connect:
|
||||||
# node_descriptions_to_match = await graph_client.extract_node_description(document["layer_id"])
|
# node_descriptions_to_match = await graph_client.extract_node_description(document["layer_id"])
|
||||||
# list_of_nodes.extend(node_descriptions_to_match)
|
# list_of_nodes.extend(node_descriptions_to_match)
|
||||||
#
|
#
|
||||||
# nodes_by_layer = await group_nodes_by_layer(list_of_nodes)
|
# nodes_by_layer = await group_nodes_by_layer(list_of_nodes)
|
||||||
#
|
#
|
||||||
# results = await resolve_cross_graph_references(nodes_by_layer)
|
# results = await resolve_cross_graph_references(nodes_by_layer)
|
||||||
#
|
#
|
||||||
# relationships = graph_ready_output(results)
|
# relationships = graph_ready_output(results)
|
||||||
#
|
#
|
||||||
# await connect_nodes_in_graph(
|
# await connect_nodes_in_graph(
|
||||||
# graph_client,
|
# graph_client,
|
||||||
# relationships,
|
# relationships,
|
||||||
# score_threshold = infrastructure_config.get_config()["intra_layer_score_treshold"]
|
# score_threshold = infrastructure_config.get_config()["intra_layer_score_treshold"]
|
||||||
# )
|
# )
|
||||||
#
|
#
|
||||||
# send_telemetry("cognee.cognify")
|
# send_telemetry("cognee.cognify")
|
||||||
#
|
#
|
||||||
# print(f"Chunk ({chunk_id}) cognified.")
|
# print(f"Chunk ({chunk_id}) cognified.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -238,14 +238,27 @@ if __name__ == "__main__":
|
||||||
#
|
#
|
||||||
# await add("data://" +data_directory_path, "example")
|
# await add("data://" +data_directory_path, "example")
|
||||||
|
|
||||||
|
text = """import subprocess
|
||||||
|
def show_all_processes():
|
||||||
|
process = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
|
||||||
|
output, error = process.communicate()
|
||||||
|
|
||||||
|
if error:
|
||||||
|
print(f"Error: {error}")
|
||||||
|
else:
|
||||||
|
print(output.decode())
|
||||||
|
|
||||||
|
show_all_processes()"""
|
||||||
|
|
||||||
|
from cognee.api.v1.add import add
|
||||||
|
|
||||||
|
await add([text], "example_dataset")
|
||||||
|
|
||||||
infrastructure_config.set_config( {"chunk_engine": LangchainChunkEngine() , "chunk_strategy": ChunkStrategy.CODE,'embedding_engine': LiteLLMEmbeddingEngine() })
|
infrastructure_config.set_config( {"chunk_engine": LangchainChunkEngine() , "chunk_strategy": ChunkStrategy.CODE,'embedding_engine': LiteLLMEmbeddingEngine() })
|
||||||
from cognee.shared.SourceCodeGraph import SourceCodeGraph
|
from cognee.shared.SourceCodeGraph import SourceCodeGraph
|
||||||
from cognee.api.v1.config import config
|
from cognee.api.v1.config import config
|
||||||
|
|
||||||
config.set_graph_model(SourceCodeGraph)
|
config.set_graph_model(SourceCodeGraph)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
config.set_classification_model(CodeContentPrediction)
|
config.set_classification_model(CodeContentPrediction)
|
||||||
|
|
||||||
graph = await cognify()
|
graph = await cognify()
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ if __name__ == "__main__":
|
||||||
#
|
#
|
||||||
# await add("data://" +data_directory_path, "example")
|
# await add("data://" +data_directory_path, "example")
|
||||||
|
|
||||||
graph = await add_topology()
|
# graph = await add_topology()
|
||||||
|
|
||||||
graph_db_type = infrastructure_config.get_config()["graph_engine"]
|
graph_db_type = infrastructure_config.get_config()["graph_engine"]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue