Basic Usage

Creating a Self Model

import { EpistemicMeClient, DialecticType } from '@epistemicme/sdk';

const client = new EpistemicMeClient({
  baseUrl: 'http://localhost:8080',
  apiKey: 'your-api-key'
});

// Create a self model
const selfModel = await client.createSelfModel({
  userId: 'user123'
});

Working with Beliefs

import { BeliefType } from '@epistemicme/sdk';

// Create a belief
const belief = await client.createBelief({
  userId: 'user123',
  content: 'Regular exercise improves mental clarity',
  beliefType: BeliefType.STATEMENT
});

// Retrieve belief system
const beliefSystem = await client.retrieveBeliefSystem({
  userId: 'user123'
});

Managing Dialectics

// Create a dialectic
const dialectic = await client.createDialectic({
  userId: 'user123',
  dialecticType: DialecticType.DEFAULT
});

// Update with question-answer
const updateResp = await client.updateDialectic({
  userId: 'user123',
  dialecticId: dialectic.id,
  answer: {
    userAnswer: 'I exercise three times a week',
    createdAtMillisUtc: BigInt(Date.now())
  }
});

Managing Philosophies

You can create and update philosophies, and extract observation contexts from their descriptions:

// Create a philosophy with context extraction
const createPhilosophyResp = await client.createPhilosophy({
  description: '# My Philosophy\n\n## Narrative\n[[C: Context1]] [[S: state1]] → [[S: state2]]',
  extrapolateContexts: true
});

console.log(createPhilosophyResp.philosophy); // The created philosophy object
console.log(createPhilosophyResp.extrapolatedObservationContexts); // Array of extracted contexts

// Update a philosophy and extract new contexts
const updatePhilosophyResp = await client.updatePhilosophy({
  philosophyId: createPhilosophyResp.philosophy.id,
  description: '# Updated Philosophy\n\n## Narrative\n[[C: Context2]] [[S: state3]] → [[S: state4]]',
  extrapolateContexts: true
});

console.log(updatePhilosophyResp.philosophy); // The updated philosophy object
console.log(updatePhilosophyResp.extrapolatedObservationContexts); // Array of new extracted contexts
  • Set extrapolateContexts: true to automatically extract observation contexts from the description markup.
  • The response includes extrapolatedObservationContexts, an array of context objects with name and other properties.