aimyapi 0.1.4 → 0.1.6
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/README.md +4 -0
- package/example/example1.ts +3 -3
- package/example/example2.ts +2 -0
- package/example/example3.ts +5 -4
- package/package.json +1 -1
- package/prompts/create-task-prompt.md +2 -4
package/README.md
CHANGED
package/example/example1.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import path from "path";
|
|
1
2
|
import AIMyAPI from "../lib";
|
|
2
|
-
import { API } from "./sales_api_impl";
|
|
3
3
|
import * as APIExports from "./sales_api";
|
|
4
|
-
import
|
|
4
|
+
import { API } from "./sales_api_impl";
|
|
5
5
|
|
|
6
6
|
// Simpler example using no support for chat history;
|
|
7
7
|
|
|
@@ -20,7 +20,7 @@ import path from "path";
|
|
|
20
20
|
console.log("Print 'hello' three times.")
|
|
21
21
|
await aimyapi.processRequest("Print 'hello' three times.");
|
|
22
22
|
|
|
23
|
-
console.log("What
|
|
23
|
+
console.log("What month had the highest sales in 2020 for any business unit?")
|
|
24
24
|
await aimyapi.processRequest("What was our best month in 2020");
|
|
25
25
|
|
|
26
26
|
console.log("Which business unit had the highest sales in 2020?")
|
package/example/example2.ts
CHANGED
|
@@ -5,6 +5,8 @@ import path from "path";
|
|
|
5
5
|
|
|
6
6
|
// More complex fast food ordering example that uses chat history.
|
|
7
7
|
// Fast food ordering example.
|
|
8
|
+
|
|
9
|
+
// IDEA: If the order history becomes too long, we could summarize it by listing the current order state and remove the rest.
|
|
8
10
|
(async () => {
|
|
9
11
|
const api = new OrderingAPI();
|
|
10
12
|
|
package/example/example3.ts
CHANGED
|
@@ -23,15 +23,16 @@ function getInput(query): Promise<string> {
|
|
|
23
23
|
// Interactive version
|
|
24
24
|
(async () => {
|
|
25
25
|
const api = new OrderingAPI();
|
|
26
|
-
|
|
27
|
-
const
|
|
26
|
+
|
|
27
|
+
const options = {
|
|
28
28
|
apiObject: api,
|
|
29
29
|
apiGlobalName: "orderingApi", // Should match whatever you declared as your global in your ordering api.
|
|
30
30
|
apiExports: APIExports,
|
|
31
31
|
apiDefFilePath: path.join(__dirname, "./ordering_api.ts"),
|
|
32
32
|
apiDocsPath: path.join(__dirname, "./ordering_api.md"),
|
|
33
33
|
debug: false,
|
|
34
|
-
}
|
|
34
|
+
};
|
|
35
|
+
const aimyapi = await AIMyAPI.createWithAPI(options)
|
|
35
36
|
|
|
36
37
|
async function runQuery(query:string) {
|
|
37
38
|
console.log(`Query: ${query}`)
|
|
@@ -46,7 +47,7 @@ function getInput(query): Promise<string> {
|
|
|
46
47
|
});
|
|
47
48
|
|
|
48
49
|
api._addMessageToHistory({
|
|
49
|
-
content: '```\n' + code + '\n```',
|
|
50
|
+
content: '```\n' + code.replace(options.apiDefFilePath, "./api.ts") + '\n```',
|
|
50
51
|
role: "assistant",
|
|
51
52
|
name: "assistant",
|
|
52
53
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
You are
|
|
2
|
-
|
|
3
|
-
Respond only with code - do not include any extra explanations or questions outside of the code.
|
|
4
|
-
if you need to talk to the user, do so using functions provided by the API.
|
|
1
|
+
You are a helpful assistant who speaks only in Typescript.
|
|
2
|
+
You fulfill user requests by writing code.
|
|
5
3
|
You comment your code and are sure to properly escape your strings and follow good programming practices.
|
|
6
4
|
|
|
7
5
|
Here is the API that you will use:
|