Files
nexusAI/packages/shared/src/config/constants.js
2026-04-10 04:02:43 -07:00

80 lines
2.6 KiB
JavaScript

//A store for tunables and constants used across the codebase, to avoid magic numbers and hardcoded values
const QDRANT = {
DEFAULT_URL: 'http://localhost:6333',
VECTOR_SIZE: 768, // Must match the output dimension of the embedding model (e.g. nomic-embed-text)
DISTANCE_METRIC: 'Cosine', // Best for normalized embeddings like text vectors
DEFAULT_LIMIT: 10, //Default top-=k for vector searches
};
const COLLECTIONS = {
EPISODES: 'episodes',
ENTITIES: 'entities',
SUMMARIES: 'summaries'
};
const EPISODIC = {
DEFAULT_RECENT_LIMIT: 10, // Default number of recent episodes to retrieve
DEFAULT_PAGE_SIZE: 20, // Default number of episodes per page for pagination
DEFAULT_SEARCH_LIMIT: 10, // Default number of search results to return
DEFAULT_OFFSET: 0,
DEFAULT_SESSIONS_LIMIT: 20,
};
const ORCHESTRATION = {
RECENT_EPISODE_LIMIT: 5,
SEMANTIC_LIMIT: 5,
SCORE_THRESHOLD: 0.75,
CORS_ORIGIN: 'http://localhost:5173',
SYSTEM_PROMPT: `You are a helpful, context-aware AI assistant. You have access to memories of past conversations with the user. Use them to provide consistent, personalised responses.`
}
const OLLAMA = {
DEFAULT_URL: 'http://localhost:11434',
EMBED_MODEL: 'nomic-embed-text',
OLLAMA_MODEL: 'companion:latest',
};
const LLAMACPP = {
DEFAULT_URL: 'http://localhost:8080',
DEFAULT_MODEL: 'gemma-4-26B-A4B-Claude-Distill-APEX-I-Mini.gguf',
}
const PORTS = {
INFERENCE: '3001',
MEMORY: '3002',
EMBEDDING: '3003',
ORCHESTRATION: '4000',
};
const SERVICES = {
EMBEDDING_URL: `http://localhost:${PORTS.EMBEDDING}`,
MEMORY_URL: `http://localhost:${PORTS.MEMORY}`,
INFERENCE_URL: `http://localhost:${PORTS.INFERENCE}`,
};
const INFERENCE_DEFAULTS = {
TEMPERATURE: 0.7, // Controls randomness. 0 = deterministic, 1 = creative
MAX_TOKENS: 1024, // Max tokens to generate in a response
TOP_P: 0.9, // Nucleus sampling — considers tokens comprising top 90% probability mass
TOP_K: 40, // Limits token selection to top K candidates at each step
REPEAT_PENALTY: 1.1, // Penalizes recently used tokens to reduce repetition
SEED: null, // null = random. Set to an integer for reproducible outputs
};
const SQLITE = {
DEFAULT_PATH: './data/nexusai.db'
}
module.exports = {
QDRANT,
COLLECTIONS,
EPISODIC,
SERVICES,
OLLAMA,
PORTS,
LLAMACPP,
INFERENCE_DEFAULTS,
SQLITE,
ORCHESTRATION
};