Kontext: Ich verwende Cognee v0.5.1 und versuche, Milvus (Zilliz Cloud) als Vektordatenbank und FalkorDB als Diagrammdatenbank zu verwenden. Ich registriere die Community-Adapter gemäß den Anforderungen der neuen Version.
Das Problem: Beim Aufruf von cognee.add() schlägt das System beim Versuch, die Vektor-Engine zu initialisieren, fehl. Obwohl ich VECTOR_DB_PROVIDER = „milvus“ gesetzt habe, zeigt der Traceback, dass Cognee intern „create_pgvector_db_and_tables“ aufruft und dann mit einem TypeError fehlschlägt, weil es „database_name“ an den MilvusAdapter übergibt, der dies nicht unterstützt.
Meine Konfiguration:
import os
import cognee
import asyncio
import pathlib
import traceback
from os import path
from cognee.modules.ontology.ontology_config import Config
from cognee.modules.ontology.rdf_xml.RDFLibOntologyResolver import RDFLibOntologyResolver
from cognee.infrastructure.databases.vector import use_vector_adapter
from dotenv import load_dotenv
import cognee_community_hybrid_adapter_falkor.register
from cognee_community_vector_adapter_milvus import MilvusAdapter
use_vector_adapter("milvus", MilvusAdapter)
load_dotenv()
async def setup():
system_path = pathlib.Path(__file__).parent
cognee.config.system_root_directory(path.join(system_path, ".cognee_system"))
cognee.config.data_root_directory(path.join(system_path, ".cognee_data"))
cognee.config.set_llm_config({
"llm_api_key": os.getenv("LLM_API_KEY"),
"llm_model": os.getenv("LLM_MODEL"),
"llm_endpoint": os.getenv("LLM_ENDPOINT"),
"llm_provider": os.getenv("LLM_PROVIDER")
})
#cognee.config.set_relational_db_config({
# "db_provider": "sqlite",
#})
os.environ["VECTOR_DB_PROVIDER"] = "milvus"
cognee.config.set_vector_db_config({
"vector_db_url": os.getenv("VECTOR_DB_URL"),
"vector_db_key": os.getenv("VECTOR_DB_KEY"),
"vector_db_name": "Stage"
})
cognee.config.set_graph_db_config({
"graph_database_provider": "falkor",
"graph_database_url": os.getenv("GRAPH_DB_URL", "localhost"),
"graph_database_port": int(os.getenv("GRAPH_DB_PORT", "64879")),
"graph_database_username": "falkordb",
"graph_database_password":"1ZcgvZAZgmod",
#"graph_database_name": "FalkorDB Instance"
})
async def test_system():
await setup()
print("✅ Configuración cargada.")
try:
# 2. Añadir datos que simulan una conversación de chat
# Estos datos siguen la estructura de tu ontología: User -> envía -> Message -> pertenece a -> Channel
conversacion = [
"El usuario Juan Perez (ID: 101) envió un mensaje al Canal 'Consultas Programación' en el Aula de Inteligencia Artificial.",
"Contenido del mensaje de Juan: '¿Cómo configuro el adaptador de FalkorDB en Cognee?'",
"El usuario Maria Lopez (ID: 102) respondió al mensaje de Juan en el mismo canal.",
"Contenido del mensaje de Maria: 'Debes usar el comando cognee_community_hybrid_adapter_falkor.register antes de cargar el setup.'",
"El mensaje de Maria está marcado como destacado (Pinned: True) por el profesor."
]
for linea in conversacion:
await cognee.add(linea)
print("✅ Simulación de chat añadida a la cola.")
# 3. Ejecutar Cognify con tu ontología
print("Ejecutando cognify con la ontología de chats...")
ontology_path = "./ontology.owl"
# Usamos el resolver para procesar el archivo .owl que creamos
config: Config = {
"ontology_config": {
"ontology_resolver": RDFLibOntologyResolver(ontology_file=ontology_path)
}
}
await cognee.cognify(config = config)
print("✅ Cognify completado con éxito.")
# 4. Realizar búsquedas de prueba basadas en relaciones
print("\n--- Resultados de Búsqueda ---")
# Prueba 1: Buscar contenido
res1 = await cognee.search("¿Qué preguntó Juan Perez?")
print(f"Pregunta de Juan: {res1[0].text if res1 else 'No encontrado'}")
# Prueba 2: Buscar por contexto de canal (esto valida la relación belongsToChannel)
res2 = await cognee.search("¿Qué se discutió en el canal de Consultas Programación?")
print(f"Contexto del canal: {res2[0].text if res2 else 'No encontrado'}")
except Exception as e:
print(f"❌ Error durante la prueba: {str(e)}")
traceback.print_exc()
if __name__ == "__main__":
asyncio.run(test_system())
2026-01-14T23:30:47.077130 [info ] Deleted old log file: /home/cristofer/test/lib/python3.12/site-packages/logs/2026-01-14_18-03-47.log [cognee.shared.logging_utils]
2026-01-14T23:30:47.961875 [warning ] From version 0.5.0 onwards, Cognee will run with multi-user access control mode set to on by default. Data isolation between different users and datasets will be enforced and data created before multi-user access control mode was turned on won't be accessible by default. To disable multi-user access control mode and regain access to old data set the [url=viewtopic.php?t=25360]environment[/url] variable ENABLE_BACKEND_ACCESS_CONTROL to false before starting Cognee. For more information, please refer to the Cognee documentation. [cognee.shared.logging_utils]
2026-01-14T23:30:47.962078 [info ] Log file created at: /home/cristofer/test/lib/python3.12/site-packages/logs/2026-01-14_18-30-46.log [cognee.shared.logging_utils] log_file=/home/cristofer/test/lib/python3.12/site-packages/logs/2026-01-14_18-30-46.log
2026-01-14T23:30:47.962211 [info ] Logging initialized [cognee.shared.logging_utils] cognee_version=0.5.1 database_path=/home/cristofer/test/lib/python3.12/site-packages/cognee/.cognee_system/databases graph_database_name= os_info='Linux 6.8.0-90-generic (#91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 14:14:30 UTC 2025)' python_version=3.12.3 relational_config=cognee_db structlog_version=25.5.0 vector_config=milvus
2026-01-14T23:30:47.962362 [info ] Database storage: /home/cristofer/test/lib/python3.12/site-packages/cognee/.cognee_system/databases [cognee.shared.logging_utils]
2026-01-14T23:30:48.023642 [warning ] Failed to import protego, make sure to install using pip install protego>=0.1 [cognee.shared.logging_utils]
2026-01-14T23:30:48.023938 [warning ] Failed to import playwright, make sure to install using pip install playwright>=1.9.0 [cognee.shared.logging_utils]
✅ Configuración cargada.
2026-01-14T23:30:48.632834 [warning ] Could not get tokenizer from HuggingFace due to: No module named 'transformers' [LiteLLMEmbeddingEngine]
2026-01-14T23:30:48.632974 [info ] Switching to TikToken default tokenizer. [LiteLLMEmbeddingEngine]
❌ Error durante la prueba: MilvusAdapter.__init__() got an unexpected keyword argument 'database_name'
Traceback (most recent call last):
File "/home/cristofer/test/main.py", line 71, in test_system
await cognee.add(linea)
File "/home/cristofer/test/lib/python3.12/site-packages/cognee/api/v1/add/add.py", line 188, in add
await setup()
File "/home/cristofer/test/lib/python3.12/site-packages/cognee/modules/engine/operations/setup.py", line 17, in setup
await create_pgvector_db_and_tables()
File "/home/cristofer/test/lib/python3.12/site-packages/cognee/infrastructure/databases/vector/pgvector/create_db_and_tables.py", line 8, in create_db_and_tables
vector_engine = get_vector_engine()
^^^^^^^^^^^^^^^^^^^
File "/home/cristofer/test/lib/python3.12/site-packages/cognee/infrastructure/databases/vector/get_vector_engine.py", line 7, in get_vector_engine
return create_vector_engine(**get_vectordb_context_config())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cristofer/test/lib/python3.12/site-packages/cognee/infrastructure/databases/vector/create_vector_engine.py", line 48, in create_vector_engine
return adapter(
^^^^^^^^
TypeError: MilvusAdapter.__init__() got an unexpected keyword argument 'database_name'
[b]Kontext:[/b] Ich verwende Cognee v0.5.1 und versuche, [b]Milvus[/b] (Zilliz Cloud) als Vektordatenbank und [b]FalkorDB[/b] als Diagrammdatenbank zu verwenden. Ich registriere die Community-Adapter gemäß den Anforderungen der neuen Version. Das Problem: Beim Aufruf von cognee.add() schlägt das System beim Versuch, die Vektor-Engine zu initialisieren, fehl. Obwohl ich VECTOR_DB_PROVIDER = „milvus“ gesetzt habe, zeigt der Traceback, dass Cognee intern „create_pgvector_db_and_tables“ aufruft und dann mit einem TypeError fehlschlägt, weil es „database_name“ an den MilvusAdapter übergibt, der dies nicht unterstützt. Meine Konfiguration: [code]import os import cognee import asyncio import pathlib import traceback from os import path from cognee.modules.ontology.ontology_config import Config from cognee.modules.ontology.rdf_xml.RDFLibOntologyResolver import RDFLibOntologyResolver
from cognee.infrastructure.databases.vector import use_vector_adapter
try: # 2. Añadir datos que simulan una conversación de chat # Estos datos siguen la estructura de tu ontología: User -> envía -> Message -> pertenece a -> Channel conversacion = [ "El usuario Juan Perez (ID: 101) envió un mensaje al Canal 'Consultas Programación' en el Aula de Inteligencia Artificial.", "Contenido del mensaje de Juan: '¿Cómo configuro el adaptador de FalkorDB en Cognee?'", "El usuario Maria Lopez (ID: 102) respondió al mensaje de Juan en el mismo canal.", "Contenido del mensaje de Maria: 'Debes usar el comando cognee_community_hybrid_adapter_falkor.register antes de cargar el setup.'", "El mensaje de Maria está marcado como destacado (Pinned: True) por el profesor." ]
for linea in conversacion: await cognee.add(linea)
print("✅ Simulación de chat añadida a la cola.")
# 3. Ejecutar Cognify con tu ontología print("Ejecutando cognify con la ontología de chats...") ontology_path = "./ontology.owl"
# Usamos el resolver para procesar el archivo .owl que creamos config: Config = { "ontology_config": { "ontology_resolver": RDFLibOntologyResolver(ontology_file=ontology_path) } }
await cognee.cognify(config = config) print("✅ Cognify completado con éxito.")
# 4. Realizar búsquedas de prueba basadas en relaciones print("\n--- Resultados de Búsqueda ---")
# Prueba 1: Buscar contenido res1 = await cognee.search("¿Qué preguntó Juan Perez?") print(f"Pregunta de Juan: {res1[0].text if res1 else 'No encontrado'}")
# Prueba 2: Buscar por contexto de canal (esto valida la relación belongsToChannel) res2 = await cognee.search("¿Qué se discutió en el canal de Consultas Programación?") print(f"Contexto del canal: {res2[0].text if res2 else 'No encontrado'}")
except Exception as e: print(f"❌ Error durante la prueba: {str(e)}") traceback.print_exc()
if __name__ == "__main__": asyncio.run(test_system()) [/code] Vollständiger Traceback: [code]2026-01-14T23:30:47.077130 [info ] Deleted old log file: /home/cristofer/test/lib/python3.12/site-packages/logs/2026-01-14_18-03-47.log [cognee.shared.logging_utils]
2026-01-14T23:30:47.961875 [warning ] From version 0.5.0 onwards, Cognee will run with multi-user access control mode set to on by default. Data isolation between different users and datasets will be enforced and data created before multi-user access control mode was turned on won't be accessible by default. To disable multi-user access control mode and regain access to old data set the [url=viewtopic.php?t=25360]environment[/url] variable ENABLE_BACKEND_ACCESS_CONTROL to false before starting Cognee. For more information, please refer to the Cognee documentation. [cognee.shared.logging_utils]
2026-01-14T23:30:47.962078 [info ] Log file created at: /home/cristofer/test/lib/python3.12/site-packages/logs/2026-01-14_18-30-46.log [cognee.shared.logging_utils] log_file=/home/cristofer/test/lib/python3.12/site-packages/logs/2026-01-14_18-30-46.log
2026-01-14T23:30:48.023642 [warning ] Failed to import protego, make sure to install using pip install protego>=0.1 [cognee.shared.logging_utils]
2026-01-14T23:30:48.023938 [warning ] Failed to import playwright, make sure to install using pip install playwright>=1.9.0 [cognee.shared.logging_utils] ✅ Configuración cargada.
2026-01-14T23:30:48.632834 [warning ] Could not get tokenizer from HuggingFace due to: No module named 'transformers' [LiteLLMEmbeddingEngine]
2026-01-14T23:30:48.632974 [info ] Switching to TikToken default tokenizer. [LiteLLMEmbeddingEngine] ❌ Error durante la prueba: MilvusAdapter.__init__() got an unexpected keyword argument 'database_name' Traceback (most recent call last): File "/home/cristofer/test/main.py", line 71, in test_system await cognee.add(linea) File "/home/cristofer/test/lib/python3.12/site-packages/cognee/api/v1/add/add.py", line 188, in add await setup() File "/home/cristofer/test/lib/python3.12/site-packages/cognee/modules/engine/operations/setup.py", line 17, in setup await create_pgvector_db_and_tables() File "/home/cristofer/test/lib/python3.12/site-packages/cognee/infrastructure/databases/vector/pgvector/create_db_and_tables.py", line 8, in create_db_and_tables vector_engine = get_vector_engine() ^^^^^^^^^^^^^^^^^^^ File "/home/cristofer/test/lib/python3.12/site-packages/cognee/infrastructure/databases/vector/get_vector_engine.py", line 7, in get_vector_engine return create_vector_engine(**get_vectordb_context_config()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/cristofer/test/lib/python3.12/site-packages/cognee/infrastructure/databases/vector/create_vector_engine.py", line 48, in create_vector_engine return adapter( ^^^^^^^^ TypeError: MilvusAdapter.__init__() got an unexpected keyword argument 'database_name' [/code]
Kontext: Ich verwende Cognee v0.5.1 und versuche, Milvus (Zilliz Cloud) als Vektordatenbank und FalkorDB als Diagrammdatenbank zu verwenden. Ich registriere die Community-Adapter gemäß den...
Ich untersuche das RoBERTA-Modell zur Erkennung von Emotionen in Tweets.
Auf Google Colab. Folgen Sie dieser Noteboook-Datei von Kaggle –
Code-Snippet:
def regular_encode(texts, tokenizer,...
Ich versuche, Teile eines High-School-Comp-Sci-Projekts in Trinket zu verschieben, und erhalte ständig die folgende Fehlermeldung:
TypeError: () got an unexpected keyword argument 'shape' on line __...