Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/client-readme-retired-ai-methods.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@objectstack/client": patch
---

The README's namespace tour documents the `ai` surface that exists, not the three methods v17 removed.

`client.ai.nlq` / `.suggest` / `.insights` were deleted in 17.0.0 (#3718) — and no server in any repo ever mounted `/api/v1/ai/{nlq,suggest,insights}`, so they 404ed for the whole life of the namespace. The README's "AI Services" example still showed all three. Because `files` ships `README.md` inside the tarball, that example is the package's npm front page: a TypeScript reader copying it gets TS2339 on three properties that are not on `client.ai`, and a JavaScript reader gets a runtime `TypeError`.

The block now shows the surface the client really exposes — `ai.chat` (with a read of `answer.content` / `answer.usage`), `ai.complete`, `ai.models`, `ai.conversations.list`, `ai.agents.chat`, `ai.pendingActions.list` — every call type-checked against the package's own published `dist/index.d.ts`. It also names the condition a reader will otherwise hit unexplained: the AI routes are served by `service-ai` (a Cloud/EE package), and an environment without it answers 501 rather than 404, with the remedy discovery reports under `services.ai`.

No behaviour changes. `patch` rather than no changeset because the README is a published file of this package, so correcting it changes what `@objectstack/client` ships; the docs site's Client SDK page already carried this correction and is untouched here.
14 changes: 10 additions & 4 deletions packages/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,16 @@ await client.approvals.reject(requestId, 'Incomplete');
await client.notifications.list({ read: false }); // unread only
await client.notifications.markRead(['notif-1', 'notif-2']);

// AI Services
await client.ai.nlq({ query: 'Show me all active contacts' });
await client.ai.suggest({ object: 'contact', field: 'industry' });
await client.ai.insights({ object: 'sales', recordId: dealId });
// AI Services — served by an AI service plugin (`service-ai`, a Cloud/EE
// package). The `/ai` routes are mounted either way, so an environment without
// it answers 501, not 404; discovery carries the same remedy under `services.ai`.
const answer = await client.ai.chat({ messages: [{ role: 'user', content: 'How many open orders this quarter?' }] });
console.log(answer.content, answer.usage?.totalTokens);
await client.ai.complete({ prompt: 'Summarise this account in one line:' });
await client.ai.models(); // picker list — allowlist objects or bare ids, both live
await client.ai.conversations.list({ limit: 20 });
await client.ai.agents.chat('build', { messages: [{ role: 'user', content: 'Draft a follow-up' }] });
await client.ai.pendingActions.list({ status: 'pending' }); // human-in-the-loop queue

// Internationalization
await client.i18n.getLocales();
Expand Down
Loading