@xsai/embed 0.0.12 → 0.0.13

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/dist/index.d.ts CHANGED
@@ -3,7 +3,6 @@ import { CommonRequestOptions } from '@xsai/shared';
3
3
  interface EmbedOptions extends CommonRequestOptions {
4
4
  [key: string]: unknown;
5
5
  input: string;
6
- model: string;
7
6
  }
8
7
  interface EmbedResponseUsage {
9
8
  prompt_tokens: number;
@@ -19,7 +18,6 @@ declare const embed: (options: EmbedOptions) => Promise<EmbedResult>;
19
18
  interface EmbedManyOptions extends CommonRequestOptions {
20
19
  [key: string]: unknown;
21
20
  input: string[];
22
- model: string;
23
21
  }
24
22
  interface EmbedManyResult {
25
23
  embeddings: number[][];
package/dist/index.js CHANGED
@@ -1,16 +1,11 @@
1
- import { clean } from '@xsai/shared';
1
+ import { requestBody, requestHeaders } from '@xsai/shared';
2
2
 
3
3
  const embed = async (options) => await fetch(options.url, {
4
- body: JSON.stringify(clean({
5
- ...options,
6
- abortSignal: void 0,
7
- headers: void 0,
8
- url: void 0
9
- })),
10
- headers: {
4
+ body: requestBody(options),
5
+ headers: requestHeaders({
11
6
  "Content-Type": "application/json",
12
7
  ...options.headers
13
- },
8
+ }, options.apiKey),
14
9
  method: "POST",
15
10
  signal: options.abortSignal
16
11
  }).then((res) => res.json()).then(({ data, usage }) => ({
@@ -20,16 +15,11 @@ const embed = async (options) => await fetch(options.url, {
20
15
  }));
21
16
 
22
17
  const embedMany = async (options) => await fetch(options.url, {
23
- body: JSON.stringify(clean({
24
- ...options,
25
- abortSignal: void 0,
26
- headers: void 0,
27
- url: void 0
28
- })),
29
- headers: {
18
+ body: requestBody(options),
19
+ headers: requestHeaders({
30
20
  "Content-Type": "application/json",
31
21
  ...options.headers
32
- },
22
+ }, options.apiKey),
33
23
  method: "POST",
34
24
  signal: options.abortSignal
35
25
  }).then((res) => res.json()).then(({ data, usage }) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsai/embed",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "type": "module",
5
5
  "author": "Moeru AI",
6
6
  "license": "MIT",