@arbidocs/sdk 0.4.166 → 0.4.168

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
@@ -20,10 +20,10 @@ await arbi.selectWorkspace(workspaces[0].external_id)
20
20
 
21
21
  // Ask a streaming question about your documents
22
22
  const docs = await arbi.documents.list()
23
- await arbi.assistant.query('Summarize this document', {
24
- docIds: [docs[0].external_id],
25
- onToken: (token) => process.stdout.write(token),
26
- })
23
+ await arbi.assistant.ask(
24
+ { question: 'Summarize this document', docIds: [docs[0].external_id] },
25
+ { onToken: (token) => process.stdout.write(token) }
26
+ )
27
27
  ```
28
28
 
29
29
  For Node.js, install `fake-indexeddb` and import it first:
@@ -57,7 +57,7 @@ await arbi.logout()
57
57
  | `arbi.workspaces` | `list()`, `create()`, `update()`, `delete()`, `listUsers()`, `addUsers()`, `removeUsers()` |
58
58
  | `arbi.documents` | `list()`, `get()`, `uploadFile()`, `uploadUrl()`, `update()`, `delete()`, `download()` |
59
59
  | `arbi.conversations` | `list()`, `getThreads()`, `updateTitle()`, `share()`, `delete()` |
60
- | `arbi.assistant` | `query(question, options)`, `retrieve(query, docIds)`, `respond(messageId, answer)` |
60
+ | `arbi.assistant` | `ask(request, handlers)`, `attachRun(responseId, handlers)`, `interject(messageId, text)`, `cancel(responseId)`, `retrieve(query, docIds)` |
61
61
  | `arbi.tags` | `list()`, `create()`, `update()`, `delete()` |
62
62
  | `arbi.doctags` | `assign()`, `remove()`, `generate()` |
63
63
  | `arbi.contacts` | `list()`, `add()`, `remove()` |
@@ -66,15 +66,20 @@ await arbi.logout()
66
66
  ## Streaming AI queries
67
67
 
68
68
  ```typescript
69
- const result = await arbi.assistant.query('What does section 3 say?', {
70
- docIds: [docId],
71
- previousResponseId: lastMessageId, // for multi-turn conversations
72
- onToken: (token) => { /* append to UI */ },
73
- onStreamStart: ({ assistant_message_ext_id }) => { /* save for follow-ups */ },
74
- onAgentStep: (step) => { /* agent tool usage */ },
75
- onError: (message) => { /* handle error */ },
76
- onComplete: () => { /* done */ },
77
- })
69
+ const result = await arbi.assistant.ask(
70
+ {
71
+ question: 'What does section 3 say?',
72
+ docIds: [docId],
73
+ previousResponseId: lastMessageId, // for multi-turn conversations
74
+ },
75
+ {
76
+ onToken: (token) => { /* append to UI */ },
77
+ onStreamStart: ({ assistant_message_ext_id }) => { /* save for follow-ups */ },
78
+ onOutputItemDone: (event) => { /* an agent step settled */ },
79
+ onError: (error) => { /* the server's report (string) or the connection (Error) */ },
80
+ onComplete: () => { /* done */ },
81
+ }
82
+ )
78
83
 
79
84
  // result.text — full accumulated response
80
85
  // result.assistantMessageExtId — use as previousResponseId for follow-ups