OrgaAI
The OrgaAI class manages global configuration for the core runtime. It is a static singleton; you do not instantiate it with new.
OrgaAI.init(config)
Initializes the runtime. Must be called before using utilities such as connectToRealtime.
import { OrgaAI } from '@orga-ai/core';
OrgaAI.init({
sessionConfigEndpoint: '/api/orga/session',
logLevel: 'info',
model: 'orga-1-beta',
voice: 'alloy',
temperature: 0.4,
});| Option | Type | Required | Description |
|---|---|---|---|
sessionConfigEndpoint | string | ❌* | URL to your backend endpoint that returns { ephemeralToken, iceServers }. Required unless fetchSessionConfig is provided. |
fetchSessionConfig | () => Promise<SessionConfigResponse> | ❌* | Custom fetcher for session credentials. Used when you cannot expose an HTTP endpoint. |
logLevel | 'debug' | 'info' | 'warn' | 'error' | 'disabled' | ❌ | Controls verbosity of the bundled logger. Default warn. |
timeout | number | ❌ | Base timeout (ms) for helper functions. Default 30000. |
model | OrgaAIModel | ❌ | Default model applied to realtime calls. |
voice | OrgaAIVoice | ❌ | Default voice configuration. |
temperature | number | ❌ | Sampling temperature; validated against ORGAAI_TEMPERATURE_RANGE. |
instructions | string | ❌ | Default system prompt for the agent. |
modalities | Modality[] | ❌ | Modalities requested during realtime negotiation. |
history | boolean | ❌ | Whether to request historical context by default. |
Either
sessionConfigEndpointorfetchSessionConfigmust be provided; otherwiseConfigurationErroris thrown.
OrgaAI.getConfig()
Returns the resolved configuration with defaults applied.
const config = OrgaAI.getConfig();
console.log(config.model); // -> 'orga-1-beta'Throws ConfigurationError if OrgaAI.init has not run.
OrgaAI.isInitialized()
if (!OrgaAI.isInitialized()) {
OrgaAI.init({ sessionConfigEndpoint: '/api/orga/session' });
}Returns true when the runtime has been initialized.
OrgaAI.reset() (internal)
Clears the global configuration. Intended for tests; avoid calling it in production.
Last updated on