call-ai 0.0.0-dev-prompts

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 (55) hide show
  1. package/LICENSE.md +232 -0
  2. package/README.md +264 -0
  3. package/api-core.d.ts +13 -0
  4. package/api-core.js +238 -0
  5. package/api-core.js.map +1 -0
  6. package/api.d.ts +4 -0
  7. package/api.js +365 -0
  8. package/api.js.map +1 -0
  9. package/api.ts.off +595 -0
  10. package/env.d.ts +22 -0
  11. package/env.js +65 -0
  12. package/env.js.map +1 -0
  13. package/error-handling.d.ts +14 -0
  14. package/error-handling.js +144 -0
  15. package/error-handling.js.map +1 -0
  16. package/image.d.ts +2 -0
  17. package/image.js +72 -0
  18. package/image.js.map +1 -0
  19. package/index.d.ts +7 -0
  20. package/index.js +8 -0
  21. package/index.js.map +1 -0
  22. package/index.ts.bak +16 -0
  23. package/key-management.d.ts +29 -0
  24. package/key-management.js +190 -0
  25. package/key-management.js.map +1 -0
  26. package/non-streaming.d.ts +7 -0
  27. package/non-streaming.js +206 -0
  28. package/non-streaming.js.map +1 -0
  29. package/package.json +43 -0
  30. package/response-metadata.d.ts +6 -0
  31. package/response-metadata.js +22 -0
  32. package/response-metadata.js.map +1 -0
  33. package/strategies/index.d.ts +2 -0
  34. package/strategies/index.js +3 -0
  35. package/strategies/index.js.map +1 -0
  36. package/strategies/model-strategies.d.ts +6 -0
  37. package/strategies/model-strategies.js +138 -0
  38. package/strategies/model-strategies.js.map +1 -0
  39. package/strategies/strategy-selector.d.ts +2 -0
  40. package/strategies/strategy-selector.js +66 -0
  41. package/strategies/strategy-selector.js.map +1 -0
  42. package/streaming.d.ts +4 -0
  43. package/streaming.js +365 -0
  44. package/streaming.js.map +1 -0
  45. package/streaming.ts.off +571 -0
  46. package/tsconfig.json +18 -0
  47. package/types.d.ts +228 -0
  48. package/types.js +33 -0
  49. package/types.js.map +1 -0
  50. package/utils.d.ts +8 -0
  51. package/utils.js +42 -0
  52. package/utils.js.map +1 -0
  53. package/version.d.ts +1 -0
  54. package/version.js +2 -0
  55. package/version.js.map +1 -0
package/LICENSE.md ADDED
@@ -0,0 +1,232 @@
1
+ The contents of this repository are Copyright (c) corresponding authors and
2
+ contributors, licensed under the `Permissive License Stack` meaning either of:
3
+
4
+ - Apache-2.0 Software License: https://www.apache.org/licenses/LICENSE-2.0
5
+ ([...4tr2kfsq](https://dweb.link/ipfs/bafkreiankqxazcae4onkp436wag2lj3ccso4nawxqkkfckd6cg4tr2kfsq))
6
+
7
+ - MIT Software License: https://opensource.org/licenses/MIT
8
+ ([...vljevcba](https://dweb.link/ipfs/bafkreiepofszg4gfe2gzuhojmksgemsub2h4uy2gewdnr35kswvljevcba))
9
+
10
+ You may not use the contents of this repository except in compliance
11
+ with one of the listed Licenses. For an extended clarification of the
12
+ intent behind the choice of Licensing please refer to
13
+ https://protocol.ai/blog/announcing-the-permissive-license-stack/
14
+
15
+ Unless required by applicable law or agreed to in writing, software
16
+ distributed under the terms listed in this notice is distributed on
17
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
18
+ either express or implied. See each License for the specific language
19
+ governing permissions and limitations under that License.
20
+
21
+ <!--- SPDX-License-Identifier: Apache-2.0 OR MIT -->
22
+
23
+ `SPDX-License-Identifier: Apache-2.0 OR MIT`
24
+
25
+ Verbatim copies of both licenses are included below:
26
+
27
+ <details><summary>Apache-2.0 Software License</summary>
28
+
29
+ ```
30
+ Apache License
31
+ Version 2.0, January 2004
32
+ http://www.apache.org/licenses/
33
+
34
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
35
+
36
+ 1. Definitions.
37
+
38
+ "License" shall mean the terms and conditions for use, reproduction,
39
+ and distribution as defined by Sections 1 through 9 of this document.
40
+
41
+ "Licensor" shall mean the copyright owner or entity authorized by
42
+ the copyright owner that is granting the License.
43
+
44
+ "Legal Entity" shall mean the union of the acting entity and all
45
+ other entities that control, are controlled by, or are under common
46
+ control with that entity. For the purposes of this definition,
47
+ "control" means (i) the power, direct or indirect, to cause the
48
+ direction or management of such entity, whether by contract or
49
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
50
+ outstanding shares, or (iii) beneficial ownership of such entity.
51
+
52
+ "You" (or "Your") shall mean an individual or Legal Entity
53
+ exercising permissions granted by this License.
54
+
55
+ "Source" form shall mean the preferred form for making modifications,
56
+ including but not limited to software source code, documentation
57
+ source, and configuration files.
58
+
59
+ "Object" form shall mean any form resulting from mechanical
60
+ transformation or translation of a Source form, including but
61
+ not limited to compiled object code, generated documentation,
62
+ and conversions to other media types.
63
+
64
+ "Work" shall mean the work of authorship, whether in Source or
65
+ Object form, made available under the License, as indicated by a
66
+ copyright notice that is included in or attached to the work
67
+ (an example is provided in the Appendix below).
68
+
69
+ "Derivative Works" shall mean any work, whether in Source or Object
70
+ form, that is based on (or derived from) the Work and for which the
71
+ editorial revisions, annotations, elaborations, or other modifications
72
+ represent, as a whole, an original work of authorship. For the purposes
73
+ of this License, Derivative Works shall not include works that remain
74
+ separable from, or merely link (or bind by name) to the interfaces of,
75
+ the Work and Derivative Works thereof.
76
+
77
+ "Contribution" shall mean any work of authorship, including
78
+ the original version of the Work and any modifications or additions
79
+ to that Work or Derivative Works thereof, that is intentionally
80
+ submitted to Licensor for inclusion in the Work by the copyright owner
81
+ or by an individual or Legal Entity authorized to submit on behalf of
82
+ the copyright owner. For the purposes of this definition, "submitted"
83
+ means any form of electronic, verbal, or written communication sent
84
+ to the Licensor or its representatives, including but not limited to
85
+ communication on electronic mailing lists, source code control systems,
86
+ and issue tracking systems that are managed by, or on behalf of, the
87
+ Licensor for the purpose of discussing and improving the Work, but
88
+ excluding communication that is conspicuously marked or otherwise
89
+ designated in writing by the copyright owner as "Not a Contribution."
90
+
91
+ "Contributor" shall mean Licensor and any individual or Legal Entity
92
+ on behalf of whom a Contribution has been received by Licensor and
93
+ subsequently incorporated within the Work.
94
+
95
+ 2. Grant of Copyright License. Subject to the terms and conditions of
96
+ this License, each Contributor hereby grants to You a perpetual,
97
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
98
+ copyright license to reproduce, prepare Derivative Works of,
99
+ publicly display, publicly perform, sublicense, and distribute the
100
+ Work and such Derivative Works in Source or Object form.
101
+
102
+ 3. Grant of Patent License. Subject to the terms and conditions of
103
+ this License, each Contributor hereby grants to You a perpetual,
104
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
105
+ (except as stated in this section) patent license to make, have made,
106
+ use, offer to sell, sell, import, and otherwise transfer the Work,
107
+ where such license applies only to those patent claims licensable
108
+ by such Contributor that are necessarily infringed by their
109
+ Contribution(s) alone or by combination of their Contribution(s)
110
+ with the Work to which such Contribution(s) was submitted. If You
111
+ institute patent litigation against any entity (including a
112
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
113
+ or a Contribution incorporated within the Work constitutes direct
114
+ or contributory patent infringement, then any patent licenses
115
+ granted to You under this License for that Work shall terminate
116
+ as of the date such litigation is filed.
117
+
118
+ 4. Redistribution. You may reproduce and distribute copies of the
119
+ Work or Derivative Works thereof in any medium, with or without
120
+ modifications, and in Source or Object form, provided that You
121
+ meet the following conditions:
122
+
123
+ (a) You must give any other recipients of the Work or
124
+ Derivative Works a copy of this License; and
125
+
126
+ (b) You must cause any modified files to carry prominent notices
127
+ stating that You changed the files; and
128
+
129
+ (c) You must retain, in the Source form of any Derivative Works
130
+ that You distribute, all copyright, patent, trademark, and
131
+ attribution notices from the Source form of the Work,
132
+ excluding those notices that do not pertain to any part of
133
+ the Derivative Works; and
134
+
135
+ (d) If the Work includes a "NOTICE" text file as part of its
136
+ distribution, then any Derivative Works that You distribute must
137
+ include a readable copy of the attribution notices contained
138
+ within such NOTICE file, excluding those notices that do not
139
+ pertain to any part of the Derivative Works, in at least one
140
+ of the following places: within a NOTICE text file distributed
141
+ as part of the Derivative Works; within the Source form or
142
+ documentation, if provided along with the Derivative Works; or,
143
+ within a display generated by the Derivative Works, if and
144
+ wherever such third-party notices normally appear. The contents
145
+ of the NOTICE file are for informational purposes only and
146
+ do not modify the License. You may add Your own attribution
147
+ notices within Derivative Works that You distribute, alongside
148
+ or as an addendum to the NOTICE text from the Work, provided
149
+ that such additional attribution notices cannot be construed
150
+ as modifying the License.
151
+
152
+ You may add Your own copyright statement to Your modifications and
153
+ may provide additional or different license terms and conditions
154
+ for use, reproduction, or distribution of Your modifications, or
155
+ for any such Derivative Works as a whole, provided Your use,
156
+ reproduction, and distribution of the Work otherwise complies with
157
+ the conditions stated in this License.
158
+
159
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
160
+ any Contribution intentionally submitted for inclusion in the Work
161
+ by You to the Licensor shall be under the terms and conditions of
162
+ this License, without any additional terms or conditions.
163
+ Notwithstanding the above, nothing herein shall supersede or modify
164
+ the terms of any separate license agreement you may have executed
165
+ with Licensor regarding such Contributions.
166
+
167
+ 6. Trademarks. This License does not grant permission to use the trade
168
+ names, trademarks, service marks, or product names of the Licensor,
169
+ except as required for reasonable and customary use in describing the
170
+ origin of the Work and reproducing the content of the NOTICE file.
171
+
172
+ 7. Disclaimer of Warranty. Unless required by applicable law or
173
+ agreed to in writing, Licensor provides the Work (and each
174
+ Contributor provides its Contributions) on an "AS IS" BASIS,
175
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
176
+ implied, including, without limitation, any warranties or conditions
177
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
178
+ PARTICULAR PURPOSE. You are solely responsible for determining the
179
+ appropriateness of using or redistributing the Work and assume any
180
+ risks associated with Your exercise of permissions under this License.
181
+
182
+ 8. Limitation of Liability. In no event and under no legal theory,
183
+ whether in tort (including negligence), contract, or otherwise,
184
+ unless required by applicable law (such as deliberate and grossly
185
+ negligent acts) or agreed to in writing, shall any Contributor be
186
+ liable to You for damages, including any direct, indirect, special,
187
+ incidental, or consequential damages of any character arising as a
188
+ result of this License or out of the use or inability to use the
189
+ Work (including but not limited to damages for loss of goodwill,
190
+ work stoppage, computer failure or malfunction, or any and all
191
+ other commercial damages or losses), even if such Contributor
192
+ has been advised of the possibility of such damages.
193
+
194
+ 9. Accepting Warranty or Additional Liability. While redistributing
195
+ the Work or Derivative Works thereof, You may choose to offer,
196
+ and charge a fee for, acceptance of support, warranty, indemnity,
197
+ or other liability obligations and/or rights consistent with this
198
+ License. However, in accepting such obligations, You may act only
199
+ on Your own behalf and on Your sole responsibility, not on behalf
200
+ of any other Contributor, and only if You agree to indemnify,
201
+ defend, and hold each Contributor harmless for any liability
202
+ incurred by, or claims asserted against, such Contributor by reason
203
+ of your accepting any such warranty or additional liability.
204
+
205
+ END OF TERMS AND CONDITIONS
206
+ ```
207
+
208
+ </details>
209
+
210
+ <details><summary>MIT Software License</summary>
211
+
212
+ ```
213
+ Permission is hereby granted, free of charge, to any person obtaining a copy
214
+ of this software and associated documentation files (the "Software"), to deal
215
+ in the Software without restriction, including without limitation the rights
216
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
217
+ copies of the Software, and to permit persons to whom the Software is
218
+ furnished to do so, subject to the following conditions:
219
+
220
+ The above copyright notice and this permission notice shall be included in
221
+ all copies or substantial portions of the Software.
222
+
223
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
224
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
225
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
226
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
227
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
228
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
229
+ THE SOFTWARE.
230
+ ```
231
+
232
+ </details>
package/README.md ADDED
@@ -0,0 +1,264 @@
1
+ # call-ai
2
+
3
+ A lightweight library for making AI API calls with streaming support.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install call-ai
9
+ # or
10
+ yarn add call-ai
11
+ # or
12
+ pnpm add call-ai
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```typescript
18
+ import { callAi } from "call-ai";
19
+
20
+ // Basic usage with string prompt (non-streaming by default)
21
+ const response = await callAi("Explain quantum computing in simple terms", {
22
+ apiKey: "your-api-key",
23
+ model: "gpt-4",
24
+ });
25
+
26
+ // The response is the complete text
27
+ console.log(response);
28
+
29
+ // With streaming enabled (returns an AsyncGenerator)
30
+ const generator = callAi("Tell me a story", {
31
+ apiKey: "your-api-key",
32
+ model: "gpt-4",
33
+ stream: true,
34
+ });
35
+
36
+ // Process streaming updates
37
+ for await (const chunk of generator) {
38
+ console.log(chunk); // Streaming updates as they arrive
39
+ }
40
+
41
+ // Using message array for more control
42
+ const messages = [
43
+ { role: "system", content: "You are a helpful assistant." },
44
+ { role: "user", content: "Explain quantum computing in simple terms" },
45
+ ];
46
+
47
+ const response = await callAi(messages, {
48
+ apiKey: "your-api-key",
49
+ model: "gpt-4",
50
+ });
51
+
52
+ console.log(response);
53
+
54
+ // Using schema for structured output
55
+ const schema = {
56
+ name: "exercise_summary",
57
+ properties: {
58
+ title: { type: "string" },
59
+ summary: { type: "string" },
60
+ points: { type: "array", items: { type: "string" } },
61
+ },
62
+ required: ["title", "summary"],
63
+ };
64
+
65
+ const response = await callAi("Summarize the benefits of exercise", {
66
+ apiKey: "your-api-key",
67
+ schema: schema,
68
+ });
69
+
70
+ const structuredOutput = JSON.parse(response);
71
+ console.log(structuredOutput.title);
72
+
73
+ // Streaming with schema for OpenRouter structured JSON output
74
+ const schema = {
75
+ properties: {
76
+ title: { type: "string" },
77
+ items: {
78
+ type: "array",
79
+ items: {
80
+ type: "object",
81
+ properties: {
82
+ name: { type: "string" },
83
+ description: { type: "string" },
84
+ },
85
+ },
86
+ },
87
+ },
88
+ };
89
+
90
+ const generator = callAi("Create a list of sci-fi books", {
91
+ apiKey: "your-api-key",
92
+ stream: true,
93
+ schema: schema,
94
+ });
95
+
96
+ for await (const chunk of generator) {
97
+ console.log(chunk); // Shows the partial JSON as it's being generated
98
+ }
99
+ ```
100
+
101
+ ## Features
102
+
103
+ - 🔄 Streaming responses via AsyncGenerator when `stream: true`
104
+ - 🧩 Structured JSON outputs with schema validation
105
+ - 🔌 Full compatibility with OpenRouter's JSON schema format for structured outputs
106
+ - 📝 Support for message arrays with system, user, and assistant roles
107
+ - 🔧 TypeScript support with full type definitions
108
+ - ✅ Works in Node.js and browser environments
109
+
110
+ ## Supported LLM Providers
111
+
112
+ Call-AI supports all models available through OpenRouter, including:
113
+
114
+ - OpenAI models (GPT-4, GPT-3.5, etc.)
115
+ - Anthropic Claude
116
+ - Gemini
117
+ - Llama 3
118
+ - Mistral
119
+ - And many more
120
+
121
+ ## Choosing a model
122
+
123
+ Different LLMs have different strengths when working with structured data. Based on our testing, here's a guide to help you choose the right model for your schema needs:
124
+
125
+ ### Schema Complexity Guide
126
+
127
+ | Model Family | Grade | Simple Flat Schema | Complex Flat Schema | Nested Schema | Best For |
128
+ | ------------ | ----- | ------------------ | -------------------------------- | ------------- | --------------------------------------------------------- |
129
+ | OpenAI | A | ✅ Excellent | ✅ Excellent | ✅ Excellent | Most reliable for all schema types |
130
+ | Gemini | A | ✅ Excellent | ✅ Excellent | ✅ Good | Good all-around performance, especially with flat schemas |
131
+ | Claude | B | ✅ Excellent | ⚠️ Good (occasional JSON errors) | ✅ Good | Simple schemas, robust handling of complex prompts |
132
+ | Llama 3 | C | ✅ Good | ✅ Good | ❌ Poor | Simpler flat schemas, may struggle with nested structures |
133
+ | Deepseek | C | ✅ Good | ✅ Good | ❌ Poor | Basic flat schemas only |
134
+
135
+ ### Schema Structure Recommendations
136
+
137
+ 1. **Flat schemas perform better across all models**. If you need maximum compatibility, avoid deeply nested structures.
138
+
139
+ 2. **Field names matter**. Some models have preferences for certain property naming patterns:
140
+ - Use simple, common naming patterns like `name`, `type`, `items`, `price`
141
+ - Avoid deeply nested object hierarchies (more than 2 levels deep)
142
+ - Keep array items simple (strings or flat objects)
143
+
144
+ 3. **Model-specific considerations**:
145
+ - **OpenAI models**: Best overall schema adherence and handle complex nesting well
146
+ - **Claude models**: Great for simple schemas, occasional JSON formatting issues with complex structures
147
+ - **Gemini models**: Good general performance, handles array properties well
148
+ - **Llama/Mistral/Deepseek**: Strong with flat schemas, but often ignore nesting structure and provide their own organization
149
+
150
+ 4. **For mission-critical applications** requiring schema adherence, use OpenAI models or implement fallback mechanisms.
151
+
152
+ ## Setting API Keys
153
+
154
+ You can provide your API key in three ways:
155
+
156
+ 1. Directly in the options:
157
+
158
+ ```typescript
159
+ const response = await callAi("Hello", { apiKey: "your-api-key" });
160
+ ```
161
+
162
+ 2. Set globally in the browser:
163
+
164
+ ```typescript
165
+ window.CALLAI_API_KEY = "your-api-key";
166
+ const response = await callAi("Hello");
167
+ ```
168
+
169
+ 3. Use environment variables in Node.js (with a custom implementation):
170
+
171
+ ```typescript
172
+ // Example of environment variable integration
173
+ import { callAi } from "call-ai";
174
+ const apiKey = process.env.OPENAI_API_KEY || process.env.OPENROUTER_API_KEY;
175
+ const response = await callAi("Hello", { apiKey });
176
+ ```
177
+
178
+ ## API
179
+
180
+ ```typescript
181
+ // Main function
182
+ function callAi(prompt: string | Message[], options?: CallAIOptions): Promise<string> | AsyncGenerator<string, string, unknown>;
183
+
184
+ // Types
185
+ type Message = {
186
+ role: "user" | "system" | "assistant";
187
+ content: string;
188
+ };
189
+
190
+ interface Schema {
191
+ /**
192
+ * Optional schema name that will be sent to the model provider if supported
193
+ */
194
+ name?: string;
195
+ properties: Record<string, any>;
196
+ required?: string[];
197
+ additionalProperties?: boolean;
198
+ }
199
+
200
+ interface CallAIOptions {
201
+ apiKey?: string;
202
+ model?: string;
203
+ endpoint?: string;
204
+ stream?: boolean;
205
+ schema?: Schema | null;
206
+ [key: string]: any;
207
+ }
208
+ ```
209
+
210
+ ### Options
211
+
212
+ - `apiKey`: Your API key (can also be set via window.CALLAI_API_KEY)
213
+ - `model`: Model identifier (default: 'openrouter/auto')
214
+ - `endpoint`: API endpoint (default: 'https://openrouter.ai/api/v1/chat/completions')
215
+ - `stream`: Enable streaming responses (default: false)
216
+ - `schema`: Optional JSON schema for structured output
217
+ - Any other options are passed directly to the API (temperature, max_tokens, etc.)
218
+
219
+ ## License
220
+
221
+ MIT or Apache-2.0, at your option
222
+
223
+ ## Contributing and Release Process
224
+
225
+ ### Development
226
+
227
+ 1. Fork the repository
228
+ 2. Make your changes
229
+ 3. Add tests for new functionality
230
+ 4. Run tests: `npm test`
231
+ 5. Run type checking: `npm run typecheck`
232
+ 6. Create a pull request
233
+
234
+ ### Integration Tests
235
+
236
+ The project includes integration tests that make real API calls to verify functionality with actual LLM models:
237
+
238
+ 1. Copy `.env.example` to `.env` and add your OpenRouter API key
239
+ 2. Run integration tests: `npm run test:integration`
240
+
241
+ Note: Integration tests are excluded from the normal test suite to avoid making API calls during CI/CD. They require a valid API key to execute and will be skipped if no key is provided.
242
+
243
+ ### Release Process
244
+
245
+ This library uses GitHub Actions to automate the release process:
246
+
247
+ 1. Update the version in `package.json` (follow semver)
248
+ 2. Update `CHANGELOG.md` with details of changes
249
+ 3. Commit changes: `git commit -am "Release vX.Y.Z"`
250
+ 4. Create a git tag: `git tag -a vX.Y.Z -m "Version X.Y.Z"`
251
+ 5. Push changes and tag: `git push origin main vX.Y.Z`
252
+
253
+ The GitHub workflow in `.github/workflows/publish.yml` will:
254
+
255
+ - Automatically trigger when a new tag is pushed
256
+ - Run tests and type checking
257
+ - Verify the tag signature
258
+ - Publish the package to npm
259
+
260
+ When making significant changes, remember to:
261
+
262
+ - Document breaking changes in the changelog
263
+ - Update documentation to reflect API changes
264
+ - Update TypeScript types
package/api-core.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { CallAIOptions, Message, StreamResponse, ThenableStreamResponse } from "./types.js";
2
+ import { PACKAGE_VERSION } from "./version.js";
3
+ declare function callAi(prompt: string | Message[], options?: CallAIOptions): Promise<string> | ThenableStreamResponse;
4
+ declare function bufferStreamingResults(generator: AsyncGenerator<string, string, unknown>): Promise<string>;
5
+ declare function createBackwardCompatStreamingProxy(promise: Promise<StreamResponse>): ThenableStreamResponse;
6
+ declare function prepareRequestParams(prompt: string | Message[], options?: CallAIOptions): {
7
+ messages: Message[] | {
8
+ role: string;
9
+ content: string;
10
+ }[];
11
+ apiKey: string;
12
+ };
13
+ export { callAi, bufferStreamingResults, createBackwardCompatStreamingProxy, prepareRequestParams, PACKAGE_VERSION };