@anuma/sdk 1.0.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/LICENSE +21 -0
- package/README.md +98 -0
- package/dist/expo/chunk-LJYAMK62.mjs +25 -0
- package/dist/expo/chunk-MJJIYFAX.mjs +25 -0
- package/dist/expo/chunk-PJCZO4BQ.mjs +25 -0
- package/dist/expo/clientConfig-2MI4KULF.mjs +10 -0
- package/dist/expo/clientConfig-QDAXFL3W.mjs +10 -0
- package/dist/expo/clientConfig-R4IOW7I2.mjs +10 -0
- package/dist/expo/index.cjs +7858 -0
- package/dist/expo/index.d.mts +2590 -0
- package/dist/expo/index.d.ts +2590 -0
- package/dist/expo/index.mjs +7770 -0
- package/dist/index.cjs +1200 -0
- package/dist/index.d.mts +2796 -0
- package/dist/index.d.ts +2796 -0
- package/dist/index.mjs +1138 -0
- package/dist/next/index.cjs +64 -0
- package/dist/next/index.d.mts +23 -0
- package/dist/next/index.d.ts +23 -0
- package/dist/next/index.mjs +39 -0
- package/dist/polyfills/index.cjs +61 -0
- package/dist/polyfills/index.d.mts +9 -0
- package/dist/polyfills/index.d.ts +9 -0
- package/dist/polyfills/index.mjs +34 -0
- package/dist/react/chunk-LJYAMK62.mjs +25 -0
- package/dist/react/chunk-MJJIYFAX.mjs +25 -0
- package/dist/react/chunk-PJCZO4BQ.mjs +25 -0
- package/dist/react/clientConfig-2MI4KULF.mjs +10 -0
- package/dist/react/clientConfig-QDAXFL3W.mjs +10 -0
- package/dist/react/clientConfig-R4IOW7I2.mjs +10 -0
- package/dist/react/index.cjs +15178 -0
- package/dist/react/index.d.mts +6014 -0
- package/dist/react/index.d.ts +6014 -0
- package/dist/react/index.mjs +14945 -0
- package/dist/tools/chunk-KDFGY4SK.mjs +13 -0
- package/dist/tools/clientConfig-RMDOT5YM.mjs +10 -0
- package/dist/tools/index.cjs +775 -0
- package/dist/tools/index.d.mts +121 -0
- package/dist/tools/index.d.ts +121 -0
- package/dist/tools/index.mjs +741 -0
- package/dist/vercel/index.cjs +86 -0
- package/dist/vercel/index.d.mts +149 -0
- package/dist/vercel/index.d.ts +149 -0
- package/dist/vercel/index.mjs +57 -0
- package/package.json +149 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 ZetaChain
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# @anuma/sdk
|
|
2
|
+
|
|
3
|
+
A TypeScript SDK that empowers developers to build AI-powered applications. It
|
|
4
|
+
enables you to send prompts to LLMs with streaming support, manage long-term
|
|
5
|
+
memories, and encrypt sensitive data, all without needing your own LLM API key.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm install @anuma/sdk@next
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
> **Note:** Currently, the SDK is pre-release so all new versions are released
|
|
14
|
+
> under the `next` tag (released on every merge to the `main` branch). Check out
|
|
15
|
+
> npm to see the latest version.
|
|
16
|
+
|
|
17
|
+
## Configuration
|
|
18
|
+
|
|
19
|
+
To use the SDK, you'll need to configure your Privy provider and API URL.
|
|
20
|
+
|
|
21
|
+
```env
|
|
22
|
+
PRIVY_APP_ID=cmhwlx82v000xle0cde4rjy5y
|
|
23
|
+
API_URL=https://portal.anuma-dev.ai
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Authentication
|
|
27
|
+
|
|
28
|
+
The SDK currently only supports authentication via [Privy](https://privy.io) and
|
|
29
|
+
expects a Privy identity token.
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { useIdentityToken } from "@privy-io/react-auth";
|
|
33
|
+
|
|
34
|
+
const { identityToken } = useIdentityToken();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
For React applications, use the hooks from `@anuma/sdk/react`:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { useChat } from "@anuma/sdk/react";
|
|
43
|
+
|
|
44
|
+
const { sendMessage, isLoading, stop } = useChat({
|
|
45
|
+
getToken: async () => identityToken || null,
|
|
46
|
+
onFinish: (response) => console.log("Chat finished:", response),
|
|
47
|
+
onError: (error) => console.error("Chat error:", error),
|
|
48
|
+
onData: (chunk) => console.log("Received chunk:", chunk),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
await sendMessage({
|
|
52
|
+
messages: [{ role: "user", content: [{ type: "text", text: "Hello!" }] }],
|
|
53
|
+
model: "gpt-4o-mini",
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
For React Native/Expo, use `@anuma/sdk/expo` instead.
|
|
58
|
+
|
|
59
|
+
For direct API access without React hooks, use the functions from this package:
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import { postApiV1Responses } from "@anuma/sdk";
|
|
63
|
+
|
|
64
|
+
const response = await postApiV1Responses({
|
|
65
|
+
body: {
|
|
66
|
+
messages: [
|
|
67
|
+
{ role: "user", content: [{ type: "text", text: "Tell me a joke" }] },
|
|
68
|
+
],
|
|
69
|
+
model: "gpt-4o-mini",
|
|
70
|
+
},
|
|
71
|
+
headers: {
|
|
72
|
+
Authorization: `Bearer ${identityToken}`,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## What's Included
|
|
78
|
+
|
|
79
|
+
The SDK provides everything you need to integrate AI capabilities into your
|
|
80
|
+
applications:
|
|
81
|
+
|
|
82
|
+
- **Chat completions** with streaming support and tool calling
|
|
83
|
+
- **Image generation** from text prompts
|
|
84
|
+
- **Text embeddings** for semantic search
|
|
85
|
+
- **Web search** integration
|
|
86
|
+
- **PDF and image text extraction** (OCR)
|
|
87
|
+
- **Memory and context management** for conversational AI
|
|
88
|
+
- **Wallet-based encryption** for secure data storage
|
|
89
|
+
|
|
90
|
+
## Documentation
|
|
91
|
+
|
|
92
|
+
https://ai-docs.zetachain.app
|
|
93
|
+
|
|
94
|
+
## Example Usage
|
|
95
|
+
|
|
96
|
+
For a complete example of how to use this SDK, check out [the example
|
|
97
|
+
repo](https://github.com/zeta-chain/ai-examples).
|
|
98
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// src/clientConfig.ts
|
|
13
|
+
var BASE_URL = "https://portal.anuma-dev.ai";
|
|
14
|
+
var MCP_R2_DOMAIN = "ai-image-mcp-images.4cf0e0ea50b97e72386fcf2f92a2d4e8.r2.cloudflarestorage.com";
|
|
15
|
+
var createClientConfig = (config) => ({
|
|
16
|
+
...config,
|
|
17
|
+
baseUrl: BASE_URL
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
__decorateClass,
|
|
22
|
+
BASE_URL,
|
|
23
|
+
MCP_R2_DOMAIN,
|
|
24
|
+
createClientConfig
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// src/clientConfig.ts
|
|
13
|
+
var BASE_URL = "https://portal.anuma-dev.ai";
|
|
14
|
+
var MCP_R2_DOMAIN = "4cf0e0ea50b97e72386fcf2f92a2d4e8.r2.cloudflarestorage.com";
|
|
15
|
+
var createClientConfig = (config) => ({
|
|
16
|
+
...config,
|
|
17
|
+
baseUrl: BASE_URL
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
__decorateClass,
|
|
22
|
+
BASE_URL,
|
|
23
|
+
MCP_R2_DOMAIN,
|
|
24
|
+
createClientConfig
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// src/clientConfig.ts
|
|
13
|
+
var BASE_URL = "https://ai-portal-dev.zetachain.com";
|
|
14
|
+
var MCP_R2_DOMAIN = "4cf0e0ea50b97e72386fcf2f92a2d4e8.r2.cloudflarestorage.com";
|
|
15
|
+
var createClientConfig = (config) => ({
|
|
16
|
+
...config,
|
|
17
|
+
baseUrl: BASE_URL
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
__decorateClass,
|
|
22
|
+
BASE_URL,
|
|
23
|
+
MCP_R2_DOMAIN,
|
|
24
|
+
createClientConfig
|
|
25
|
+
};
|