@opencode/ai 2.2.4 → 2.2.6

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.
Files changed (264) hide show
  1. package/README.md +133 -69
  2. package/dist/cache-policy.d.ts +1 -1
  3. package/dist/cache-policy.js +16 -4
  4. package/dist/decision-client.d.ts +3 -3
  5. package/dist/decision.d.ts +20 -125
  6. package/dist/decision.js +25 -15
  7. package/dist/effect.d.ts +4 -15
  8. package/dist/effect.js +2 -6
  9. package/dist/effort-updates.d.ts +3 -3
  10. package/dist/effort-updates.js +2 -2
  11. package/dist/experimental/cloudflare-run-extraction.d.ts +7 -3
  12. package/dist/experimental/cloudflare-run-extraction.js +4 -1
  13. package/dist/experimental/extraction.d.ts +10 -40
  14. package/dist/experimental/extraction.js +14 -13
  15. package/dist/experimental.d.ts +8 -8
  16. package/dist/experimental.js +4 -4
  17. package/dist/generation.d.ts +0 -2
  18. package/dist/generation.js +2 -2
  19. package/dist/image-client.d.ts +13 -7
  20. package/dist/image-client.js +1 -1
  21. package/dist/image.d.ts +357 -464
  22. package/dist/image.js +17 -15
  23. package/dist/index.d.ts +28 -465
  24. package/dist/index.js +18 -17
  25. package/dist/llm.d.ts +65 -266
  26. package/dist/llm.js +101 -92
  27. package/dist/loop.d.ts +38 -0
  28. package/dist/loop.js +136 -0
  29. package/dist/media-model.d.ts +1 -1
  30. package/dist/media-model.js +8 -6
  31. package/dist/media.d.ts +9 -0
  32. package/dist/media.js +37 -2
  33. package/dist/protocols/alibaba-chat.d.ts +5 -1
  34. package/dist/protocols/alibaba-chat.js +3 -3
  35. package/dist/protocols/alibaba-images.d.ts +2 -2
  36. package/dist/protocols/alibaba-messages.js +3 -3
  37. package/dist/protocols/alibaba-responses.js +8 -20
  38. package/dist/protocols/anthropic-messages.d.ts +1 -1
  39. package/dist/protocols/anthropic-messages.js +57 -185
  40. package/dist/protocols/assemblyai-transcription.d.ts +2 -2
  41. package/dist/protocols/bedrock-converse.js +11 -22
  42. package/dist/protocols/cartesia-speech.d.ts +2 -2
  43. package/dist/protocols/cloudflare-workers-ai-images.d.ts +2 -2
  44. package/dist/protocols/cohere-chat.js +9 -12
  45. package/dist/protocols/deepgram-speech.d.ts +2 -2
  46. package/dist/protocols/deepgram-transcription.d.ts +2 -2
  47. package/dist/protocols/elevenlabs-speech.d.ts +2 -2
  48. package/dist/protocols/elevenlabs-transcription.d.ts +2 -2
  49. package/dist/protocols/gemini.d.ts +3 -0
  50. package/dist/protocols/gemini.js +56 -89
  51. package/dist/protocols/google-images.d.ts +2 -2
  52. package/dist/protocols/google-interactions.d.ts +3 -4
  53. package/dist/protocols/google-interactions.js +54 -32
  54. package/dist/protocols/google-speech.d.ts +2 -2
  55. package/dist/protocols/google-transcription.d.ts +2 -2
  56. package/dist/protocols/google-video.d.ts +2 -2
  57. package/dist/protocols/meta-images.d.ts +2 -2
  58. package/dist/protocols/meta-responses.js +26 -23
  59. package/dist/protocols/minimax-images.d.ts +2 -2
  60. package/dist/protocols/mistral-chat.js +14 -20
  61. package/dist/protocols/open-responses-channel.js +6 -19
  62. package/dist/protocols/open-responses-continuation.d.ts +1 -5
  63. package/dist/protocols/open-responses-continuation.js +1 -3
  64. package/dist/protocols/open-responses.d.ts +1 -21
  65. package/dist/protocols/open-responses.js +10 -15
  66. package/dist/protocols/openai-chat.d.ts +3 -23
  67. package/dist/protocols/openai-chat.js +26 -47
  68. package/dist/protocols/openai-compatible-chat.d.ts +1 -1
  69. package/dist/protocols/openai-compatible-responses.d.ts +2 -2
  70. package/dist/protocols/openai-compatible-responses.js +1 -1
  71. package/dist/protocols/openai-decisions.js +1 -1
  72. package/dist/protocols/openai-images.d.ts +2 -2
  73. package/dist/protocols/openai-responses.js +10 -29
  74. package/dist/protocols/openai-speech.d.ts +2 -2
  75. package/dist/protocols/openai-transcription.d.ts +2 -2
  76. package/dist/protocols/runway-video.d.ts +2 -2
  77. package/dist/protocols/shared.d.ts +1 -4
  78. package/dist/protocols/shared.js +13 -11
  79. package/dist/protocols/system-one.d.ts +4 -4
  80. package/dist/protocols/utils/bedrock-cache.js +2 -5
  81. package/dist/protocols/utils/bedrock-media.d.ts +0 -3
  82. package/dist/protocols/utils/cache.d.ts +3 -0
  83. package/dist/protocols/utils/cache.js +15 -2
  84. package/dist/protocols/utils/image-sizing.d.ts +1 -1
  85. package/dist/protocols/utils/responses-checkpoint.js +1 -1
  86. package/dist/protocols/utils/responses-compaction.d.ts +1 -1
  87. package/dist/protocols/utils/responses-compaction.js +6 -5
  88. package/dist/protocols/utils/responses-hosted-tools.d.ts +97 -1
  89. package/dist/protocols/utils/responses-hosted-tools.js +31 -0
  90. package/dist/protocols/utils/tool-stream.d.ts +5 -271
  91. package/dist/protocols/utils/tool-stream.js +3 -13
  92. package/dist/protocols/venice-chat.d.ts +3 -1
  93. package/dist/protocols/venice-chat.js +4 -4
  94. package/dist/protocols/xai-images.d.ts +2 -2
  95. package/dist/protocols/xai-responses.js +5 -25
  96. package/dist/protocols/xai-video.d.ts +2 -2
  97. package/dist/protocols/zai-chat.d.ts +5 -1
  98. package/dist/protocols/zai-chat.js +1 -1
  99. package/dist/protocols/zai-images.d.ts +2 -2
  100. package/dist/protocols/zai-messages.js +3 -3
  101. package/dist/provider-error.d.ts +0 -1
  102. package/dist/provider-error.js +9 -80
  103. package/dist/providers/alibaba.d.ts +67 -4
  104. package/dist/providers/alibaba.js +6 -1
  105. package/dist/providers/amazon-bedrock-mantle.d.ts +6 -3
  106. package/dist/providers/amazon-bedrock-mantle.js +6 -3
  107. package/dist/providers/amazon-bedrock.d.ts +6 -7
  108. package/dist/providers/amazon-bedrock.js +1 -1
  109. package/dist/providers/anthropic-compatible.d.ts +7 -8
  110. package/dist/providers/anthropic-compatible.js +2 -5
  111. package/dist/providers/anthropic.d.ts +8 -9
  112. package/dist/providers/anthropic.js +2 -7
  113. package/dist/providers/assemblyai.d.ts +2 -2
  114. package/dist/providers/assemblyai.js +2 -7
  115. package/dist/providers/azure/messages.d.ts +2 -0
  116. package/dist/providers/azure/messages.js +1 -0
  117. package/dist/providers/azure.d.ts +322 -7
  118. package/dist/providers/azure.js +25 -9
  119. package/dist/providers/baseten.d.ts +5 -5
  120. package/dist/providers/baseten.js +7 -21
  121. package/dist/providers/cartesia.d.ts +1 -1
  122. package/dist/providers/cerebras.d.ts +5 -5
  123. package/dist/providers/cerebras.js +4 -15
  124. package/dist/providers/cloudflare-ai-gateway.d.ts +21 -13
  125. package/dist/providers/cloudflare-ai-gateway.js +28 -40
  126. package/dist/providers/cloudflare-shared.d.ts +9 -0
  127. package/dist/providers/cloudflare-shared.js +25 -0
  128. package/dist/providers/cloudflare-workers-ai.d.ts +4 -4
  129. package/dist/providers/cloudflare-workers-ai.js +4 -20
  130. package/dist/providers/cohere/chat.js +2 -7
  131. package/dist/providers/cohere.d.ts +6 -5
  132. package/dist/providers/cohere.js +7 -13
  133. package/dist/providers/deepgram.d.ts +2 -2
  134. package/dist/providers/deepgram.js +2 -7
  135. package/dist/providers/deepinfra.d.ts +5 -5
  136. package/dist/providers/deepinfra.js +5 -13
  137. package/dist/providers/deepseek.d.ts +5 -5
  138. package/dist/providers/deepseek.js +3 -14
  139. package/dist/providers/digitalocean.d.ts +8 -5
  140. package/dist/providers/digitalocean.js +13 -14
  141. package/dist/providers/elevenlabs.d.ts +2 -2
  142. package/dist/providers/elevenlabs.js +2 -7
  143. package/dist/providers/fireworks.d.ts +5 -5
  144. package/dist/providers/fireworks.js +4 -15
  145. package/dist/providers/google/interactions.d.ts +1 -1
  146. package/dist/providers/google/interactions.js +2 -7
  147. package/dist/providers/google-vertex-chat.d.ts +3 -3
  148. package/dist/providers/google-vertex-chat.js +3 -29
  149. package/dist/providers/google-vertex-interactions.d.ts +3 -3
  150. package/dist/providers/google-vertex-messages.d.ts +3 -3
  151. package/dist/providers/google-vertex-messages.js +3 -29
  152. package/dist/providers/google-vertex-mistral.d.ts +3 -3
  153. package/dist/providers/google-vertex-mistral.js +3 -29
  154. package/dist/providers/google-vertex-responses.d.ts +3 -3
  155. package/dist/providers/google-vertex-responses.js +4 -30
  156. package/dist/providers/google-vertex-shared.d.ts +31 -0
  157. package/dist/providers/google-vertex-shared.js +25 -0
  158. package/dist/providers/google-vertex.d.ts +3 -3
  159. package/dist/providers/google.d.ts +15 -13
  160. package/dist/providers/google.js +9 -19
  161. package/dist/providers/groq.d.ts +5 -5
  162. package/dist/providers/groq.js +4 -15
  163. package/dist/providers/meta.d.ts +5 -5
  164. package/dist/providers/meta.js +10 -24
  165. package/dist/providers/minimax/chat.js +2 -7
  166. package/dist/providers/minimax/responses.js +2 -7
  167. package/dist/providers/minimax.d.ts +5 -5
  168. package/dist/providers/minimax.js +11 -23
  169. package/dist/providers/mistral.d.ts +10 -11
  170. package/dist/providers/mistral.js +3 -14
  171. package/dist/providers/moonshot/messages.js +2 -7
  172. package/dist/providers/moonshot/responses.js +2 -7
  173. package/dist/providers/moonshot.d.ts +5 -5
  174. package/dist/providers/moonshot.js +4 -16
  175. package/dist/providers/openai-compatible-responses.d.ts +6 -7
  176. package/dist/providers/openai-compatible-responses.js +2 -8
  177. package/dist/providers/openai-compatible.d.ts +6 -7
  178. package/dist/providers/openai-compatible.js +4 -10
  179. package/dist/providers/openai.d.ts +4 -4
  180. package/dist/providers/openai.js +3 -3
  181. package/dist/providers/opencode.d.ts +4 -4
  182. package/dist/providers/opencode.js +6 -2
  183. package/dist/providers/openrouter.d.ts +8 -5
  184. package/dist/providers/openrouter.js +16 -24
  185. package/dist/providers/runway.d.ts +1 -1
  186. package/dist/providers/settings.d.ts +40 -0
  187. package/dist/providers/settings.js +19 -0
  188. package/dist/providers/togetherai.d.ts +5 -5
  189. package/dist/providers/togetherai.js +5 -15
  190. package/dist/providers/typesafe-ai.d.ts +4 -4
  191. package/dist/providers/typesafe-ai.js +6 -2
  192. package/dist/providers/venice.d.ts +4 -4
  193. package/dist/providers/venice.js +6 -2
  194. package/dist/providers/vercel-ai-gateway.d.ts +5 -5
  195. package/dist/providers/vercel-ai-gateway.js +15 -28
  196. package/dist/providers/xai.d.ts +4 -4
  197. package/dist/providers/xai.js +4 -12
  198. package/dist/providers/zai-coding-plan/messages.js +2 -7
  199. package/dist/providers/zai-coding-plan/responses.js +2 -7
  200. package/dist/providers/zai-coding-plan.d.ts +5 -5
  201. package/dist/providers/zai-coding-plan.js +8 -15
  202. package/dist/providers/zai.d.ts +5 -5
  203. package/dist/providers/zai.js +10 -22
  204. package/dist/public.d.ts +12 -0
  205. package/dist/public.js +5 -0
  206. package/dist/route/auth-options.d.ts +9 -5
  207. package/dist/route/auth-options.js +10 -7
  208. package/dist/route/client.d.ts +50 -37
  209. package/dist/route/client.js +42 -53
  210. package/dist/route/decision.d.ts +8 -8
  211. package/dist/route/decision.js +3 -3
  212. package/dist/route/executor.d.ts +5 -0
  213. package/dist/route/executor.js +10 -0
  214. package/dist/route/index.d.ts +5 -7
  215. package/dist/route/index.js +1 -1
  216. package/dist/route/media.d.ts +7 -11
  217. package/dist/route/media.js +22 -26
  218. package/dist/route/transport/http.js +6 -5
  219. package/dist/route/transport/websocket.js +7 -1
  220. package/dist/schema/errors.d.ts +16 -17
  221. package/dist/schema/errors.js +63 -12
  222. package/dist/schema/events.d.ts +2563 -2954
  223. package/dist/schema/events.js +54 -109
  224. package/dist/schema/messages.d.ts +194 -137
  225. package/dist/schema/messages.js +66 -83
  226. package/dist/schema/options.d.ts +112 -65
  227. package/dist/schema/options.js +52 -101
  228. package/dist/speech-client.d.ts +7 -7
  229. package/dist/speech.d.ts +306 -316
  230. package/dist/speech.js +16 -14
  231. package/dist/testing.d.ts +31 -175
  232. package/dist/testing.js +60 -5
  233. package/dist/tool-history.d.ts +1 -1
  234. package/dist/tool-history.js +3 -10
  235. package/dist/tool-runtime.d.ts +9 -2
  236. package/dist/tool-runtime.js +17 -31
  237. package/dist/tool.d.ts +39 -43
  238. package/dist/tool.js +16 -26
  239. package/dist/transcription-client.d.ts +7 -7
  240. package/dist/transcription.d.ts +314 -265
  241. package/dist/transcription.js +16 -14
  242. package/dist/utils/provider-codes.d.ts +3 -0
  243. package/dist/utils/provider-codes.js +41 -0
  244. package/dist/video-client.d.ts +7 -7
  245. package/dist/video-client.js +1 -1
  246. package/dist/video.d.ts +269 -287
  247. package/dist/video.js +16 -14
  248. package/package.json +9 -9
  249. package/dist/experimental/testing.d.ts +0 -3
  250. package/dist/experimental/testing.js +0 -3
  251. package/dist/testing/decision.d.ts +0 -16
  252. package/dist/testing/decision.js +0 -20
  253. package/dist/testing/image.d.ts +0 -14
  254. package/dist/testing/image.js +0 -12
  255. package/dist/testing/media.d.ts +0 -18
  256. package/dist/testing/media.js +0 -36
  257. package/dist/testing/script.d.ts +0 -28
  258. package/dist/testing/script.js +0 -60
  259. package/dist/testing/speech.d.ts +0 -14
  260. package/dist/testing/speech.js +0 -12
  261. package/dist/testing/transcription.d.ts +0 -14
  262. package/dist/testing/transcription.js +0 -12
  263. package/dist/testing/video.d.ts +0 -14
  264. package/dist/testing/video.js +0 -12
package/README.md CHANGED
@@ -37,7 +37,7 @@ const program = Effect.gen(function* () {
37
37
  model: openai.responses("gpt-4o-mini"), // `.chat(...)` selects the Chat Completions API instead
38
38
  system: "You are concise.",
39
39
  prompt: "Say hello in one short sentence.",
40
- generation: { maxTokens: 40 },
40
+ maxTokens: 40,
41
41
  })
42
42
  console.log(response.text)
43
43
  })
@@ -47,17 +47,26 @@ await Effect.runPromise(program.pipe(Effect.provide(AIClient.layer)))
47
47
  ```
48
48
 
49
49
  Run `ai.stream(...)` instead of `generate` when you want incremental `LLMEvent`s. Both accept input or a prebuilt
50
- `ai.request(...)`. The event stream is provider-neutral — same shape across OpenAI Chat, OpenAI Responses,
50
+ `ai.request(...)`. Input takes either `prompt`, a single user message, or `messages`, the whole conversation, never
51
+ both; `system` goes with either. The event stream is provider-neutral — same shape across OpenAI Chat, OpenAI Responses,
51
52
  Anthropic Messages, Gemini, Bedrock Converse, and any OpenAI-compatible deployment.
52
53
 
53
54
  ### Tool loop
54
55
 
55
56
  `stream` runs one model call; `loop` runs the model's tool calls and calls the model again until it stops calling
56
- tools. Events from every step arrive on one stream, with a `tool-result` after each tool runs. `until` is checked
57
+ tools. Events from every step arrive on one stream, with a `tool-result` after each tool runs (an error result when
58
+ it fails). Each step ends with its own `step-finish`; one `finish` ends the loop, carrying the final step's reason
59
+ and the usage summed across steps. `until` is checked
57
60
  after each step that has tool calls, with every step's `LLMResponse`; returning `true` ends the loop without running
58
- them. `tool` takes a plain `async` execute; a throw or rejection goes back to the model as an error result, and
59
- `signal` aborts when the loop is interrupted.
60
- `tool` from `@opencode/ai/effect` takes the same options (including an optional `success` schema) with an Effect execute:
61
+ them. Tools are an array, sent in the order given so the provider can reuse its cached prompt prefix. Each tool has a
62
+ `name`, and two tools with the same name fail the request. Tool arguments that are not valid JSON go back to the model
63
+ as an error result so it can retry. A step that hits the output token limit ends the loop without running its tool
64
+ calls, which may be cut off. A forced `toolChoice` applies to the first step only; later steps use `auto`. `tool` takes
65
+ a plain `async` execute; a throw or rejection goes back to the model as an error result, and `signal` aborts when the
66
+ loop is interrupted.
67
+ `input` is an Effect Schema that decodes and types the arguments, or a raw JSON Schema object, such as an MCP tool's,
68
+ whose arguments arrive as `unknown` (pair it with an optional JSON Schema `outputSchema`). `tool` from
69
+ `@opencode/ai/effect` takes the same options (including an optional `success` schema) with an Effect execute:
61
70
 
62
71
  ```ts
63
72
  import { readFile } from "node:fs/promises"
@@ -65,15 +74,16 @@ import { Schema } from "effect"
65
74
  import { ai, tool } from "@opencode/ai"
66
75
 
67
76
  const read_file = tool({
77
+ name: "read_file",
68
78
  description: "Read a UTF-8 file.",
69
- parameters: Schema.Struct({ path: Schema.String }),
79
+ input: Schema.Struct({ path: Schema.String }),
70
80
  execute: ({ path }, { signal }) => readFile(path, { encoding: "utf8", signal }),
71
81
  })
72
82
 
73
83
  const events = ai.loop({
74
84
  model,
75
85
  prompt: "Summarize package.json.",
76
- tools: { read_file },
86
+ tools: [read_file],
77
87
  until: ({ steps }) => steps.length >= 8,
78
88
  })
79
89
  for await (const event of events) {
@@ -81,6 +91,17 @@ for await (const event of events) {
81
91
  }
82
92
  ```
83
93
 
94
+ The terminal `finish` carries the final assistant `message` and `usage`. To skip the events, `ai.collect` folds a
95
+ stream from `stream` or `loop` into one result: `text` of the final step, `steps` (one `LLMResponse` per call),
96
+ `messages` (each step's assistant message and its tool results, ready to append to the next request), the total
97
+ `usage`, `finishReason`, and `object` with `schema`.
98
+
99
+ ```ts
100
+ const result = await ai.collect(ai.loop({ model, prompt: "Summarize package.json.", tools: { read_file } }))
101
+ // Effect: const result = yield* ai.collect(ai.loop({ ... }))
102
+ console.log(result.text, result.usage?.totalTokens)
103
+ ```
104
+
84
105
  ### Freeform tools
85
106
 
86
107
  A tool with exactly one required string parameter can set `freeform`, so the model writes that parameter as raw text
@@ -88,8 +109,9 @@ instead of JSON arguments: unconstrained `text`, or text matching a `regex` or `
88
109
 
89
110
  ```ts
90
111
  const run_code = tool({
112
+ name: "run_code",
91
113
  description: "Run JavaScript",
92
- parameters: Schema.Struct({ code: Schema.String }),
114
+ input: Schema.Struct({ code: Schema.String }),
93
115
  freeform: { type: "lark", grammar: JS_GRAMMAR },
94
116
  execute: ({ code }) => runCode(code),
95
117
  })
@@ -104,35 +126,57 @@ history works with or without `freeform`.
104
126
 
105
127
  ### Structured output
106
128
 
107
- `generateObject` forces a tool call and decodes its input against `schema`; pass `jsonSchema` instead for an
108
- unvalidated `unknown` object:
129
+ Pass `schema` to `generate`, `stream` or `loop`. The model must answer through a hidden tool call, decoded into
130
+ `object` (typed from an Effect Schema, or an unvalidated `unknown` for a raw JSON Schema object):
109
131
 
110
132
  ```ts
111
- const { object } = await ai.generateObject({
112
- model,
113
- prompt: "Pick a city.",
114
- schema: Schema.Struct({ city: Schema.String }),
115
- })
133
+ const res = await ai.generate({ model, prompt: "Pick a city.", schema: Schema.Struct({ city: Schema.String }) })
134
+ res.object.city
135
+ ```
136
+
137
+ `stream` puts `object` on its `finish` event; `loop` runs tools first and puts it on the loop's `finish`. A
138
+ decode failure is an `AIError` whose `partial` holds the response.
139
+
140
+ ### Errors
141
+
142
+ Every failure is an `AIError`. `reason._tag` names the kind (`RateLimit`, `InvalidRequest`, `Transport`, ...), and
143
+ getters read the common fields without digging into `reason` or the raw body:
144
+
145
+ ```ts
146
+ try {
147
+ await ai.generate({ model, prompt: "Hi" })
148
+ } catch (error) {
149
+ if (!(error instanceof AIError)) throw error
150
+ error.status // HTTP status, when the failure came from a response
151
+ error.code // provider error code such as "model_not_found", when known
152
+ error.isRetryable // whether sending the same request again may succeed
153
+ error.retryAfterMs // delay the provider asked for, when known
154
+ }
116
155
  ```
117
156
 
118
157
  ### Raw provider events
119
158
 
120
159
  Set `includeRaw: true` on a request to also receive every provider frame as `{ type: "raw", data }`, in order and
121
160
  before the events parsed from that frame. `data` is the parsed JSON frame, so frames this package doesn't handle yet
122
- are visible too. Raw events are off by default, and `generate` ignores them. Translate a frame with a stream map:
161
+ are visible too. Raw events are off by default, and `generate` ignores them. `RawEvent` is the event's type. Act on a
162
+ frame with a stream map:
123
163
 
124
164
  ```ts
125
- import { Stream } from "effect"
126
- import { ai, LLMEvent } from "@opencode/ai/effect"
165
+ import { Effect, Stream } from "effect"
166
+ import { ai, AIError, ContentPolicyError } from "@opencode/ai/effect"
127
167
 
128
168
  const flagged = (data: unknown) =>
129
169
  typeof data === "object" && data !== null && "type" in data && data.type === "moderation.flagged"
130
170
 
131
- const events = ai.stream({ model, prompt: "Say hello.", includeRaw: true }).pipe(
132
- Stream.map((event) =>
133
- event.type === "raw" && flagged(event.data) ? LLMEvent.providerError({ message: "Flagged by moderation" }) : event,
134
- ),
135
- )
171
+ const events = ai
172
+ .stream({ model, prompt: "Say hello.", includeRaw: true })
173
+ .pipe(
174
+ Stream.mapEffect((event) =>
175
+ event.type === "raw" && flagged(event.data)
176
+ ? Effect.fail(new AIError({ reason: new ContentPolicyError({ message: "Flagged by moderation" }) }))
177
+ : Effect.succeed(event),
178
+ ),
179
+ )
136
180
  ```
137
181
 
138
182
  ### Google Interactions
@@ -147,11 +191,13 @@ live under `providerMetadata.vertex`. The default is still full-history replay w
147
191
 
148
192
  ```ts
149
193
  const model = Google.configure({ apiKey }).interactions("gemini-3.8-flash")
150
- const response = yield* ai.generate({
151
- model,
152
- prompt: "Say hello.",
153
- providerOptions: { thinkingLevel: "low", thinkingSummaries: "auto", store: true },
154
- })
194
+ const response =
195
+ yield *
196
+ ai.generate({
197
+ model,
198
+ prompt: "Say hello.",
199
+ providerOptions: { thinkingLevel: "low", thinkingSummaries: "auto", store: true },
200
+ })
155
201
  ```
156
202
 
157
203
  Interactions supports text output, streamed function calls, native tool results, thought signatures, and multimodal
@@ -363,7 +409,7 @@ shared host; the entry above follows the base URL table. Dedicated hosts can be
363
409
  Replay complete `response.message` values to retain `reasoning_content` separately from answer text.
364
410
  Qwen 3.8 defaults to preserving thinking; older models have different defaults.
365
411
  Additional options include `toolStream`, `parallelToolCalls`, `repetitionPenalty`, `responseFormat`,
366
- `enableSearch`, and native `searchOptions`. `generation.topK` lowers to `top_k`.
412
+ `enableSearch`, and native `searchOptions`. `topK` lowers to `top_k`.
367
413
  `clearThinking` is a hosted GLM control, and `thinking.type` is available for hosted MiniMax models.
368
414
  - **Messages:** `effort` → `output_config.effort`. `thinking.type` accepts enabled/disabled with an
369
415
  optional `budgetTokens` (or native `budget_tokens`). `outputConfig.format` accepts a JSON schema.
@@ -532,7 +578,7 @@ const request = ai.request({
532
578
  model: minimax.model("MiniMax-M3"), // also minimax.messages("MiniMax-M3")
533
579
  prompt: "What is 173 multiplied by 219?",
534
580
  providerOptions: { thinking: { type: "adaptive" } },
535
- generation: { maxTokens: 1536 },
581
+ maxTokens: 1536,
536
582
  })
537
583
 
538
584
  const response = await Effect.runPromise(ai.generate(request).pipe(Effect.provide(AIClient.layer)))
@@ -570,7 +616,7 @@ const request = ai.request({
570
616
  model: meta.responses("muse-spark-1.3"), // meta.model(...) also selects Responses
571
617
  prompt: "What is 173 multiplied by 219? Reply with the integer.",
572
618
  providerOptions: { reasoningEffort: "low" },
573
- generation: { maxTokens: 1024 },
619
+ maxTokens: 1024,
574
620
  })
575
621
  ```
576
622
 
@@ -592,7 +638,7 @@ Responses and Chat support only `toolChoice: "auto"` (the default). Messages als
592
638
  its documented forced `"any"` choice currently returns HTTP 400. Messages defaults to adaptive thinking
593
639
  with `display: "omitted"`, preserving encrypted `redacted_thinking` in `response.message`. Use
594
640
  `providerOptions: { effort: "low" }` for depth or `thinking: { type: "enabled", budgetTokens: 1024 }`
595
- for budget compatibility (with `generation.maxTokens > 1024`).
641
+ for budget compatibility (with `maxTokens > 1024`).
596
642
 
597
643
  Add `tools: [Meta.webSearch()]` to a Spark Responses or Messages request for hosted web search.
598
644
  Responses exposes hosted results and URL citations in text-part `providerMetadata.meta.annotations`.
@@ -666,18 +712,18 @@ Common fields are portable in shape, not in support. Some routes approximate `as
666
712
  size they offer; others fail with a typed `AIError` before any network call rather than dropping them, so check this
667
713
  table before swapping only the `model`:
668
714
 
669
- | Provider | `n` | `aspect` | `resolution` | `images` | Moved to `providerOptions` |
670
- | --------------------- | --- | -------------------- | --------------------- | -------------------------------- | -------------------------------------------------- |
671
- | OpenAI | ✓¹ | nearest size | nearest size | ✓ | `size`, `outputFormat`, `mask` |
672
- | Google (Gemini) | 1 | ✓ | ✓ (`0.5K` as `512`) | ✓ (no public URLs) | `seed` |
673
- | xAI | ✓ | ✓ | `1k`/`2k` | ✓ | none |
674
- | Meta | ✓ | ✓ (hint) | ignored | ✓ | `size`, `outputFormat` |
675
- | Z.ai | ✗ | width × height | width × height | ✗ | `size` |
676
- | Alibaba | ✓ | width × height | width × height | ✓ | `size`, `seed` |
677
- | MiniMax | ✓ | preset or w × h⁴ | preset or w × h⁴ | 1 (portrait subject) | `aspect_ratio`, `width`, `height`, `seed` |
678
- | Vercel AI Gateway | ✓ | as OpenAI³ | as OpenAI³ | per model | as OpenAI |
679
- | OpenRouter | ✓ | ✓ (`aspect_ratio`) | tier⁵ | per model⁵ | `size`, `outputFormat` (no `mask`) |
680
- | Cloudflare Workers AI | 1 | width × height² | width × height² | ✗ | `width`, `height`, `seed` |
715
+ | Provider | `n` | `aspect` | `resolution` | `images` | Moved to `providerOptions` |
716
+ | --------------------- | --- | ------------------ | ------------------- | -------------------- | ----------------------------------------- |
717
+ | OpenAI | ✓¹ | nearest size | nearest size | ✓ | `size`, `outputFormat`, `mask` |
718
+ | Google (Gemini) | 1 | ✓ | ✓ (`0.5K` as `512`) | ✓ (no public URLs) | `seed` |
719
+ | xAI | ✓ | ✓ | `1k`/`2k` | ✓ | none |
720
+ | Meta | ✓ | ✓ (hint) | ignored | ✓ | `size`, `outputFormat` |
721
+ | Z.ai | ✗ | width × height | width × height | ✗ | `size` |
722
+ | Alibaba | ✓ | width × height | width × height | ✓ | `size`, `seed` |
723
+ | MiniMax | ✓ | preset or w × h⁴ | preset or w × h⁴ | 1 (portrait subject) | `aspect_ratio`, `width`, `height`, `seed` |
724
+ | Vercel AI Gateway | ✓ | as OpenAI³ | as OpenAI³ | per model | as OpenAI |
725
+ | OpenRouter | ✓ | ✓ (`aspect_ratio`) | tier⁵ | per model⁵ | `size`, `outputFormat` (no `mask`) |
726
+ | Cloudflare Workers AI | 1 | width × height² | width × height² | ✗ | `width`, `height`, `seed` |
681
727
 
682
728
  ✓ lowers natively; ✗ fails whenever the field is set (including `n: 1`); `1` means `n > 1` fails. "width × height"
683
729
  computes a size the provider accepts and fails when the request falls outside its limits. ¹ `ai.image.stream` on OpenAI
@@ -698,6 +744,20 @@ edits endpoint, so input images go to `/images/generations` as `input_references
698
744
  asset into owned bytes before the provider URL expires. Construct assets with `Media.bytes`, `Media.base64`,
699
745
  `Media.url`, `Media.ref(provider, id)`, `Media.fromDataUrl`, or `Media.file(path)`.
700
746
 
747
+ File inputs (message `media` parts, image `images`, decision `media` parts) also take plain data: a `Uint8Array`,
748
+ `ArrayBuffer`, `URL`, or a string holding a data URL, an http(s) URL or base64. Bytes and base64 are sniffed from
749
+ magic bytes; pass `mediaType` when that fails:
750
+
751
+ ```ts
752
+ ai.request({
753
+ model,
754
+ prompt: [
755
+ { type: "text", text: "Summarize this report" },
756
+ { type: "media", media: pdfBase64, mediaType: "application/pdf" },
757
+ ],
758
+ })
759
+ ```
760
+
701
761
  Pass ordered image inputs to the same method for editing, composition, or image-conditioned generation:
702
762
 
703
763
  ```ts
@@ -719,8 +779,8 @@ const composed = Effect.gen(function* () {
719
779
 
720
780
  `Media.ref(provider, id)` represents provider file handles such as OpenAI file IDs or Gemini Files URIs; routes
721
781
  only forward refs that belong to their own provider (OpenAI, xAI, and Gemini images accept them). No shipped route
722
- returns a ref yet, and `asset.bytes()` / `materialize()` on a ref fail by design. Raw strings are not accepted as
723
- image inputs, avoiding ambiguity between base64, URLs, and provider IDs. Empty or omitted `images` uses text-to-image generation; a
782
+ returns a ref yet, and `asset.bytes()` / `materialize()` on a ref fail by design. Empty or omitted `images` uses
783
+ text-to-image generation; a
724
784
  non-empty array selects the provider's edit behavior (see the table above for routes that limit the count). OpenAI
725
785
  uses multipart for byte/data-URL edits and its JSON reference body for URL or file-ID edits. Inpainting is a
726
786
  provider option on the routes that support it (OpenAI):
@@ -848,11 +908,13 @@ and emits `image-partial` events before each final `image`; `ai.image.generate`
848
908
  import { Stream } from "effect"
849
909
  import { ImageEvent } from "@opencode/ai/effect"
850
910
 
851
- const previews = ai.image.stream({
852
- model: openai.image("gpt-image-2"),
853
- prompt: "A lighthouse at dusk",
854
- providerOptions: { partialImages: 2 },
855
- }).pipe(Stream.runForEach((event) => (ImageEvent.is.imagePartial(event) ? showPreview(event.image) : Effect.void)))
911
+ const previews = ai.image
912
+ .stream({
913
+ model: openai.image("gpt-image-2"),
914
+ prompt: "A lighthouse at dusk",
915
+ providerOptions: { partialImages: 2 },
916
+ })
917
+ .pipe(Stream.runForEach((event) => (ImageEvent.is.imagePartial(event) ? showPreview(event.image) : Effect.void)))
856
918
  ```
857
919
 
858
920
  The provider may send fewer previews than requested when the final image is ready first.
@@ -882,9 +944,10 @@ The hosted result is represented as a provider-executed tool call and a tool res
882
944
 
883
945
  Everything below is exported from `@opencode/ai/effect` unless noted.
884
946
 
885
- - **`ai.request({...})`** — build a provider-neutral `LLMRequest`. Accepts ergonomic inputs (`system: string`, `prompt: string`) that normalize into the canonical Schema classes.
947
+ - **`ai.request({...})`** — build a provider-neutral `LLMRequest`, a plain object. Accepts ergonomic inputs (`system: string`, `prompt: string`) and normalizes them into `system`, `messages` and `tools` arrays. Edit it with a spread, or pass the edited object back to `ai.request`.
886
948
  - **`ai.generate` / `ai.stream`** — run direct input or an `LLMRequest` through `LLMClient` for one-import use.
887
949
  - **`ai.loop`** — stream model calls, running `tool(...)` tools between them until the model stops calling tools.
950
+ - **`ai.collect`** — fold a stream from `ai.stream` or `ai.loop` into its final result (`text`, `steps`, `messages`, `usage`).
888
951
  - **`Message.user(...)` / `Message.assistant(...)` / `Message.tool(...)`** — message constructors from the canonical schema model.
889
952
  - **`LanguageModel.make(...)` / `ToolCallPart.make(...)` / `ToolResultPart.make(...)` / `ToolDefinition.make(...)`** — model and tool-related constructors from the canonical schema model.
890
953
  - **`LLMEvent.is.*`** — typed guards (`is.textDelta`, `is.toolCall`, `is.finish`, …) for filtering streams.
@@ -894,17 +957,17 @@ Everything below is exported from `@opencode/ai/effect` unless noted.
894
957
  - **`Generation`** — provider-neutral handle for an in-flight media generation (`await`, `refresh`, `cancel`, `events`) used by queued media routes.
895
958
  - **`ai.decision.request` / `ai.decision.generate`** — typed predicate, choice, and score questions over text, JSON, and media input; `DecisionClient` is its Effect service and layer.
896
959
  - **`AIClient.layer` / `AIClient.layerWith(executor)`** — every modality client plus the request executor in one layer.
897
- - **`@opencode/ai`** (Promise root) — a default `ai` with the text calls (`request`, `generate`, `stream`, `loop`, `generateObject`, `compact`, `canCompact`) at the top level plus `image` and `decision` (plus `experimental.video`, `experimental.speech`, and `experimental.transcription`) as Promise / `AsyncIterable` APIs, `run(effect)` for any package Effect, plus `file`, `write`, `bytes`, `base64`, and `materialize` for assets. `AI.make({ layer?, clients? })` builds a client over a custom executor or test layers. The same `ai` from `@opencode/ai/effect` returns `Effect` and `Stream`.
960
+ - **`@opencode/ai`** (Promise root) — a default `ai` with the text calls (`request`, `generate`, `stream`, `loop`, `compact`, `canCompact`) at the top level plus `image` and `decision` (plus `experimental.video`, `experimental.speech`, and `experimental.transcription`) as Promise / `AsyncIterable` APIs, `run(effect)` for any package Effect, plus `file`, `write`, `bytes`, `base64`, and `materialize` for assets. `AI.make({ layer? })` builds a client over a custom executor. The same `ai` from `@opencode/ai/effect` returns `Effect` and `Stream`.
898
961
  - **`@opencode/ai/experimental`** — APIs that may change without compatibility guarantees: `Video`, `Speech`, `Transcription`, `Extraction`, and `Realtime`. See [Experimental](#experimental).
899
962
 
900
963
  ## Experimental
901
964
 
902
965
  These APIs may change without compatibility guarantees. The Effect API is exported from `@opencode/ai/experimental`,
903
- the Promise client exposes it under `ai.experimental`, and test layers come from `@opencode/ai/experimental/testing`.
966
+ and the Promise client exposes it under `ai.experimental`.
904
967
 
905
968
  - **`Video`**, **`Speech`**, and **`Transcription`** — media generation and speech-to-text, with `VideoClient`,
906
969
  `SpeechClient`, and `TranscriptionClient` as their Effect services. Promise: `ai.experimental.video`, `.speech`, and
907
- `.transcription`. Testing: `TestVideo`, `TestSpeech`, and `TestTranscription`.
970
+ `.transcription`.
908
971
  - **`Extraction`** — typed values read out of text.
909
972
  - **`Realtime`** — `Realtime.connect` starts an OpenAI, xAI, or Gemini voice session and returns a WebRTC answer SDP or
910
973
  a short-lived WebSocket URL and token.
@@ -1233,13 +1296,16 @@ For explicit compaction, script a `CompactionResponse` through `push`, `always`,
1233
1296
 
1234
1297
  For `compact(request, { mechanism: "trigger" })`, script a `CompactionCheckpointResponse` instead. It carries `checkpoint`, `responseID`, and optional `usage`. Endpoint and trigger calls reject each other's fixtures; both share the same queue, gates, lazy recording, and fallback controls.
1235
1298
 
1236
- `TestImage` and `TestDecision` (and `TestVideo`, `TestSpeech`, and `TestTranscription` from `@opencode/ai/experimental/testing`) follow the same pattern: `testLayer()` provides the modality's client and `Test`, with the same `push`, `always`, `serve`, `requests`, `wait`, and `gate` controls. Script an `ImageResponse` (or the modality's response) or an `AIError`. `stream` expands the response into its events, and `start` returns an already finished generation that `resume` accepts by token. Decision responses are returned as scripted, without checking the answers against the questions.
1299
+ Response helpers build common event arrays: `TestLLM.text(value, id)`, `textWithUsage(value, id, inputTokens)`,
1300
+ `toolCall(id, name, input)`, `stop(...events)`, `toolCalls(...events)`, and
1301
+ `complete({ reason, usage?, providerMetadata? }, ...events)`. `failAfter(error, ...events)` and `hangAfter(...events)`
1302
+ return streams that fail or never finish after the given events.
1237
1303
 
1238
- The Promise client accepts the same layers as `AI.make({ clients: TestImage.testLayer() })`; `ai.run(TestImage.Test.use(...))` reaches the controls.
1304
+ `compileRequest`, also from `@opencode/ai/testing`, compiles an `LLMRequest` through its route without sending it, so
1305
+ tests can assert the provider payload.
1239
1306
 
1240
- The published legacy `Service`, `layer`, `clientLayer`, and module-level controls remain available as adapters
1241
- over the same implementation, including the legacy live `requests` array. New tests should use `Test` and
1242
- `testLayer`.
1307
+ Other modalities and the Promise client have no test double. Test them over a custom executor layer, such as
1308
+ `AI.make({ layer })`, that answers the HTTP requests.
1243
1309
 
1244
1310
  ## Provider compaction
1245
1311
 
@@ -1256,9 +1322,7 @@ Prefer this operation, where supported, when the application owns compaction pol
1256
1322
  ```ts
1257
1323
  const compacted = Effect.gen(function* () {
1258
1324
  const result = yield* ai.compact(request)
1259
- const next = LLMRequest.update(request, {
1260
- messages: result.replacement,
1261
- })
1325
+ const next = { ...request, messages: result.replacement }
1262
1326
  return yield* ai.generate(next)
1263
1327
  })
1264
1328
  ```
@@ -1318,7 +1382,7 @@ Enable OpenAI compaction with typed provider options:
1318
1382
 
1319
1383
  ```ts
1320
1384
  import { Effect } from "effect"
1321
- import { ai, LLMClient, LLMRequest, Message } from "@opencode/ai/effect"
1385
+ import { ai, LLMClient, Message } from "@opencode/ai/effect"
1322
1386
  import { OpenAI } from "@opencode/ai/providers"
1323
1387
 
1324
1388
  const request = ai.request({
@@ -1330,9 +1394,7 @@ const request = ai.request({
1330
1394
  })
1331
1395
  const continued = Effect.gen(function* () {
1332
1396
  const response = yield* LLMClient.generate(request)
1333
- return LLMRequest.update(request, {
1334
- messages: [...request.messages, response.message, Message.user("Continue")],
1335
- })
1397
+ return { ...request, messages: [...request.messages, response.message, Message.user("Continue")] }
1336
1398
  })
1337
1399
  ```
1338
1400
 
@@ -1476,6 +1538,8 @@ const gateway = CloudflareAIGateway.configure({
1476
1538
  }).model("workers-ai/@cf/meta/llama-3.1-8b-instruct")
1477
1539
  ```
1478
1540
 
1541
+ For a provider that needs no key, such as a local server, pass `apiKey: false`: the package skips the environment lookup and sends no auth header (Amazon Bedrock and Google Vertex keep their own auth).
1542
+
1479
1543
  Included LLM providers: OpenAI, Anthropic, Google (Gemini), Google Vertex, Amazon Bedrock (Converse and Mantle), Azure OpenAI, Alibaba, Baseten, Cerebras, Cohere, Cloudflare AI Gateway, Cloudflare Workers AI, DeepInfra, DeepSeek, DigitalOcean, Fireworks, Groq, Meta, MiniMax, Mistral, Moonshot, OpenRouter, TogetherAI, Venice, Vercel AI Gateway, xAI, Z.ai, and Z.ai Coding Plan. TypeSafe AI and OpenCode expose decision models only. Generic Chat Completions, Responses, and Anthropic Messages-compatible entrypoints support custom endpoints.
1480
1544
 
1481
1545
  Each named provider owns its module, endpoint, authentication, and route setup. Providers with the same wire format compose the shared protocol directly:
@@ -1556,7 +1620,7 @@ Additional provider entrypoints include:
1556
1620
 
1557
1621
  Request options in order of stability:
1558
1622
 
1559
- 1. **`generation`** — portable knobs (`maxTokens`, `temperature`, `topP`, `topK`, penalties, seed, stop).
1623
+ 1. **Portable knobs** — `maxTokens`, `temperature`, `topP`, `topK`, `frequencyPenalty`, `presencePenalty`, `seed` and `stop`, at the top level of a text request. `GENERATION_KEYS` lists them.
1560
1624
  2. **`promptCacheKey`** — stable cache affinity lowered by every protocol that supports it.
1561
1625
  3. **`providerOptions: { ... }`** — flat options inferred from the selected model (OpenAI `store`, Anthropic `thinking`, Gemini `thinkingConfig`, OpenRouter routing).
1562
1626
  4. **`http: { body, headers, query }`** — last-resort serializable overlays merged into the final HTTP request. Reach for this only when a stable typed path doesn't yet exist.
@@ -1,4 +1,4 @@
1
- import { LLMRequest } from "./schema/messages.js";
1
+ import { type LLMRequest } from "./schema/messages.js";
2
2
  /** The requested cache lifetime, for routes that send it as a request-level option instead of on markers. */
3
3
  export declare const requestTTL: (request: LLMRequest) => `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
4
4
  export declare const applyCachePolicy: (request: LLMRequest) => LLMRequest;
@@ -11,7 +11,7 @@
11
11
  // Manual `cache: CacheHint` placements on individual parts are preserved and
12
12
  // count against the four-breakpoint budget; auto only fills remaining slots.
13
13
  import { CacheHint } from "./schema/options.js";
14
- import { LLMRequest, Message, ToolDefinition } from "./schema/messages.js";
14
+ import { AssistantMessage, SystemMessage, ToolDefinition, ToolMessage, UserMessage, } from "./schema/messages.js";
15
15
  import { effortUpdate } from "./effort-updates.js";
16
16
  const AUTO = {
17
17
  tools: true,
@@ -119,8 +119,7 @@ const markMessageAt = (messages, index, hint, budget) => {
119
119
  if (!existing || !isCacheablePart(existing) || existing.cache || budget.remaining === 0)
120
120
  return messages;
121
121
  budget.remaining -= 1;
122
- const nextContent = target.content.map((part, i) => (i === markAt ? { ...existing, cache: hint } : part));
123
- const next = new Message({ ...target, content: nextContent });
122
+ const next = cachePartAt(target, markAt, hint);
124
123
  // Single pass over `messages`, substituting the one updated entry. Long
125
124
  // conversations call this on every request, so avoid `.map()` here — its
126
125
  // closure dispatch and identity copies show up in profiling.
@@ -128,6 +127,19 @@ const markMessageAt = (messages, index, hint, budget) => {
128
127
  result[index] = next;
129
128
  return result;
130
129
  };
130
+ const cachePartAt = (message, index, hint) => {
131
+ switch (message.role) {
132
+ case "system":
133
+ return new SystemMessage({ ...message, content: cacheContentAt(message.content, index, hint) });
134
+ case "user":
135
+ return new UserMessage({ ...message, content: cacheContentAt(message.content, index, hint) });
136
+ case "assistant":
137
+ return new AssistantMessage({ ...message, content: cacheContentAt(message.content, index, hint) });
138
+ case "tool":
139
+ return new ToolMessage({ ...message, content: cacheContentAt(message.content, index, hint) });
140
+ }
141
+ };
142
+ const cacheContentAt = (content, index, hint) => content.map((part, i) => (i === index ? { ...part, cache: hint } : part));
131
143
  const markMessages = (messages, strategy, hint, budget) => {
132
144
  if (messages.length === 0)
133
145
  return messages;
@@ -163,7 +175,7 @@ export const applyCachePolicy = (request) => {
163
175
  const messages = policy.messages ? markMessages(request.messages, policy.messages, hint, budget) : request.messages;
164
176
  if (tools === request.tools && system === request.system && messages === request.messages)
165
177
  return request;
166
- return LLMRequest.update(request, { tools, system, messages });
178
+ return { ...request, tools, system, messages };
167
179
  };
168
180
  /** Whether the cache policy places inline markers, which then carry the requested lifetime. */
169
181
  export const placesMarkers = (request) => {
@@ -1,15 +1,15 @@
1
1
  import { Context, Effect, Layer } from "effect";
2
- import type { DecisionOptions, DecisionQuestions, DecisionRequestFor, DecisionResponseFor } from "./decision.js";
2
+ import type { DecisionModel, DecisionOptions, DecisionQuestions, DecisionRequest, DecisionResponseFor } from "./decision.js";
3
3
  import { RequestExecutor } from "./route/executor.js";
4
4
  import { AIError } from "./schema/index.js";
5
5
  export type Execute = RequestExecutor.Interface["execute"];
6
6
  export interface Interface {
7
- readonly generate: <Options extends DecisionOptions, const Questions extends DecisionQuestions>(request: DecisionRequestFor<Options, Questions>) => Effect.Effect<DecisionResponseFor<Questions>, AIError>;
7
+ readonly generate: <Options extends DecisionOptions, const Questions extends DecisionQuestions>(request: DecisionRequest<DecisionModel<Options>, Questions>) => Effect.Effect<DecisionResponseFor<Questions>, AIError>;
8
8
  }
9
9
  declare const Service_base: Context.ServiceClass<Service, "@opencode/AI/DecisionClient", Interface>;
10
10
  export declare class Service extends Service_base {
11
11
  }
12
- export declare const generate: <Options extends DecisionOptions, const Questions extends DecisionQuestions>(request: DecisionRequestFor<Options, Questions>) => Effect.Effect<DecisionResponseFor<Questions>, AIError, Service>;
12
+ export declare const generate: <Options extends DecisionOptions, const Questions extends DecisionQuestions>(request: DecisionRequest<DecisionModel<Options>, Questions>) => Effect.Effect<DecisionResponseFor<Questions>, AIError, Service>;
13
13
  export declare const layer: Layer.Layer<Service, never, RequestExecutor.Service>;
14
14
  export declare const fetchLayer: Layer.Layer<RequestExecutor.RequestExecutorService | Service, never, never>;
15
15
  export declare const DecisionClient: {