aquin 0.1.0 → 0.2.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.
package/dist/client.d.ts CHANGED
@@ -6,6 +6,7 @@ export interface CompletionResponse {
6
6
  export interface CompletionOptions {
7
7
  max_tokens?: number;
8
8
  temperature?: number;
9
+ system_prompt?: string;
9
10
  }
10
11
  export declare class AquinClient {
11
12
  private apiKey;
package/dist/client.js CHANGED
@@ -11,7 +11,12 @@ class AquinClient {
11
11
  this.baseUrl = baseUrl.replace(/\/$/, "");
12
12
  }
13
13
  async complete(prompt, options = {}) {
14
- const { max_tokens = 512, temperature = 0.7 } = options;
14
+ const { max_tokens = 512, temperature = 0.7, system_prompt } = options;
15
+ const messages = [];
16
+ if (system_prompt)
17
+ messages.push({ role: "system", content: system_prompt });
18
+ messages.push({ role: "user", content: prompt });
19
+ const body = { prompt, messages, max_tokens, temperature };
15
20
  let res;
16
21
  try {
17
22
  res = await fetch(`${this.baseUrl}/api/v1/model`, {
@@ -20,7 +25,7 @@ class AquinClient {
20
25
  Authorization: `Bearer ${this.apiKey}`,
21
26
  "Content-Type": "application/json",
22
27
  },
23
- body: JSON.stringify({ prompt, max_tokens, temperature }),
28
+ body: JSON.stringify(body),
24
29
  redirect: "follow",
25
30
  });
26
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aquin",
3
- "version": "0.1.0",
3
+ "version": "0.2.2",
4
4
  "description": "JavaScript/TypeScript SDK for the Aquin model API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",