tekimax-ts 0.2.0 → 0.2.3

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.
package/README.md CHANGED
@@ -18,11 +18,10 @@ npm install tekimax-ts
18
18
  ## 🌟 Features
19
19
 
20
20
  - **Universal API**: One interface for all providers. Switch from OpenAI to Ollama with a single config change.
21
- - **Type Safety**: End-to-end TypeScript support. Zod schemas for runtime validation.
21
+ - **Strict Modality Type Safety**: End-to-end TypeScript support. Strong capability interfaces ensure compile-time safety (e.g., your code won't compile if you call `.images.generate()` on a provider missing the `ImageGenerationCapability`). Zod schemas for runtime validation.
22
22
  - **Zero Latency**: Lightweight adapter pattern with zero runtime overhead.
23
23
  - **Zero CVEs**: Hardened supply chain using Chainguard images.
24
24
  - **Redis Adapter** _(optional)_: Response caching, rate limiting, token budgets, and session storage with any Redis client.
25
- - **Convex Integration**: Provision and manage [Convex](https://convex.dev) projects, push schemas, set env vars, and deploy — all from code.
26
25
 
27
26
  ## 💻 Usage
28
27
 
@@ -53,6 +52,60 @@ const claude = new Tekimax({
53
52
  const local = new Tekimax({
54
53
  provider: new OllamaProvider({ baseUrl: 'http://localhost:11434' })
55
54
  })
55
+
56
+ // Custom Model Proxies (e.g. Internal API gateways)
57
+ const proxyClient = new Tekimax({
58
+ provider: new OpenAIProvider({
59
+ apiKey: process.env.CUSTOM_PROXY_KEY,
60
+ baseURL: 'https://api.my-custom-proxy.internal/v1'
61
+ })
62
+ })
63
+
64
+ ### Streaming
65
+
66
+ Tekimax-TS uses standard Javascript Async Iterables for real-time streaming:
67
+
68
+ ```typescript
69
+ const stream = await client.text.generateStream({
70
+ model: "gpt-4o",
71
+ messages: [{ role: "user", content: "Tell me a story" }]
72
+ })
73
+
74
+ for await (const chunk of stream) {
75
+ process.stdout.write(chunk.delta)
76
+ }
77
+ ```
78
+
79
+ ## 🔌 Plugin Architecture (Lifecycle Hooks)
80
+
81
+ The SDK provides a robust middleware architecture via `plugins`. You can snap in pre-built plugins for Security, Scalability, and Telemetry, or build your own.
82
+
83
+ ```typescript
84
+ import { Tekimax, OpenAIProvider, PIIFilterPlugin, LoggerPlugin, MaxContextOverflowPlugin } from 'tekimax-ts'
85
+
86
+ const client = new Tekimax({
87
+ provider: new OpenAIProvider({ apiKey: 'sk-...' }),
88
+ plugins: [
89
+ new LoggerPlugin(), // Telemetry
90
+ new PIIFilterPlugin(), // Security: Redacts emails and SSNs
91
+ new MaxContextOverflowPlugin(15) // Scalability: Prevents context bloat in long loops
92
+ ]
93
+ })
94
+ ```
95
+
96
+ ### Building Custom Plugins
97
+ Implement the `TekimaxPlugin` interface to hook into the request/response lifecycle:
98
+
99
+ ```typescript
100
+ export interface TekimaxPlugin {
101
+ name: string
102
+ onInit?: (client: Tekimax) => void
103
+ beforeRequest?: (context: PluginContext) => Promise<void | PluginContext>
104
+ afterResponse?: (context: PluginContext, result: ChatResult) => Promise<void>
105
+ onStreamChunk?: (context: PluginContext, chunk: StreamChunk) => void
106
+ beforeToolExecute?: (toolName: string, args: unknown) => Promise<void>
107
+ afterToolExecute?: (toolName: string, result: unknown) => Promise<void>
108
+ }
56
109
  ```
57
110
 
58
111
  ### 2. Multi-Modal Interfaces
@@ -183,7 +236,6 @@ const sessions = new SessionStore(redis, { ttl: 1800 }) // Sessions
183
236
  | **Assistants / Threads** | Stateful conversation management with persistence. Create threads, append messages, and resume conversations across sessions. | 🔜 Planned |
184
237
  | **Fine-tuning API** | Programmatic fine-tuning via OpenAI and Gemini APIs. Upload training data, launch jobs, and deploy custom models through a unified interface. | 🔜 Planned |
185
238
  | **Observability** | OpenTelemetry spans for every provider call — latency, tokens, cost, and error rate. | 🔜 Planned |
186
- | **Convex Integration** | Provision and manage [Convex](https://convex.dev) projects directly via the SDK. Create projects, push schemas, set env vars, and deploy. | ✅ Shipped |
187
239
  | **Redis Adapter** | Optional response caching, rate limiting, token budget tracking, and session storage with any Redis-compatible client. | ✅ Shipped |
188
240
 
189
241
  > **Want to help?** Pick a feature and open a PR, or join the discussion in [GitHub Issues](https://github.com/TEKIMAX/tekimax-ts/issues).