@mentingo/luma-sdk 0.4.0 → 0.5.0
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 +83 -5
- package/dist/{chunk-W5CQGEDB.js → chunk-PHLN53W2.js} +6 -2
- package/dist/{contracts-qTi7LQB8.d.cts → contracts-B44LepMQ.d.cts} +422 -15
- package/dist/{contracts-qTi7LQB8.d.ts → contracts-B44LepMQ.d.ts} +422 -15
- package/dist/contracts.cjs +2 -0
- package/dist/contracts.d.cts +1 -1
- package/dist/contracts.d.ts +1 -1
- package/dist/contracts.js +1 -1
- package/dist/index.cjs +16 -4
- package/dist/index.d.cts +10 -59
- package/dist/index.d.ts +10 -59
- package/dist/index.js +11 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,11 +10,11 @@ It provides two separate clients:
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
pnpm add @mentingo/luma-sdk
|
|
13
|
+
pnpm add @mentingo/luma-sdk@0.5.0
|
|
14
14
|
# or
|
|
15
|
-
npm install @mentingo/luma-sdk
|
|
15
|
+
npm install @mentingo/luma-sdk@0.5.0
|
|
16
16
|
# or
|
|
17
|
-
yarn add @mentingo/luma-sdk
|
|
17
|
+
yarn add @mentingo/luma-sdk@0.5.0
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## Quick Start (HTTP)
|
|
@@ -154,7 +154,7 @@ Namespaces:
|
|
|
154
154
|
|
|
155
155
|
- `client.mentor.streamChat(opts)` - stream mentor chat through the public custom-runtime endpoint. Pass `voiceSessionId` for voice mentor sessions so Luma can forward mentor text directly to the voice session.
|
|
156
156
|
- `client.mentor.chat(opts)` - alias for `client.mentor.streamChat(opts)`.
|
|
157
|
-
- `client.mentor.generateChat(opts)` - generate a non-stream
|
|
157
|
+
- `client.mentor.generateChat(opts, { signal? })` - generate a native non-stream chat response, with optional cancellation.
|
|
158
158
|
- `client.mentor.judge(opts)`
|
|
159
159
|
- `client.ai.createEmbeddings(opts)`
|
|
160
160
|
- `client.ai.generateJudgeConfiguration(opts)`
|
|
@@ -192,7 +192,75 @@ routing. API key settings use extensible non-secret metadata, for example
|
|
|
192
192
|
to `null` removes it. Credentials remain in the write-only `textToSpeechApiKey`
|
|
193
193
|
field; `hasTextToSpeechApiKey` reports whether one is saved.
|
|
194
194
|
|
|
195
|
-
For voice mentor flows, use `client.mentor.streamChat({ ..., voiceSessionId })` so streamed mentor text can be forwarded to the active socket session without a separate polling or relay step. Use `client.mentor.generateChat(opts)`
|
|
195
|
+
For voice mentor flows, use `client.mentor.streamChat({ ..., voiceSessionId })` so streamed mentor text can be forwarded to the active socket session without a separate polling or relay step. Use `client.mentor.generateChat(opts)` for normal one-shot text responses. Tool-capable assistant calls use the native options below and do not attach a voice session.
|
|
196
|
+
|
|
197
|
+
## Native Tool-Capable Chat
|
|
198
|
+
|
|
199
|
+
The existing Mentor client also carries assistant tool calls through Luma's native
|
|
200
|
+
chat API. Luma resolves the API key's configured Custom chat profile; the SDK does
|
|
201
|
+
not choose a vendor or contact an OpenAI chat-completions endpoint.
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
const result = await client.mentor.generateChat(
|
|
205
|
+
{
|
|
206
|
+
messages: [{ role: "user", content: "Read the course title." }],
|
|
207
|
+
tools: [
|
|
208
|
+
{
|
|
209
|
+
name: "read_course",
|
|
210
|
+
description: "Read an authorized course",
|
|
211
|
+
inputSchema: { type: "object", properties: { courseId: { type: "string" } } },
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
toolChoice: "required",
|
|
215
|
+
maxOutputTokens: 2500,
|
|
216
|
+
streamFormat: "events",
|
|
217
|
+
},
|
|
218
|
+
{ signal },
|
|
219
|
+
);
|
|
220
|
+
// result.toolCalls contains native { id, name, arguments } calls.
|
|
221
|
+
// Execute tools with the application's normal authorization checks, then append
|
|
222
|
+
// assistant toolCalls and role: "tool" / toolCallId messages to the next request.
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
For streaming, call `client.mentor.streamChat(opts, { signal })` with
|
|
226
|
+
`streamFormat: "events"`. The existing `/api/public/v1/ai/mentor/chat` route returns
|
|
227
|
+
UTF-8 NDJSON records: `text-delta`, complete `tool-call`, `finish`, or a stable
|
|
228
|
+
`error` code. The response body remains the transport's readable stream; callers
|
|
229
|
+
must decode UTF-8 and newline framing incrementally rather than treating each
|
|
230
|
+
network chunk as one JSON event. The SDK does not execute tools or retry a stream.
|
|
231
|
+
Generation uses the existing `/api/public/v1/ai/mentor/chat/generate` route.
|
|
232
|
+
|
|
233
|
+
Calls omitting tool/event options retain the existing `{ message }` generation
|
|
234
|
+
response and plain-text streaming behavior. `streamChat` already supports request
|
|
235
|
+
cancellation in SDK 0.4.0; the optional generation `signal` parameter is added by
|
|
236
|
+
SDK 0.4.1. Model execution, provider availability and fallback policy stay with
|
|
237
|
+
Luma and the consuming application. Deploy the matching Luma native tool-chat
|
|
238
|
+
contract before enabling event-mode callers.
|
|
239
|
+
|
|
240
|
+
## Native Embeddings
|
|
241
|
+
|
|
242
|
+
Use the existing AI client to embed text with the API key's configured Custom
|
|
243
|
+
embedding profile:
|
|
244
|
+
|
|
245
|
+
```ts
|
|
246
|
+
const result = await client.ai.createEmbeddings({
|
|
247
|
+
texts: ["Customer onboarding policy"],
|
|
248
|
+
dimensions: 1536,
|
|
249
|
+
});
|
|
250
|
+
// result.embeddings contains the vectors; result.model identifies the profile model.
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
This calls `POST /api/public/v1/ai/embeddings` with the normal `X-API-Key`
|
|
254
|
+
transport. `dimensions` is optional and must be supported by the configured model.
|
|
255
|
+
Luma validates the returned vector count, dimensions and finite values. The model
|
|
256
|
+
identity comes from the same runtime resolution that produced the vectors.
|
|
257
|
+
Texts-only calls remain valid. Older Luma responses may omit `model`; consumers
|
|
258
|
+
that persist or compare vector spaces must reject missing identity rather than
|
|
259
|
+
assuming a model. Matching dimensions alone do not make embedding spaces compatible.
|
|
260
|
+
|
|
261
|
+
The public contract is generated from Mentingo AI PR #63. The SDK update adds types
|
|
262
|
+
and transport regressions; published SDK 0.4.0 already forwards these additive body
|
|
263
|
+
and response fields unchanged at runtime. No OpenAI-format embeddings relay is used.
|
|
196
264
|
|
|
197
265
|
## Durable Course Authoring
|
|
198
266
|
|
|
@@ -201,6 +269,16 @@ submit commands, upload source documents, answer authorized context requests, pr
|
|
|
201
269
|
exports, and record application receipts. Course changes remain reviewable proposals; the SDK
|
|
202
270
|
never applies them to the consuming application's database.
|
|
203
271
|
|
|
272
|
+
To open an AI authoring session before the course exists, supply an
|
|
273
|
+
`AuthoringDraftCourseContext` to `createSession`. Both `courseId` fields use the
|
|
274
|
+
host's reserved UUID. The context supplies available categories, the actor's
|
|
275
|
+
category creation capability, and an optional tenant palette. The initial
|
|
276
|
+
session language is the UI language. The `course.create` operation in a frozen
|
|
277
|
+
export carries the proposed course language. Apply that operation through the
|
|
278
|
+
host's native permissions and course creation path, then send an applied receipt
|
|
279
|
+
whose `idMappings` maps the draft UUID to the created course ID. Luma retains the
|
|
280
|
+
same authoring session ID.
|
|
281
|
+
|
|
204
282
|
Snapshot tasks expose optional `failure` metadata with a stable code and recovery action.
|
|
205
283
|
Clients should use `retry_failed_parts`, `answer_question`, `retry_provider`, or `service_fix`
|
|
206
284
|
to present the appropriate next step rather than retrying every failure automatically.
|
|
@@ -37,6 +37,7 @@ var TaskKind = /* @__PURE__ */ ((TaskKind2) => {
|
|
|
37
37
|
TaskKind2["Lesson"] = "lesson";
|
|
38
38
|
TaskKind2["Edit"] = "edit";
|
|
39
39
|
TaskKind2["Source"] = "source";
|
|
40
|
+
TaskKind2["SourceVision"] = "source_vision";
|
|
40
41
|
TaskKind2["Asset"] = "asset";
|
|
41
42
|
TaskKind2["CourseReview"] = "course_review";
|
|
42
43
|
return TaskKind2;
|
|
@@ -69,6 +70,7 @@ var AiModelDomain = /* @__PURE__ */ ((AiModelDomain2) => {
|
|
|
69
70
|
AiModelDomain2["AiJudgeConfigurationValidator"] = "aiJudgeConfigurationValidator";
|
|
70
71
|
AiModelDomain2["Translations"] = "translations";
|
|
71
72
|
AiModelDomain2["CourseGeneration"] = "courseGeneration";
|
|
73
|
+
AiModelDomain2["CourseGenerationVision"] = "courseGenerationVision";
|
|
72
74
|
AiModelDomain2["CourseGenerationVisualAssets"] = "courseGenerationVisualAssets";
|
|
73
75
|
AiModelDomain2["CourseGenerationEmbeddings"] = "courseGenerationEmbeddings";
|
|
74
76
|
AiModelDomain2["Embeddings"] = "embeddings";
|
|
@@ -90,6 +92,7 @@ var AiCapabilityMode = /* @__PURE__ */ ((AiCapabilityMode2) => {
|
|
|
90
92
|
})(AiCapabilityMode || {});
|
|
91
93
|
var AiCapability = /* @__PURE__ */ ((AiCapability2) => {
|
|
92
94
|
AiCapability2["CourseGeneration"] = "courseGeneration";
|
|
95
|
+
AiCapability2["CourseGenerationVision"] = "courseGenerationVision";
|
|
93
96
|
AiCapability2["CourseGenerationVisualAssets"] = "courseGenerationVisualAssets";
|
|
94
97
|
AiCapability2["CourseGenerationEmbeddings"] = "courseGenerationEmbeddings";
|
|
95
98
|
AiCapability2["AiMentorChat"] = "aiMentorChat";
|
|
@@ -213,7 +216,7 @@ var API = class extends HttpClient {
|
|
|
213
216
|
...params
|
|
214
217
|
}),
|
|
215
218
|
/**
|
|
216
|
-
*
|
|
219
|
+
* @description Existing text stream by default; streamFormat=events opts into newline-delimited native text, complete tool-call, finish and sanitized error events. Tools execute in the caller, never in Luma.
|
|
217
220
|
*
|
|
218
221
|
* @tags Public - Require API Key
|
|
219
222
|
* @name MentorChatApiPublicV1AiMentorChatPost
|
|
@@ -356,7 +359,7 @@ var API = class extends HttpClient {
|
|
|
356
359
|
...params
|
|
357
360
|
}),
|
|
358
361
|
/**
|
|
359
|
-
*
|
|
362
|
+
* @description Embeds texts using the API key's Custom embeddings runtime. Optional dimensions requests a positive vector size. The response model identifies the same resolved runtime used to produce the validated vectors.
|
|
360
363
|
*
|
|
361
364
|
* @tags Public - Require API Key
|
|
362
365
|
* @name CreateEmbeddingsApiPublicV1AiEmbeddingsPost
|
|
@@ -795,6 +798,7 @@ var LUMA_AI_MODEL_DOMAINS = {
|
|
|
795
798
|
AI_JUDGE_CONFIGURATION_VALIDATOR: "aiJudgeConfigurationValidator" /* AiJudgeConfigurationValidator */,
|
|
796
799
|
TRANSLATIONS: "translations" /* Translations */,
|
|
797
800
|
COURSE_GENERATION: "courseGeneration" /* CourseGeneration */,
|
|
801
|
+
COURSE_GENERATION_VISION: "courseGenerationVision" /* CourseGenerationVision */,
|
|
798
802
|
COURSE_GENERATION_VISUAL_ASSETS: "courseGenerationVisualAssets" /* CourseGenerationVisualAssets */,
|
|
799
803
|
COURSE_GENERATION_EMBEDDINGS: "courseGenerationEmbeddings" /* CourseGenerationEmbeddings */,
|
|
800
804
|
EMBEDDINGS: "embeddings" /* Embeddings */,
|