aimyapi 0.1.4 → 0.1.5
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/example2.ts +2 -0
- package/example/example3.ts +5 -4
- package/package.json +1 -1
package/README.md
CHANGED
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
|
});
|