🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

@orka-js/core

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orka-js/core

Core types, interfaces and classes for OrkaJS - TypeScript LLM framework

latest
Source
npmnpm
Version
1.5.1
Version published
Weekly downloads
23
-52.08%
Maintainers
2
Weekly downloads
 
Created
Source

@orka-js/core

Core types, interfaces, and utilities for the OrkaJS ecosystem — the foundation every package builds on.

Installation

npm install @orka-js/core

Quick Start

import { Orka, createOrka } from '@orka-js/core'
import { OpenAIAdapter } from '@orka-js/openai'

const orka = createOrka({
  llm: new OpenAIAdapter({ apiKey: process.env.OPENAI_API_KEY! }),
})

const response = await orka.chat([
  { role: 'user', content: 'Hello!' }
])
console.log(response.content)

RAG with Knowledge

import { Orka, Knowledge } from '@orka-js/core'

const knowledge = new Knowledge({ orka })

await knowledge.ingest([
  { id: 'doc-1', content: 'OrkaJS is a TypeScript AI framework.' }
])

const results = await knowledge.query('What is OrkaJS?', 3)

PII Guard (RGPD)

import { PIIGuard, detectPII, redactPII } from '@orka-js/core'

const guard = new PIIGuard()
const detected = guard.detect('My email is john@example.com')
// [{ type: 'email', value: 'john@example.com', start: 12, end: 28 }]

const safe = redactPII('Call me at +1-555-1234')
// 'Call me at [PHONE]'

Streaming

import { consumeStream, parseSSEStream } from '@orka-js/core'

const stream = await llm.stream(messages)
const full = await consumeStream(stream)

// SSE from HTTP response
const events = parseSSEStream(response.body!)
for await (const event of events) {
  console.log(event)
}

Callbacks

import { CallbackManager } from '@orka-js/core'

const callbacks = new CallbackManager({
  onStart: (run) => console.log('Started', run.id),
  onEnd: (run) => console.log('Done in', run.duration, 'ms'),
  onError: (run, err) => console.error('Error', err),
  onToken: (token) => process.stdout.write(token),
})

Key Exports

ExportDescription
OrkaMain entry point class
createOrka(config)Factory function
KnowledgeDocument ingestion and RAG
LLMAdapterInterface for custom LLM adapters
VectorDBAdapterInterface for custom vector DB adapters
PIIGuardPII detection and redaction
detectPII(text)Standalone PII detection
redactPII(text)Standalone PII redaction
CallbackManagerLifecycle hooks
consumeStream(stream)Collect full stream output
parseSSEStream(body)Parse SSE streams
chunkDocument(doc, opts)Split documents into chunks
generateId()Generate unique IDs
OrkaError, OrkaErrorCodeTyped error classes
  • orkajs — Full bundle with all adapters
  • @orka-js/openai — OpenAI adapter
  • @orka-js/anthropic — Anthropic adapter
  • @orka-js/agent — Agent system

Keywords

orkajs

FAQs

Package last updated on 07 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts