|
1 | 1 | # @auraone/sdk |
2 | 2 |
|
3 | | -Official TypeScript SDK for the AuraOne hosted API. |
| 3 | +Build Node.js and TypeScript integrations for the AuraOne hosted API without hand-writing REST, auth, polling, or service wrappers. |
4 | 4 |
|
5 | | -This is the **hosted** SDK — it speaks to the AuraOne platform at `api.auraone.ai`. For local, no-account-required evaluation tooling (rubric validation, scoring, judge calibration, IAA, drift, leakage audits), use [`auraone-evalkit`](https://pypi.org/project/auraone-evalkit/) from the [`auraoneai/open`](https://github.com/auraoneai/open) repository instead. |
| 5 | +[](https://www.npmjs.com/package/@auraone/sdk) |
| 6 | +[](https://www.npmjs.com/package/@auraone/sdk) |
| 7 | +[](./LICENSE) |
| 8 | +[](https://github.com/auraoneai/sdk-typescript/actions/workflows/ci.yml) |
| 9 | +[](https://www.npmjs.com/package/@auraone/sdk) |
| 10 | + |
| 11 | +- Start evaluation runs, poll for completion, and fetch hosted AuraOne results from typed TypeScript methods. |
| 12 | +- Use API key, JWT token, or environment-based authentication without building request headers yourself. |
| 13 | +- Work with REST services, the GraphQL endpoint, and LangChain or LlamaIndex adapter shims from one package. |
| 14 | +- Ship both ESM and CommonJS consumers with bundled `.d.ts` declarations. |
6 | 15 |
|
7 | 16 | ## Install |
8 | 17 |
|
9 | 18 | ```bash |
10 | 19 | npm install @auraone/sdk |
11 | | -# or |
12 | 20 | pnpm add @auraone/sdk |
13 | | -# or |
14 | 21 | yarn add @auraone/sdk |
| 22 | +bun add @auraone/sdk |
| 23 | +``` |
| 24 | + |
| 25 | +## Quickstart |
| 26 | + |
| 27 | +```typescript |
| 28 | +import { AuraOneClient } from "@auraone/sdk"; |
| 29 | + |
| 30 | +const apiKey = process.env.AURAONE_API_KEY; |
| 31 | +if (!apiKey) { |
| 32 | + throw new Error("Set AURAONE_API_KEY"); |
| 33 | +} |
| 34 | + |
| 35 | +const client = AuraOneClient.withApiKey(apiKey); |
| 36 | + |
| 37 | +const templates = await client.evaluations.listTemplates({ |
| 38 | + domain: "web", |
| 39 | + per_page: 5, |
| 40 | +}); |
| 41 | + |
| 42 | +console.log(templates.map((template) => template.id)); |
15 | 43 | ``` |
16 | 44 |
|
17 | | -## Quick start |
| 45 | +## Run An Evaluation |
18 | 46 |
|
19 | 47 | ```typescript |
20 | 48 | import { AuraOneClient } from "@auraone/sdk"; |
21 | 49 |
|
22 | | -const client = AuraOneClient.withApiKey(process.env.AURAONE_API_KEY!); |
| 50 | +const apiKey = process.env.AURAONE_API_KEY; |
| 51 | +if (!apiKey) { |
| 52 | + throw new Error("Set AURAONE_API_KEY"); |
| 53 | +} |
| 54 | + |
| 55 | +const client = AuraOneClient.withApiKey(apiKey); |
23 | 56 |
|
24 | 57 | const run = await client.evaluations.create({ |
25 | 58 | template_id: "rubric.web.qa", |
26 | | - agent_bundle_url: "s3://bundle.zip", |
| 59 | + agent_bundle_url: "s3://your-bucket/agent-bundle.zip", |
27 | 60 | wait: false, |
28 | 61 | }); |
29 | 62 |
|
30 | 63 | console.log(run.id, run.status); |
31 | 64 | ``` |
32 | 65 |
|
33 | | -## What's in the SDK |
| 66 | +## What You Can Build |
| 67 | + |
| 68 | +- Hosted evaluation dashboards that create runs, poll status, and display scores or artifacts. |
| 69 | +- Agent and model QA pipelines that submit bundles to AuraOne templates from CI or backend jobs. |
| 70 | +- Internal operations tools for analytics, training export, billing, governance, labs, and integrations. |
| 71 | +- Framework integrations that bridge AuraOne workflows into LangChain or LlamaIndex projects. |
| 72 | +- Typed GraphQL calls for API operations that are easier to express as a query. |
| 73 | + |
| 74 | +## Why @auraone/sdk? |
34 | 75 |
|
35 | | -- Domain services across evaluations, labs, training, analytics, collaboration, governance, billing, integrations, and more. |
36 | | -- Authentication via API key, scoped tokens, or OAuth (`AuthProvider`). |
37 | | -- Plugin shims for LangChain and LlamaIndex. |
38 | | -- GraphQL client alongside REST. |
39 | | -- Typed responses; the SDK ships its own `.d.ts` files. |
| 76 | +- **Less request plumbing.** The SDK owns base URLs, headers, idempotency keys for evaluation creation, retries, and timeouts. |
| 77 | +- **Typed hosted API calls.** Service methods return TypeScript types for evaluations, templates, reward specs, analytics, training, and more. |
| 78 | +- **Auth in one place.** Use `withApiKey`, `withToken`, `fromEnvironment`, or `AuthProvider` instead of scattering credential handling through your app. |
| 79 | +- **REST and GraphQL together.** Use service classes for common workflows and `client.graphql.request<T>()` when a GraphQL query is the right shape. |
| 80 | +- **Framework adapter shims.** Import LangChain and LlamaIndex helpers from the package instead of maintaining local glue code. |
40 | 81 |
|
41 | | -## Two-SDK architecture |
| 82 | +## Compared With Alternatives |
42 | 83 |
|
43 | | -| Package | What it is | When to use | |
| 84 | +| Need | `@auraone/sdk` | Alternative | |
44 | 85 | | --- | --- | --- | |
45 | | -| `@auraone/sdk` (this package) | Hosted API client (npm) | You have an AuraOne account and want to call hosted services. | |
46 | | -| `auraone-sdk` (PyPI) | Same API surface, Python edition | You prefer Python and want hosted services. | |
47 | | -| `auraone-evalkit` (PyPI) | Local OSS evaluation tooling | You want rubric/score/agreement/drift utilities without an account. See [auraoneai/open](https://github.com/auraoneai/open). | |
| 86 | +| Call the AuraOne hosted API from TypeScript | Typed client methods, auth helpers, and generated bundles for npm consumers | Raw `fetch` or a generic HTTP client requires custom headers, paths, retries, and response typing | |
| 87 | +| Run local, no-account evaluation utilities | Use [`auraone-evalkit`](https://pypi.org/project/auraone-evalkit/) instead | `@auraone/sdk` is intentionally for hosted AuraOne API access | |
| 88 | +| Use AuraOne from Python | Use the Python SDK package instead | This package targets Node.js and TypeScript applications | |
| 89 | +| Mix REST services and GraphQL | Includes both service wrappers and a `GraphQLClient` | A plain GraphQL client does not cover hosted REST services or auth conventions | |
48 | 90 |
|
49 | | -## Authentication |
| 91 | +## API Usage |
| 92 | + |
| 93 | +### Client Creation |
50 | 94 |
|
51 | 95 | ```typescript |
52 | 96 | import { AuraOneClient } from "@auraone/sdk"; |
53 | 97 |
|
54 | | -// API key (simplest) |
55 | | -const client = AuraOneClient.withApiKey(process.env.AURAONE_API_KEY!); |
| 98 | +const apiKey = process.env.AURAONE_API_KEY; |
| 99 | +if (!apiKey) { |
| 100 | + throw new Error("Set AURAONE_API_KEY"); |
| 101 | +} |
| 102 | + |
| 103 | +const token = process.env.AURAONE_TOKEN; |
| 104 | +if (!token) { |
| 105 | + throw new Error("Set AURAONE_TOKEN"); |
| 106 | +} |
| 107 | + |
| 108 | +const apiKeyClient = AuraOneClient.withApiKey(apiKey); |
| 109 | +const tokenClient = AuraOneClient.withToken(token); |
| 110 | +const envClient = AuraOneClient.fromEnvironment(); |
| 111 | +``` |
| 112 | + |
| 113 | +### Evaluations |
| 114 | + |
| 115 | +```typescript |
| 116 | +const templates = await envClient.evaluations.listTemplates({ domain: "web" }); |
| 117 | + |
| 118 | +const run = await envClient.evaluations.create({ |
| 119 | + template_id: templates[0]?.id ?? "rubric.web.qa", |
| 120 | + agent_bundle_url: "s3://your-bucket/agent-bundle.zip", |
| 121 | + wait: true, |
| 122 | + timeoutSeconds: 300, |
| 123 | +}); |
| 124 | + |
| 125 | +console.log(run.status, run.score); |
| 126 | +``` |
| 127 | + |
| 128 | +### GraphQL |
| 129 | + |
| 130 | +```typescript |
| 131 | +const ping = await envClient.graphql.request<{ __typename: string }>(` |
| 132 | + query Ping { |
| 133 | + __typename |
| 134 | + } |
| 135 | +`); |
56 | 136 |
|
57 | | -// Custom AuthProvider for refresh tokens / OAuth / scoped credentials |
58 | | -import { AuthProvider } from "@auraone/sdk"; |
59 | | -const authProvider = new AuthProvider({ /* ... */ }); |
60 | | -const client2 = new AuraOneClient({ authProvider }); |
| 137 | +console.log(ping.__typename); |
61 | 138 | ``` |
62 | 139 |
|
63 | | -## Documentation |
| 140 | +### Service Areas |
| 141 | + |
| 142 | +`AuraOneClient` exposes hosted API service groups for: |
| 143 | + |
| 144 | +- `auth` |
| 145 | +- `analytics` |
| 146 | +- `training` |
| 147 | +- `billing` |
| 148 | +- `collaboration` |
| 149 | +- `robotics` |
| 150 | +- `evaluations` |
| 151 | +- `graphql` |
| 152 | +- `labs` |
| 153 | +- `governance` |
| 154 | +- `integrations` |
| 155 | + |
| 156 | +The package also exports domain services for biology, chemistry, materials, environmental workflows, astronomy, climate, spatial 3D, finance, manufacturing, medical imaging, physics, and genomics. |
| 157 | + |
| 158 | +## Examples And Links |
64 | 159 |
|
65 | 160 | - Hosted API reference: https://www.auraone.ai/developers |
66 | 161 | - Tutorials: https://www.auraone.ai/resources/tutorials |
67 | 162 | - Deployment guide: https://www.auraone.ai/resources/docs/deployment |
| 163 | +- Changelog: [CHANGELOG.md](./CHANGELOG.md) |
| 164 | +- Security policy: [SECURITY.md](./SECURITY.md) |
| 165 | +- Contributing guide: [CONTRIBUTING.md](./CONTRIBUTING.md) |
| 166 | + |
| 167 | +## Compatibility And Limitations |
| 168 | + |
| 169 | +- Requires Node.js 18 or newer. |
| 170 | +- Supports ESM `import` and CommonJS `require` through the package `exports` map. |
| 171 | +- Ships TypeScript declarations at `dist/index.d.ts`. |
| 172 | +- Targets the hosted AuraOne API at `https://api.auraone.ai` by default. |
| 173 | +- Requires an AuraOne account and API key or token for hosted API calls. |
| 174 | +- Browser builds are not a primary target because parts of the SDK use Node APIs. |
| 175 | +- Use [`auraone-evalkit`](https://pypi.org/project/auraone-evalkit/) from [`auraoneai/open`](https://github.com/auraoneai/open) for local, no-account evaluation tooling such as rubric validation, scoring, judge calibration, IAA, drift, and leakage audits. |
68 | 176 |
|
69 | 177 | ## Development |
70 | 178 |
|
71 | 179 | ```bash |
72 | 180 | npm install |
73 | | -npm run build |
| 181 | +npm run typecheck |
| 182 | +npm run lint |
74 | 183 | npm test |
| 184 | +npm run build |
75 | 185 | ``` |
76 | 186 |
|
77 | | -## Versioning |
| 187 | +## Contributing |
78 | 188 |
|
79 | | -This SDK is at v0.1.0. We follow [semantic versioning](https://semver.org/). Breaking changes will only land in a major release after v1.0.0. |
| 189 | +Bug reports, documentation fixes, type refinements, and SDK convenience methods are welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md) and [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md). |
80 | 190 |
|
81 | 191 | ## License |
82 | 192 |
|
83 | | -MIT — see [LICENSE](LICENSE). |
| 193 | +MIT. See [LICENSE](./LICENSE). |
0 commit comments