Added graph intefrace, added neo4j + networkx structure and updates to the notebook

This commit is contained in:
Vasilije 2024-03-06 22:12:48 +01:00
parent 876227e5a0
commit 30f758a6a3
4 changed files with 29 additions and 2 deletions

View file

@ -13,3 +13,8 @@ async def content_to_cog_layers(text_input: str,system_prompt_path:str, response
return await llm_client.acreate_structured_output(text_input,system_prompt_path, response_model)
if __name__ == "__main__":
content_to_cog_layers("test", "test", ContentPrediction)

View file

@ -1,7 +1,7 @@
from typing import Type
from pydantic import BaseModel
from cognitive_architecture.infrastructure.llm.get_llm_client import get_llm_client
from cognitive_architecture.shared.data_models import CognitiveLayer
async def content_to_cog_layers(text_input: str,system_prompt_path:str, response_model: Type[BaseModel]):
llm_client = get_llm_client()
@ -12,6 +12,10 @@ async def content_to_cog_layers(text_input: str,system_prompt_path:str, response
return await llm_client.acreate_structured_output(text_input,system_prompt_path, response_model)
if __name__ == "__main__":
content_to_cog_layers("test", "test", response_model=CognitiveLayer)

View file

@ -2,10 +2,15 @@
from typing import Type
from pydantic import BaseModel
from cognitive_architecture.infrastructure.llm.get_llm_client import get_llm_client
from cognitive_architecture.shared.data_models import KnowledgeGraph
async def generate_graph(text_input:str,system_prompt_path:str, response_model: Type[BaseModel]):
doc_path = "cognitive_architecture/infrastructure/llm/prompts/generate_graph_prompt.txt"
llm_client = get_llm_client()
return await llm_client.generate_graph(text_input,system_prompt_path, response_model)
if __name__ == "__main__":
generate_graph("test", "test", response_model=KnowledgeGraph)

View file

@ -166,3 +166,16 @@ class ContentPrediction(BaseModel):
label: Union[TextContent, AudioContent, ImageContent, VideoContent, MultimediaContent, Model3DContent, ProceduralContent]
class CognitiveLayerSubgroup(BaseModel):
""" CognitiveLayerSubgroup in a general layer """
id: int
name:str
description: str
class CognitiveLayer(BaseModel):
"""Cognitive layer"""
category_name:str
cognitive_layers: List[CognitiveLayerSubgroup] = Field(..., default_factory=list)