Cognitive Engine Wiki
Modular cognitive architecture for advanced AI agents and research
Brought to you by:
autobotsolution
CogChat is the interactive chat interface for the Cognitive Engine.
CogChat provides a conversational interface to interact with the Cognitive Engine. It supports multiple modes:
Core chat functionality for interacting with the Cognitive Engine.
Key Features:
Command-line interface for CogChat.
Usage:
python -m cogchat.cli
Features:
WebSocket server for web-based chat interface.
Usage:
python -m cogchat.server
Features:
Configuration for CogChat components.
Configuration Options:
# Start CLI chat
python -m cogchat.cli
# Interactive session
You: What is artificial intelligence?
CogChat: AI is the simulation of human intelligence in machines...
# Start WebSocket server
python -m cogchat.server --host 0.0.0.0 --port 8080
# Connect from client
# WebSocket URL: ws://localhost:8080/ws
from cogchat.chat import CogChat
# Initialize chat
chat = CogChat()
# Send message
response = chat.send_message("What is AI?")
print(response)
# Server configuration
COGCHAT_HOST=0.0.0.0
COGCHAT_PORT=8080
COGCHAT_DEBUG=false
# Session configuration
SESSION_TIMEOUT=3600
HISTORY_LIMIT=100
Create cogchat_config.yaml:
server:
host: "0.0.0.0"
port: 8080
debug: false
session:
timeout: 3600
history_limit: 100
persistence: true
engine:
min_iterations: 3
max_iterations: 50
confidence_threshold: 0.7
class CogChat:
"""Main chat interface class."""
def __init__(self, config=None):
"""Initialize CogChat with optional configuration."""
def send_message(self, message, session_id=None):
"""Send a message and get response."""
def get_session(self, session_id):
"""Get session information."""
def clear_session(self, session_id):
"""Clear session history."""
Connect: ws://localhost:8080/ws
Message Format:
{
"type": "message",
"session_id": "optional-session-id",
"content": "Your message here"
}
Response Format:
{
"type": "response",
"content": "Response from Cognitive Engine",
"confidence": 0.87,
"iterations": 5
}
const ws = new WebSocket('ws://localhost:8080/ws');
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.type === 'response') {
console.log(data.content);
}
};
ws.send(JSON.stringify({
type: 'message',
content: 'What is AI?'
}));
import websocket
import json
def on_message(ws, message):
data = json.loads(message)
print(data['content'])
ws = websocket.WebSocketApp('ws://localhost:8080/ws')
ws.on_message = on_message
ws.run_forever()
from cogchat.chat import CogChat
chat = CogChat()
# Create session
session_id = chat.create_session()
# Send message in session
response = chat.send_message("Hello", session_id=session_id)
# Get session history
history = chat.get_session_history(session_id)
# Clear session
chat.clear_session(session_id)
CogChat maintains context across conversations:
# First message
response1 = chat.send_message("What is Python?")
# Follow-up question (uses context)
response2 = chat.send_message("What about JavaScript?")
Customize the chat prompts:
from cogchat.chat import CogChat
chat = CogChat()
chat.set_system_prompt("You are a helpful AI assistant specializing in Python programming.")
Issue: Server fails to start
Solution:
Issue: Cannot connect to WebSocket server
Solution:
Issue: Session data is lost
Solution:
For CogChat issues: