Spaces:
Runtime error
Runtime error
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>
Files changed (6)
1234import { query_intent } from "@botcierge/sdk";const result = await query_intent("I have food to share");console.log(`Domain: ${result.domain}`);1234import { query_intent } from "../src/index.ts";const result = await query_intent("I have food to share");console.log(`Domain: ${result.domain}`);
1234import { Botcierge } from "@botcierge/sdk";const client = new Botcierge();1234import { Botcierge } from "../src/index.ts";const client = new Botcierge();
1234import { Botcierge } from "@botcierge/sdk";const client = new Botcierge({ baseUrl: "http://staging.botcierge.com:8000" });1234import { Botcierge } from "../src/index.ts";const client = new Botcierge({ baseUrl: "http://staging.botcierge.com:8000" });
1234import { query_intent } from "@botcierge/sdk";try {const result = await query_intent("I want to add an item to my shopping list");1234import { query_intent } from "../src/index.ts";try {const result = await query_intent("I want to add an item to my shopping list");
1 unmodified line2345671 unmodified line"name": "@botcierge/sdk","version": "0.1.1","description": "SDK for Botcierge Intent Classification","main": "./dist/index.js","module": "./dist/index.mjs","types": "./dist/index.d.ts",1 unmodified line23456781 unmodified line"name": "@botcierge/sdk","version": "0.1.1","description": "SDK for Botcierge Intent Classification","type": "module","main": "./dist/index.js","module": "./dist/index.mjs","types": "./dist/index.d.ts",
1 unmodified line23456781 unmodified linedomain: string;intent: string;confidence: "high" | "medium" | "low";scores: Record<string, number>;}export interface BotciergeConfig {1 unmodified line23456781 unmodified linedomain: string;intent: string;confidence: "high" | "medium" | "low";scores?: Record<string, number>;}export interface BotciergeConfig {
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
sdk-js/src/index.ts+1-1