@naturali/sdk 0.178.0 → 0.179.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/dist/index.cjs CHANGED
@@ -1735,14 +1735,38 @@ var Assistant = class {
1735
1735
  });
1736
1736
  }
1737
1737
  /**
1738
- * Read the conversation
1738
+ * List your conversations
1739
1739
  *
1740
- * The newest 100 messages of your conversation with the Assistant in the app, oldest first. An account that has not messaged it yet has an empty conversation.
1740
+ * Your conversations with the Assistant in the app, newest first. Each is a session of its own; a conversation on Discord or WhatsApp is not listed here.
1741
1741
  *
1742
1742
  */
1743
- static listAssistantMessages(options) {
1743
+ static listAssistantSessions(options) {
1744
1744
  return (options?.client ?? client).get({
1745
- url: "/v1/assistant/messages",
1745
+ url: "/v1/assistant/sessions",
1746
+ ...options
1747
+ });
1748
+ }
1749
+ /**
1750
+ * Start a conversation
1751
+ *
1752
+ * Opens a new, empty conversation with the Assistant. It costs nothing until a message is sent, and it does not expire.
1753
+ *
1754
+ */
1755
+ static createAssistantSession(options) {
1756
+ return (options?.client ?? client).post({
1757
+ url: "/v1/assistant/sessions",
1758
+ ...options
1759
+ });
1760
+ }
1761
+ /**
1762
+ * Read a conversation
1763
+ *
1764
+ * The newest 100 messages of one conversation, oldest first.
1765
+ *
1766
+ */
1767
+ static listAssistantSessionMessages(options) {
1768
+ return (options.client ?? client).get({
1769
+ url: "/v1/assistant/sessions/{session_id}/messages",
1746
1770
  ...options
1747
1771
  });
1748
1772
  }
@@ -1752,9 +1776,9 @@ var Assistant = class {
1752
1776
  * Runs one turn as your account and answers with the messages it added: yours, then the Assistant's reply. The turn is paid from your credit and refused before it runs when the balance is below zero.
1753
1777
  *
1754
1778
  */
1755
- static sendAssistantMessage(options) {
1779
+ static sendAssistantSessionMessage(options) {
1756
1780
  return (options.client ?? client).post({
1757
- url: "/v1/assistant/messages",
1781
+ url: "/v1/assistant/sessions/{session_id}/messages",
1758
1782
  ...options,
1759
1783
  headers: {
1760
1784
  "Content-Type": "application/json",
@@ -2086,7 +2110,7 @@ var Deciders = class {
2086
2110
  /**
2087
2111
  * Create a decider
2088
2112
  *
2089
- * Creates a decider at version 1: a named question set and the backend that answers it, exactly one of `agent_id` and `tool_id`. Every question declares a finite answer space, validated here. The backend must be in the decider's project. An agent must carry no tool surface — no tool binding left active by `active_tool_ids` and no `knowledge_config.write_memory_store_id` — or the create is refused with `400 DECIDER_AGENT_NOT_TOOL_LESS`. A tool must be `http` or `pipeline` and must not pin `state` or `questions` in its `preset_parameters`, or the create is refused with `400 DECIDER_TOOL_NOT_CALLABLE`. A duplicate `name` in the project is `409 NAME_CONFLICT`.
2113
+ * Creates a decider at version 1: a named question set and the backend that answers it, exactly one of `agent_id` and `tool_id`. Every question declares a finite answer space, validated here. The backend must be in the decider's project. An agent must carry no tool surface — no tool binding left active by `active_tool_ids` and no `knowledge_config.write_memory_store_id` — or the create is refused with `400 DECIDER_AGENT_NOT_TOOL_LESS`. A tool must be `http` or `pipeline` and must not pin `input` or `questions` in its `preset_parameters`, or the create is refused with `400 DECIDER_TOOL_NOT_CALLABLE`. A duplicate `name` in the project is `409 NAME_CONFLICT`.
2090
2114
  */
2091
2115
  static createDecider(options) {
2092
2116
  return (options.client ?? client).post({
@@ -2175,11 +2199,11 @@ var Deciders = class {
2175
2199
  /**
2176
2200
  * Request a decision
2177
2201
  *
2178
- * Evaluates the decider against `state` and records the decision. The questions come from the decider, never from the request, so a call site can only supply what is judged.
2202
+ * Evaluates the decider against `input` and records the decision. The questions come from the decider, never from the request, so a call site can only supply what is judged. To send the questions with the request, use `POST /v1/projects/{project_id}/decisions`.
2179
2203
  *
2180
2204
  * Everything that can refuse the request is checked before the decision is written, so a refusal is a `4xx` and never a polled failure: the agent's tool surface (`400 DECIDER_AGENT_NOT_TOOL_LESS`), a tool that cannot answer (`400 DECIDER_TOOL_NOT_CALLABLE`), a paused project (`409 PROJECT_PAUSED`) and, for an agent, quota admission (`429 QUOTA_EXCEEDED`).
2181
2205
  *
2182
- * A tool backend is called with `{ state, questions }` and must answer `{ answers: { <question id>: { choice | score | value, probabilities? } } }`; an answer outside that contract fails the decision with `DECISION_ANSWER_INVALID`.
2206
+ * A tool backend is called with `{ input, questions }` and must answer `{ answers: [{ name, probability | choice | score, probabilities?, confidence? }] }`, the request and response of OpenAI's Decisions API; an answer outside that contract fails the decision with `DECISION_ANSWER_INVALID`.
2183
2207
  *
2184
2208
  * With `wait: false`, the default, the answer is `201` with the decision `queued`; poll `GET /v1/projects/{project_id}/decisions/{decision_id}` or subscribe to `decisions.completed` and `decisions.failed`. With `wait: true` it is `201` with the decision settled.
2185
2209
  */
@@ -2205,6 +2229,23 @@ var Deciders = class {
2205
2229
  });
2206
2230
  }
2207
2231
  /**
2232
+ * Request a decision with inline questions
2233
+ *
2234
+ * Evaluates `questions` sent with the request against `input`, answered by the agent or tool the request names (exactly one of `agent_id` and `tool_id`, held to the same rules as a decider's backend), and records the decision with its questions. The request and answers are those of OpenAI's Decisions API, with the backend in place of `model`.
2235
+ *
2236
+ * No decider names the questions, so the decision carries them in `questions` and has no `decider_id` or `decider_version`. Admission, `wait` and the tool contract are those of `POST /v1/projects/{project_id}/deciders/{decider_id}/decisions`.
2237
+ */
2238
+ static createInlineDecision(options) {
2239
+ return (options.client ?? client).post({
2240
+ url: "/v1/projects/{project_id}/decisions",
2241
+ ...options,
2242
+ headers: {
2243
+ "Content-Type": "application/json",
2244
+ ...options.headers
2245
+ }
2246
+ });
2247
+ }
2248
+ /**
2208
2249
  * Get a decision
2209
2250
  *
2210
2251
  * Returns a decision. Poll it after a `wait: false` request until `status` is `completed` or `failed`.