@xsai/embed 0.1.3 → 0.2.0-beta.2

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 (2) hide show
  1. package/dist/index.js +9 -13
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- // src/utils/embed.ts
2
- import { requestBody, requestHeaders, requestURL, responseJSON } from "@xsai/shared";
3
- var embed = async (options) => (options.fetch ?? globalThis.fetch)(requestURL("embeddings", options.baseURL), {
1
+ import { requestURL, requestHeaders, requestBody, responseJSON } from '@xsai/shared';
2
+
3
+ const embed = async (options) => (options.fetch ?? globalThis.fetch)(requestURL("embeddings", options.baseURL), {
4
4
  body: requestBody(options),
5
5
  headers: requestHeaders({
6
6
  "Content-Type": "application/json",
@@ -14,22 +14,18 @@ var embed = async (options) => (options.fetch ?? globalThis.fetch)(requestURL("e
14
14
  usage
15
15
  }));
16
16
 
17
- // src/utils/embed-many.ts
18
- import { requestBody as requestBody2, requestHeaders as requestHeaders2, requestURL as requestURL2, responseJSON as responseJSON2 } from "@xsai/shared";
19
- var embedMany = async (options) => (options.fetch ?? globalThis.fetch)(requestURL2("embeddings", options.baseURL), {
20
- body: requestBody2(options),
21
- headers: requestHeaders2({
17
+ const embedMany = async (options) => (options.fetch ?? globalThis.fetch)(requestURL("embeddings", options.baseURL), {
18
+ body: requestBody(options),
19
+ headers: requestHeaders({
22
20
  "Content-Type": "application/json",
23
21
  ...options.headers
24
22
  }, options.apiKey),
25
23
  method: "POST",
26
24
  signal: options.abortSignal
27
- }).then(responseJSON2).then(({ data, usage }) => ({
25
+ }).then(responseJSON).then(({ data, usage }) => ({
28
26
  embeddings: data.map((data2) => data2.embedding),
29
27
  input: options.input,
30
28
  usage
31
29
  }));
32
- export {
33
- embed,
34
- embedMany
35
- };
30
+
31
+ export { embed, embedMany };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xsai/embed",
3
3
  "type": "module",
4
- "version": "0.1.3",
4
+ "version": "0.2.0-beta.2",
5
5
  "description": "extra-small AI SDK for Browser, Node.js, Deno, Bun or Edge Runtime.",
6
6
  "author": "Moeru AI",
7
7
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  "@xsai/shared": ""
33
33
  },
34
34
  "scripts": {
35
- "build": "tsup",
35
+ "build": "pkgroll",
36
36
  "test": "vitest run",
37
37
  "test:watch": "vitest"
38
38
  },