Spaces:
Sleeping
Sleeping
horriblecpp Claude Sonnet 4.6 commited on
Commit ·
d58e081
1
Parent(s): 87996a7
Fix examples to run correctly end-to-end
Browse files- Switch example imports from @botcierge/sdk to ../src/index.ts so they
work without a dist/ build step when run with tsx
- Add "type": "module" to package.json so top-level await works in ESM
- Make IntentResult.scores optional to match what the backend actually
returns (classify() only returns domain, intent, confidence)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- sdk-js/examples/basic.ts +1 -1
- sdk-js/examples/batch.ts +1 -1
- sdk-js/examples/custom-client.ts +1 -1
- sdk-js/examples/error-handling.ts +1 -1
- sdk-js/package.json +1 -0
- sdk-js/src/index.ts +1 -1
sdk-js/examples/basic.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import { query_intent } from "
|
| 2 |
|
| 3 |
const result = await query_intent("I have food to share");
|
| 4 |
console.log(`Domain: ${result.domain}`);
|
|
|
|
| 1 |
+
import { query_intent } from "../src/index.ts";
|
| 2 |
|
| 3 |
const result = await query_intent("I have food to share");
|
| 4 |
console.log(`Domain: ${result.domain}`);
|
sdk-js/examples/batch.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import { Botcierge } from "
|
| 2 |
|
| 3 |
const client = new Botcierge();
|
| 4 |
|
|
|
|
| 1 |
+
import { Botcierge } from "../src/index.ts";
|
| 2 |
|
| 3 |
const client = new Botcierge();
|
| 4 |
|
sdk-js/examples/custom-client.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import { Botcierge } from "
|
| 2 |
|
| 3 |
const client = new Botcierge({ baseUrl: "http://staging.botcierge.com:8000" });
|
| 4 |
|
|
|
|
| 1 |
+
import { Botcierge } from "../src/index.ts";
|
| 2 |
|
| 3 |
const client = new Botcierge({ baseUrl: "http://staging.botcierge.com:8000" });
|
| 4 |
|
sdk-js/examples/error-handling.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import { query_intent } from "
|
| 2 |
|
| 3 |
try {
|
| 4 |
const result = await query_intent("I want to add an item to my shopping list");
|
|
|
|
| 1 |
+
import { query_intent } from "../src/index.ts";
|
| 2 |
|
| 3 |
try {
|
| 4 |
const result = await query_intent("I want to add an item to my shopping list");
|
sdk-js/package.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
"name": "@botcierge/sdk",
|
| 3 |
"version": "0.1.1",
|
| 4 |
"description": "SDK for Botcierge Intent Classification",
|
|
|
|
| 5 |
"main": "./dist/index.js",
|
| 6 |
"module": "./dist/index.mjs",
|
| 7 |
"types": "./dist/index.d.ts",
|
|
|
|
| 2 |
"name": "@botcierge/sdk",
|
| 3 |
"version": "0.1.1",
|
| 4 |
"description": "SDK for Botcierge Intent Classification",
|
| 5 |
+
"type": "module",
|
| 6 |
"main": "./dist/index.js",
|
| 7 |
"module": "./dist/index.mjs",
|
| 8 |
"types": "./dist/index.d.ts",
|
sdk-js/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ export interface IntentResult {
|
|
| 2 |
domain: string;
|
| 3 |
intent: string;
|
| 4 |
confidence: "high" | "medium" | "low";
|
| 5 |
-
scores: Record<string, number>;
|
| 6 |
}
|
| 7 |
|
| 8 |
export interface BotciergeConfig {
|
|
|
|
| 2 |
domain: string;
|
| 3 |
intent: string;
|
| 4 |
confidence: "high" | "medium" | "low";
|
| 5 |
+
scores?: Record<string, number>;
|
| 6 |
}
|
| 7 |
|
| 8 |
export interface BotciergeConfig {
|