@yuva-devlab/sdk 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +153 -0
  2. package/package.json +9 -9
package/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # 🚀 @yuva-devlab/sdk
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@yuva-devlab/sdk.svg)](https://www.npmjs.com/package/@yuva-devlab/sdk)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
+ [![TypeScript 6](https://img.shields.io/badge/TypeScript-6.x-3178c6.svg)](https://www.typescriptlang.org)
6
+
7
+ > Master TypeScript SDK for the Yuva DevLab ecosystem. Unifies multi-provider AI inference, RAG embeddings, vector stores, tool registries, semantic caching, billing, resilience pipelines, and event buses into one cohesive developer experience.
8
+
9
+ ---
10
+
11
+ ## Features
12
+
13
+ - 🌟 **Single Master Client (`DevLabClient`)**: Instantly access inference, RAG, caching, tools, billing, and events without juggling fragmented packages.
14
+ - 🧠 **Multi-Provider AI Inference**: Built-in adapters for Google Gemini, OpenAI, Anthropic, Groq, and local Ollama models.
15
+ - 🔍 **Embedded RAG & Vector Engine**: Chunk documents, generate embeddings, and execute similarity searches directly.
16
+ - ⚡ **Zero-Config Semantic Caching**: Automatically cache prompt completions to slash token spend and p99 latency.
17
+ - 🛠️ **Autonomous Agent Tool Registry**: Register typed Zod tools and dynamic prompt compilers.
18
+ - 💳 **Billing & Ledger Attribution**: Automatic token metering, quota checks, and audit-grade cost ledgers.
19
+ - 📦 **Re-Exports of Platform Building Blocks**: Centralized imports for `@yuva-devlab/errors`, `@yuva-devlab/events`, `@yuva-devlab/resilience`, and `@yuva-devlab/agent-core`.
20
+
21
+ ---
22
+
23
+ ## Table of Contents
24
+
25
+ 1. [Installation](#installation)
26
+ 2. [Quick Start](#quick-start)
27
+ 3. [Master Client Capabilities](#master-client-capabilities)
28
+ 4. [Agent & Tool Execution](#agent--tool-execution)
29
+ 5. [RAG & Vector Search](#rag--vector-search)
30
+ 6. [Semantic Caching](#semantic-caching)
31
+ 7. [Author & Attribution](#author--attribution)
32
+
33
+ ---
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ # pnpm (recommended)
39
+ pnpm add @yuva-devlab/sdk
40
+
41
+ # npm
42
+ npm install @yuva-devlab/sdk
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Quick Start
48
+
49
+ Initialize `DevLabClient` with your platform API key:
50
+
51
+ ```typescript
52
+ import { DevLabClient } from "@yuva-devlab/sdk";
53
+
54
+ const client = new DevLabClient({
55
+ apiKey: process.env.DEVLAB_API_KEY,
56
+ tenantId: "tenant_apex",
57
+ gatewayUrl: "http://localhost:4000",
58
+ });
59
+
60
+ // Execute LLM inference with automatic semantic caching and token metering
61
+ const completion = await client.complete({
62
+ model: "gemini-2.5-flash",
63
+ messages: [
64
+ { role: "system", content: "You are an expert platform architect." },
65
+ {
66
+ role: "user",
67
+ content: "Summarize the DevLab microservice telemetry strategy.",
68
+ },
69
+ ],
70
+ });
71
+
72
+ console.log(completion.text);
73
+ console.log(`Tokens Used: ${completion.usage.totalTokens}`);
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Master Client Capabilities
79
+
80
+ `DevLabClient` exposes dedicated platform namespaces:
81
+
82
+ ```typescript
83
+ // 1. Multi-provider AI inference
84
+ const text = await client.ai.generateText({ prompt: "Hello world" });
85
+
86
+ // 2. Semantic vector caching
87
+ const cached = await client.cache.get("Hello world");
88
+
89
+ // 3. Document chunking & vector store
90
+ await client.vectorStore.upsert({ id: "doc-1", content: "Architecture docs" });
91
+
92
+ // 4. Agent tool registry
93
+ client.tools.register(myCustomTool);
94
+
95
+ // 5. Distributed event bus
96
+ client.events.subscribe("order.created", handleOrder);
97
+
98
+ // 6. Cost ledger
99
+ const tenantSpend = await client.billing.getTenantSummary("tenant_apex");
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Agent & Tool Execution
105
+
106
+ Register universal tools with Zod parameters and invoke them seamlessly:
107
+
108
+ ```typescript
109
+ import { z } from "zod";
110
+ import { defineTool } from "@yuva-devlab/sdk";
111
+
112
+ const currencyConverter = defineTool({
113
+ name: "convert_currency",
114
+ description: "Converts fiat amounts based on current rates",
115
+ parameters: z.object({
116
+ amount: z.number(),
117
+ from: z.string(),
118
+ to: z.string(),
119
+ }),
120
+ execute: async ({ amount, from, to }) => {
121
+ return { amount, from, to, converted: amount * 1.08 };
122
+ },
123
+ });
124
+
125
+ client.tools.register(currencyConverter);
126
+ ```
127
+
128
+ ---
129
+
130
+ ## RAG & Vector Search
131
+
132
+ Index documents and query top matches in fewer than 5 lines:
133
+
134
+ ```typescript
135
+ // Index text with automated chunking
136
+ await client.ingestDocument(
137
+ "policy-doc-1",
138
+ "Standard SLAs require 99.99% uptime.",
139
+ );
140
+
141
+ // Search top matches
142
+ const matches = await client.searchContext("What SLA uptime is required?", {
143
+ topK: 2,
144
+ });
145
+ console.log(matches[0].chunk.content);
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Author & Attribution
151
+
152
+ - **Author**: Yuva DevLab (`yuva.devlab@gmail.com`)
153
+ - **License**: MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuva-devlab/sdk",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Unified Master DevLab Platform Client combining AI inference, RAG, swarms, billing, caching, and events",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -25,16 +25,16 @@
25
25
  },
26
26
  "license": "MIT",
27
27
  "dependencies": {
28
- "@yuva-devlab/agent-core": "0.2.0",
29
- "@yuva-devlab/ai-client": "0.2.0",
30
- "@yuva-devlab/auth-server": "1.0.0",
31
- "@yuva-devlab/billing": "0.2.0",
28
+ "@yuva-devlab/agent-core": "0.2.2",
29
+ "@yuva-devlab/ai-client": "0.2.2",
30
+ "@yuva-devlab/auth-server": "1.0.2",
31
+ "@yuva-devlab/billing": "0.2.2",
32
32
  "@yuva-devlab/errors": "0.2.0",
33
- "@yuva-devlab/events": "0.2.1",
34
- "@yuva-devlab/logger": "1.2.0",
35
- "@yuva-devlab/rag": "0.2.0",
33
+ "@yuva-devlab/events": "0.2.3",
34
+ "@yuva-devlab/logger": "1.3.1",
35
+ "@yuva-devlab/rag": "0.2.2",
36
36
  "@yuva-devlab/resilience": "0.2.0",
37
- "@yuva-devlab/semantic-cache": "0.2.0",
37
+ "@yuva-devlab/semantic-cache": "0.2.2",
38
38
  "zod": "^3.25.76"
39
39
  },
40
40
  "devDependencies": {